forked from extern/egroupware
fix not working buttons in timer dialog
This commit is contained in:
parent
691928a54c
commit
26d4082cda
@ -441,19 +441,6 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
|
||||
// If you use a template, the second parameter will be the value of the template, as if it were submitted.
|
||||
callback: (button_id, value) => // return false to prevent dialog closing
|
||||
{
|
||||
if (button_id !== 'close') {
|
||||
try {
|
||||
timerAction(button_id.replace(/_([a-z]+)\[([a-z]+)\]/, '$1-$2'),
|
||||
// eT2 operates in user-time, while timers here always operate in UTC
|
||||
value.time ? new Date((new Date(value.time)).valueOf() + egw.getTimezoneOffset() * 60000) : undefined);
|
||||
}
|
||||
catch (e) {
|
||||
Et2Dialog.alert(e, egw.lang('Invalid Input'), Et2Dialog.ERROR_MESSAGE);
|
||||
}
|
||||
setButtonState();
|
||||
updateTimes();
|
||||
return false;
|
||||
}
|
||||
dialog = undefined;
|
||||
},
|
||||
title: _title || 'Start & stop timer',
|
||||
@ -578,6 +565,28 @@ egw.extend('timer', egw.MODULE_GLOBAL, function()
|
||||
document.body.appendChild(dialog);
|
||||
},
|
||||
|
||||
/**
|
||||
* Start, Pause or Stop clicked in timer-dialog
|
||||
*
|
||||
* @param {Event} _ev
|
||||
* @param {Et2Button} _button
|
||||
*/
|
||||
timer_button: function(_ev, _button)
|
||||
{
|
||||
const value = dialog.value;
|
||||
try {
|
||||
timerAction(_button.id.replace(/^([a-z]+)\[([a-z]+)\]$/, '$1-$2'),
|
||||
// eT2 operates in user-time, while timers here always operate in UTC
|
||||
value.time ? new Date((new Date(value.time)).valueOf() + egw.getTimezoneOffset() * 60000) : undefined);
|
||||
}
|
||||
catch (e) {
|
||||
Et2Dialog.alert(e, egw.lang('Invalid Input'), Et2Dialog.ERROR_MESSAGE);
|
||||
}
|
||||
setButtonState();
|
||||
updateTimes();
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Start timer for given app and id
|
||||
*
|
||||
|
@ -17,9 +17,9 @@
|
||||
<row disabled="@disable=/specific/">
|
||||
<description value="Timer"/>
|
||||
<old-box id="specific_timer" value="00:00" class="timesheet_timer"/>
|
||||
<et2-button id="specific[start]" label="Start" image="timesheet/play-blue"/>
|
||||
<et2-button id="specific[pause]" label="Pause" image="timesheet/pause-orange" disabled="true"/>
|
||||
<et2-button id="specific[stop]" label="Stop" image="timesheet/stop" disabled="true"/>
|
||||
<et2-button id="specific[start]" label="Start" image="timesheet/play-blue" onclick="egw.timer_button"/>
|
||||
<et2-button id="specific[pause]" label="Pause" image="timesheet/pause-orange" disabled="true" onclick="egw.timer_button"/>
|
||||
<et2-button id="specific[stop]" label="Stop" image="timesheet/stop" disabled="true" onclick="egw.timer_button"/>
|
||||
</row>
|
||||
<row disabled="@disable=/specific/">
|
||||
<description />
|
||||
@ -31,9 +31,9 @@
|
||||
<row disabled="@disable=/overall/">
|
||||
<description value="Working time"/>
|
||||
<old-box id="overall_timer" value="00:00" class="timesheet_timer overall"/>
|
||||
<et2-button id="overall[start]" label="Start" image="timesheet/play"/>
|
||||
<et2-button id="overall[pause]" label="Pause" image="timesheet/pause-orange" disabled="true"/>
|
||||
<et2-button id="overall[stop]" label="Stop" image="timesheet/stop" disabled="true"/>
|
||||
<et2-button id="overall[start]" label="Start" image="timesheet/play" onclick="egw.timer_button"/>
|
||||
<et2-button id="overall[pause]" label="Pause" image="timesheet/pause-orange" disabled="true" onclick="egw.timer_button"/>
|
||||
<et2-button id="overall[stop]" label="Stop" image="timesheet/stop" disabled="true" onclick="egw.timer_button"/>
|
||||
</row>
|
||||
<row disabled="@disable=/overall/">
|
||||
<description />
|
||||
|
Loading…
Reference in New Issue
Block a user