diff --git a/views/bootstrap/class.SchedulerTaskMgr.php b/views/bootstrap/class.SchedulerTaskMgr.php index 0eb5458d5..8cb227173 100644 --- a/views/bootstrap/class.SchedulerTaskMgr.php +++ b/views/bootstrap/class.SchedulerTaskMgr.php @@ -44,6 +44,52 @@ $(document).ready( function() { $('#editaddtask.ajax').trigger('update', {taskid: $(this).data('id'), action: $(this).data('action')}); }); $('#listtasks.ajax').trigger('update', {}); + + $('body').on('click', '.removetask', function(ev){ + ev.preventDefault(); + ev.stopPropagation(); + id = $(ev.currentTarget).attr('rel'); + confirmmsg = $(ev.currentTarget).attr('confirmmsg'); + msg = $(ev.currentTarget).attr('msg'); + formtoken = '= createFormKey('removetask') ?>'; + bootbox.dialog(confirmmsg, [{ + "label" : " = getMLText("rm_task") ?>", + "class" : "btn-danger", + "callback": function() { + $.post('../op/op.SchedulerTaskMgr.php', + { action: 'removetask', taskid: id, formtoken: formtoken }, + function(data) { + if(data.success) { + $('#table-row-task-'+id).hide('slow'); + noty({ + text: msg, + type: 'success', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + } else { + noty({ + text: data.message, + type: 'error', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 3500, + }); + } + }, + 'json' + ); + } + }, { + "label" : "= getMLText("cancel") ?>", + "class" : "btn-cancel", + "callback": function() { + } + }]); + }); }); params['taskid']; $task = $scheduler->getTask($taskid); + if(!isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()])) { + $this->errorMsg(getMLText('scheduler_extension_not_available')); + return; + } + $taskobj = $GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()]; ?>