diff --git a/api/js/jsapi/egw_timer.js b/api/js/jsapi/egw_timer.js index 9dff3b182f..58f4fc2d6d 100644 --- a/api/js/jsapi/egw_timer.js +++ b/api/js/jsapi/egw_timer.js @@ -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 * diff --git a/timesheet/templates/default/timer.xet b/timesheet/templates/default/timer.xet index f0a6d2a3d7..c0efc4fa57 100644 --- a/timesheet/templates/default/timer.xet +++ b/timesheet/templates/default/timer.xet @@ -17,9 +17,9 @@ - - - + + + @@ -31,9 +31,9 @@ - - - + + +