mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
add removal of task
This commit is contained in:
parent
df02d76e56
commit
c0f4ea859b
|
@ -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" : "<i class='icon-remove'></i> <?= 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() {
|
||||
}
|
||||
}]);
|
||||
});
|
||||
});
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
@ -138,6 +184,11 @@ $(document).ready( function() {
|
|||
$taskid = $this->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()];
|
||||
?>
|
||||
<form action="../op/op.SchedulerTaskMgr.php" method="post" class="form-horizontal">
|
||||
|
@ -190,7 +241,7 @@ $(document).ready( function() {
|
|||
'id'=>'params_'.$param['name'],
|
||||
'name'=>'params['.$param['name'].']',
|
||||
'value'=>'1',
|
||||
'checked'=>$task->getParameter()[$param['name']] == 1,
|
||||
'checked'=>$task->getParameter($param['name']) == 1,
|
||||
)
|
||||
);
|
||||
break;
|
||||
|
@ -244,7 +295,11 @@ $(document).ready( function() {
|
|||
print "<th></th>\n";
|
||||
print "</tr></thead><tbody>\n";
|
||||
foreach($tasks as $task) {
|
||||
echo "<tr".(!$task->getDisabled() ? " class=\"success\"" : "").">";
|
||||
if(!isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()]))
|
||||
$class = 'error';
|
||||
else
|
||||
$class = 'success';
|
||||
echo "<tr id=\"table-row-task-".$task->getID()."\" class=\"".(!$task->getDisabled() ? " ".$class : "")."\">";
|
||||
echo "<td>";
|
||||
echo $task->getExtension()."::".$task->getTask();
|
||||
echo "</td>";
|
||||
|
@ -263,9 +318,12 @@ $(document).ready( function() {
|
|||
echo "<td>";
|
||||
echo $task->getLastRun();
|
||||
echo "</td>";
|
||||
echo "<td>";
|
||||
echo "<td nowrap>";
|
||||
print "<div class=\"list-action\">";
|
||||
print "<a class=\"edittask\" data-action=\"edittask\" data-id=\"".$task->getID()."\" href=\"../out/out.SchedulerTaskMgr.php?action=edittask\" title=\"".getMLText("edit_task")."\"><i class=\"icon-edit\"></i></a>";
|
||||
print "<a class=\"removetask\" rel=\"".$task->getID()."\" msg=\"".getMLText('remove_task')."\" confirmmsg=\"".htmlspecialchars(getMLText("confirm_rm_task"), ENT_QUOTES)."\" title=\"".getMLText("remove_task")."\"><i class=\"icon-remove\"></i></a>";
|
||||
if(isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()])) {
|
||||
print "<a class=\"edittask\" data-action=\"edittask\" data-id=\"".$task->getID()."\" href=\"../out/out.SchedulerTaskMgr.php?action=edittask\" title=\"".getMLText("edit_task")."\"><i class=\"icon-edit\"></i></a>";
|
||||
}
|
||||
print "</div>";
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
|
@ -280,6 +338,8 @@ $(document).ready( function() {
|
|||
$taskname = $this->params['taskname'];
|
||||
$scheduler = $this->params['scheduler'];
|
||||
|
||||
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
|
||||
|
||||
$this->htmlStartPage(getMLText("admin_tools"));
|
||||
$this->globalNavigation();
|
||||
$this->contentStart();
|
||||
|
@ -309,6 +369,7 @@ $(document).ready( function() {
|
|||
echo "</td>";
|
||||
echo "<td>";
|
||||
$params = $task->getAdditionalParams();
|
||||
$k = array();
|
||||
foreach($params as $param)
|
||||
$k[] = $param['name'];
|
||||
echo implode(', ', $k);
|
||||
|
|
Loading…
Reference in New Issue
Block a user