2018-04-04 13:31:43 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Implementation of SchedulerTaskMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @license GPL 2
|
|
|
|
* @version @version@
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2013 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Include parent class
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
//require_once("class.Bootstrap.php");
|
2018-04-04 13:31:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class which outputs the html page for SchedulerTaskMgr view
|
|
|
|
*
|
|
|
|
* @category DMS
|
|
|
|
* @package SeedDMS
|
|
|
|
* @author Uwe Steinmann <uwe@steinmann.cx>
|
|
|
|
* @copyright Copyright (C) 2013 Uwe Steinmann
|
|
|
|
* @version Release: @package_version@
|
|
|
|
*/
|
2021-04-19 17:45:40 +00:00
|
|
|
class SeedDMS_View_SchedulerTaskMgr extends SeedDMS_Theme_Style {
|
2018-04-04 13:31:43 +00:00
|
|
|
|
|
|
|
function js() { /* {{{ */
|
|
|
|
header('Content-Type: application/javascript');
|
|
|
|
?>
|
|
|
|
$(document).ready( function() {
|
|
|
|
$('body').on('click', '.addtask', function(ev){
|
|
|
|
ev.preventDefault();
|
|
|
|
$('#editaddtask.ajax').trigger('update', {extension: $(this).data('extension'), task: $(this).data('task')});
|
|
|
|
});
|
|
|
|
$('body').on('click', '.listtasks', function(ev){
|
|
|
|
ev.preventDefault();
|
|
|
|
$('#listtasks.ajax').trigger('update', {extension: $(this).data('extension'), task: $(this).data('task')});
|
|
|
|
});
|
|
|
|
$('body').on('click', '.edittask', function(ev){
|
|
|
|
ev.preventDefault();
|
|
|
|
$('#editaddtask.ajax').trigger('update', {taskid: $(this).data('id'), action: $(this).data('action')});
|
2021-04-03 05:50:47 +00:00
|
|
|
$("html, body").animate({ scrollTop: 0 }, "slow");
|
2018-04-04 13:31:43 +00:00
|
|
|
});
|
|
|
|
$('#listtasks.ajax').trigger('update', {});
|
2020-05-19 06:07:21 +00:00
|
|
|
|
|
|
|
$('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, [{
|
2020-08-27 06:48:43 +00:00
|
|
|
"label" : "<i class='fa fa-remove'></i> <?= getMLText("rm_task") ?>",
|
2020-05-19 06:07:21 +00:00
|
|
|
"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() {
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
});
|
2018-04-04 13:31:43 +00:00
|
|
|
});
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
public function form() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$extname = $this->params['extname'];
|
|
|
|
$taskname = $this->params['taskname'];
|
2020-06-28 11:59:54 +00:00
|
|
|
if($extname && $taskname && is_object($taskobj = resolveTask($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$extname][$taskname]))) {
|
2018-04-04 13:31:43 +00:00
|
|
|
if(method_exists($taskobj, 'getAdditionalParams'))
|
|
|
|
$additionalparams = $taskobj->getAdditionalParams();
|
|
|
|
else
|
|
|
|
$additionalparams = null;
|
|
|
|
?>
|
|
|
|
<form action="../op/op.SchedulerTaskMgr.php" method="post" class="form-horizontal">
|
|
|
|
<?= createHiddenFieldWithKey('addtask') ?>
|
|
|
|
<input type="hidden" name="action" value="addtask">
|
|
|
|
<input type="hidden" name="extension" value="<?= $extname ?>">
|
|
|
|
<input type="hidden" name="task" value="<?= $taskname ?>">
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="extension"><?= getMLText("scheduler_class");?>:</label>
|
|
|
|
<div class="controls">
|
|
|
|
<span class="input uneditable-input"><?= $extname ?>::<?= $taskname ?></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2021-04-06 05:56:47 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText('task_name'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'name',
|
|
|
|
'name'=>'name',
|
|
|
|
'value'=>'',
|
|
|
|
'required'=>true,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_description'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'description',
|
|
|
|
'name'=>'description',
|
|
|
|
'value'=>'',
|
|
|
|
'required'=>false,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_frequency'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'frequency',
|
|
|
|
'name'=>'frequency',
|
|
|
|
'value'=>'',
|
|
|
|
'required'=>true,
|
2021-04-22 07:28:07 +00:00
|
|
|
'placeholder'=>getMLText('task_frequency_placeholder'),
|
2021-04-06 05:56:47 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_disabled'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'checkbox',
|
|
|
|
'id'=>'disabled',
|
|
|
|
'name'=>'disabled',
|
|
|
|
'value'=>'1',
|
|
|
|
'checked'=>true,
|
|
|
|
)
|
|
|
|
);
|
2018-04-04 13:31:43 +00:00
|
|
|
if($additionalparams) {
|
|
|
|
foreach($additionalparams as $param) {
|
|
|
|
switch($param['type']) {
|
2020-05-18 14:23:57 +00:00
|
|
|
case 'boolean':
|
|
|
|
$this->formField(
|
|
|
|
getMLText("task_".$extname."_".$taskname."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'checkbox',
|
|
|
|
'id'=>'params_'.$param['name'],
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'value'=>'1',
|
|
|
|
'checked'=>false,
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2021-05-02 12:46:40 +00:00
|
|
|
)
|
2020-05-18 14:23:57 +00:00
|
|
|
);
|
|
|
|
break;
|
2020-06-25 06:54:37 +00:00
|
|
|
case 'password':
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_'.$extname."_".$taskname."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'password',
|
|
|
|
'id'=>'params_'.$param['name'],
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'required'=>false
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2020-06-25 06:54:37 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
2020-07-02 15:19:07 +00:00
|
|
|
case 'select':
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_'.$extname."_".$taskname."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'multiple'=>false,
|
|
|
|
'attributes'=>array(array('data-placeholder', getMLText('select_value'), array('data-no_results_text', getMLText('unknown_value')))),
|
|
|
|
'options'=>$param['options'],
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2020-07-02 15:19:07 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
2018-04-04 13:31:43 +00:00
|
|
|
default:
|
2020-06-25 06:54:37 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText('task_'.$extname."_".$taskname."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
2021-04-03 05:50:47 +00:00
|
|
|
'type'=>(($param['type'] == 'integer') ? 'number' : 'text'),
|
2020-06-25 06:54:37 +00:00
|
|
|
'id'=>'params_'.$param['name'],
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'required'=>false
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2020-06-25 06:54:37 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
2018-04-04 13:31:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="login"></label>
|
|
|
|
<div class="controls">
|
2020-08-27 06:48:43 +00:00
|
|
|
<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> <?php printMLText("save")?></button>
|
2018-04-04 13:31:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
public function edittask() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$scheduler = $this->params['scheduler'];
|
|
|
|
$taskid = $this->params['taskid'];
|
|
|
|
|
|
|
|
$task = $scheduler->getTask($taskid);
|
2020-05-19 06:07:21 +00:00
|
|
|
if(!isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()])) {
|
|
|
|
$this->errorMsg(getMLText('scheduler_extension_not_available'));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-04 13:31:43 +00:00
|
|
|
$taskobj = $GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()];
|
2020-06-28 11:59:54 +00:00
|
|
|
$taskobj = resolveTask($taskobj);
|
|
|
|
if(!is_object($taskobj)) {
|
|
|
|
$this->errorMsg(getMLText('task_class_not_callable'));
|
|
|
|
return;
|
|
|
|
}
|
2018-04-04 13:31:43 +00:00
|
|
|
?>
|
|
|
|
<form action="../op/op.SchedulerTaskMgr.php" method="post" class="form-horizontal">
|
|
|
|
<?= createHiddenFieldWithKey('edittask') ?>
|
|
|
|
<input type="hidden" name="action" value="edittask">
|
|
|
|
<input type="hidden" name="taskid" value="<?= $taskid ?>">
|
|
|
|
<input type="hidden" name="extension" value="<?= $task->getExtension() ?>">
|
|
|
|
<input type="hidden" name="task" value="<?= $task->getTask() ?>">
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="extension"><?= getMLText("scheduler_class");?>:</label>
|
|
|
|
<div class="controls">
|
|
|
|
<span class="input uneditable-input"><?= $task->getExtension() ?>::<?= $task->getTask() ?></span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<?php
|
2021-04-03 05:50:47 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText('task_name'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'name',
|
|
|
|
'name'=>'name',
|
|
|
|
'value'=>$task->getName(),
|
|
|
|
'required'=>true,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_description'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'description',
|
|
|
|
'name'=>'description',
|
|
|
|
'value'=>$task->getDescription(),
|
|
|
|
'required'=>false,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_frequency'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'text',
|
|
|
|
'id'=>'frequency',
|
|
|
|
'name'=>'frequency',
|
|
|
|
'value'=>$task->getFrequency(),
|
|
|
|
'required'=>true,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_disabled'),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'checkbox',
|
|
|
|
'id'=>'disabled',
|
|
|
|
'name'=>'disabled',
|
|
|
|
'value'=>'1',
|
|
|
|
'checked'=>$task->getDisabled(),
|
|
|
|
)
|
|
|
|
);
|
2018-04-04 13:31:43 +00:00
|
|
|
if($additionalparams = $taskobj->getAdditionalParams()) {
|
|
|
|
foreach($additionalparams as $param) {
|
|
|
|
switch($param['type']) {
|
2020-05-18 14:23:57 +00:00
|
|
|
case 'boolean':
|
|
|
|
$this->formField(
|
|
|
|
getMLText("task_".$task->getExtension()."_".$task->getTask()."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'checkbox',
|
|
|
|
'id'=>'params_'.$param['name'],
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'value'=>'1',
|
2020-05-19 06:07:21 +00:00
|
|
|
'checked'=>$task->getParameter($param['name']) == 1,
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2020-05-18 14:23:57 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
2020-06-25 06:54:37 +00:00
|
|
|
case 'password':
|
|
|
|
$this->formField(
|
|
|
|
getMLText("task_".$task->getExtension()."_".$task->getTask()."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
|
|
|
'type'=>'password',
|
|
|
|
'id'=>'params_'.$param['name'],
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'value'=>$task->getParameter()[$param['name']],
|
|
|
|
'required'=>false
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
|
|
|
case 'select':
|
|
|
|
$this->formField(
|
|
|
|
getMLText('task_'.$extname."_".$taskname."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'select',
|
|
|
|
'class'=>'chzn-select',
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'multiple'=>false,
|
|
|
|
'attributes'=>array(array('data-placeholder', getMLText('select_value'), array('data-no_results_text', getMLText('unknown_value')))),
|
|
|
|
'options'=>$task->getParameter()[$param['options']],
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2020-06-25 06:54:37 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
2018-04-04 13:31:43 +00:00
|
|
|
default:
|
2020-06-25 06:54:37 +00:00
|
|
|
$this->formField(
|
|
|
|
getMLText("task_".$task->getExtension()."_".$task->getTask()."_".$param['name']),
|
|
|
|
array(
|
|
|
|
'element'=>'input',
|
2021-04-03 05:50:47 +00:00
|
|
|
'type'=>(($param['type'] == 'integer') ? 'number' : 'text'),
|
2020-06-25 06:54:37 +00:00
|
|
|
'id'=>'params_'.$param['name'],
|
|
|
|
'name'=>'params['.$param['name'].']',
|
|
|
|
'value'=>$task->getParameter()[$param['name']],
|
|
|
|
'required'=>false
|
2021-04-06 05:56:47 +00:00
|
|
|
),
|
|
|
|
array(
|
|
|
|
'help'=>$param['description']
|
2020-06-25 06:54:37 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
break;
|
2018-04-04 13:31:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="control-group">
|
|
|
|
<label class="control-label" for="login"></label>
|
|
|
|
<div class="controls">
|
2020-08-27 06:48:43 +00:00
|
|
|
<button type="submit" class="btn btn-primary"><i class="fa fa-save"></i> <?php printMLText("save")?></button>
|
2018-04-04 13:31:43 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
public function tasklist() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$extname = $this->params['extname'];
|
|
|
|
$taskname = $this->params['taskname'];
|
|
|
|
$scheduler = $this->params['scheduler'];
|
|
|
|
|
|
|
|
if($extname && $taskname)
|
|
|
|
$tasks = $scheduler->getTasksByExtension($extname, $taskname);
|
|
|
|
else
|
|
|
|
$tasks = $scheduler->getTasks();
|
|
|
|
if(!$tasks)
|
|
|
|
return;
|
2020-06-27 10:27:59 +00:00
|
|
|
|
2018-04-04 13:31:43 +00:00
|
|
|
$this->contentHeading(getMLText("scheduler_class_tasks"));
|
|
|
|
echo "<table class=\"table _table-condensed\">\n";
|
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th>".getMLText('scheduler_class')."</th>\n";
|
2020-05-26 12:12:58 +00:00
|
|
|
print "<th>".getMLText('task_name')."/".getMLText('task_description')."</th>\n";
|
2018-04-04 13:31:43 +00:00
|
|
|
print "<th>".getMLText('task_frequency')."</th>\n";
|
|
|
|
print "<th>".getMLText('task_next_run')."</th>\n";
|
|
|
|
print "<th>".getMLText('task_last_run')."</th>\n";
|
|
|
|
print "<th></th>\n";
|
|
|
|
print "</tr></thead><tbody>\n";
|
2020-06-27 10:27:59 +00:00
|
|
|
foreach($tasks as $task) {
|
2020-06-28 11:59:54 +00:00
|
|
|
if(!isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()]) || !is_object(resolveTask($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()])))
|
2020-05-19 06:07:21 +00:00
|
|
|
$class = 'error';
|
|
|
|
else
|
|
|
|
$class = 'success';
|
|
|
|
echo "<tr id=\"table-row-task-".$task->getID()."\" class=\"".(!$task->getDisabled() ? " ".$class : "")."\">";
|
2018-04-04 13:31:43 +00:00
|
|
|
echo "<td>";
|
|
|
|
echo $task->getExtension()."::".$task->getTask();
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td width=\"100%\">";
|
2020-05-26 12:12:58 +00:00
|
|
|
echo "<strong>".$task->getName()."</strong></br>";
|
2018-04-04 13:31:43 +00:00
|
|
|
echo $task->getDescription();
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td>";
|
|
|
|
echo $task->getFrequency();
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td>";
|
2021-04-03 05:50:47 +00:00
|
|
|
echo getLongReadableDate(makeTsFromDate($task->getNextRun()));
|
2018-04-04 13:31:43 +00:00
|
|
|
echo "</td>";
|
|
|
|
echo "<td>";
|
2021-04-03 05:50:47 +00:00
|
|
|
echo getLongReadableDate(makeTsFromDate($task->getLastRun()));
|
2018-04-04 13:31:43 +00:00
|
|
|
echo "</td>";
|
2020-05-19 06:07:21 +00:00
|
|
|
echo "<td nowrap>";
|
2018-04-04 13:31:43 +00:00
|
|
|
print "<div class=\"list-action\">";
|
2020-08-27 06:48:43 +00:00
|
|
|
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=\"fa fa-remove\"></i></a>";
|
2020-05-19 06:07:21 +00:00
|
|
|
if(isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()])) {
|
2020-08-27 06:48:43 +00:00
|
|
|
print "<a class=\"edittask\" data-action=\"edittask\" data-id=\"".$task->getID()."\" href=\"../out/out.SchedulerTaskMgr.php?action=edittask\" title=\"".getMLText("edit_task")."\"><i class=\"fa fa-edit\"></i></a>";
|
2020-05-19 06:07:21 +00:00
|
|
|
}
|
2018-04-04 13:31:43 +00:00
|
|
|
print "</div>";
|
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
echo "</tbody></table>\n";
|
|
|
|
} /* }}} */
|
|
|
|
|
|
|
|
function show() { /* {{{ */
|
|
|
|
$dms = $this->params['dms'];
|
|
|
|
$user = $this->params['user'];
|
|
|
|
$extname = $this->params['extname'];
|
|
|
|
$taskname = $this->params['taskname'];
|
|
|
|
$scheduler = $this->params['scheduler'];
|
|
|
|
|
2020-05-19 06:07:21 +00:00
|
|
|
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
|
|
|
|
|
2018-04-04 13:31:43 +00:00
|
|
|
$this->htmlStartPage(getMLText("admin_tools"));
|
|
|
|
$this->globalNavigation();
|
|
|
|
$this->contentStart();
|
|
|
|
$this->pageNavigation(getMLText("admin_tools"), "admin_tools");
|
2018-04-05 06:16:28 +00:00
|
|
|
$this->contentHeading(getMLText("scheduler_task_mgr"));
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->rowStart();
|
|
|
|
$this->columnStart(6);
|
2018-04-05 06:54:08 +00:00
|
|
|
if(!empty($GLOBALS['SEEDDMS_SCHEDULER']['tasks'])) {
|
|
|
|
echo "<table class=\"table _table-condensed\">\n";
|
|
|
|
print "<thead>\n<tr>\n";
|
|
|
|
print "<th>".getMLText('scheduler_class')."</th>\n";
|
|
|
|
print "<th>".getMLText('scheduler_class_description')."</th>\n";
|
|
|
|
print "<th>".getMLText('scheduler_class_parameter')."</th>\n";
|
|
|
|
print "<th></th>\n";
|
|
|
|
print "</tr></thead><tbody>\n";
|
|
|
|
$errmsgs = array();
|
|
|
|
foreach($GLOBALS['SEEDDMS_SCHEDULER']['tasks'] as $extname=>$tasks) {
|
|
|
|
foreach($tasks as $taskname=>$task) {
|
2020-06-28 11:59:54 +00:00
|
|
|
$task = resolveTask($task);
|
|
|
|
if(!is_object($task))
|
|
|
|
continue;
|
2018-04-05 06:54:08 +00:00
|
|
|
echo "<tr>";
|
|
|
|
echo "<td>";
|
|
|
|
echo $extname."::".$taskname;
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td width=\"100%\">";
|
|
|
|
echo $task->getDescription();
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td>";
|
|
|
|
$params = $task->getAdditionalParams();
|
2020-05-19 06:07:21 +00:00
|
|
|
$k = array();
|
2018-04-05 06:54:08 +00:00
|
|
|
foreach($params as $param)
|
|
|
|
$k[] = $param['name'];
|
|
|
|
echo implode(', ', $k);
|
|
|
|
echo "</td>";
|
|
|
|
echo "<td>";
|
|
|
|
print "<div class=\"list-action\">";
|
|
|
|
$t = $scheduler->getTasksByExtension($extname, $taskname);
|
|
|
|
if($t) {
|
2020-08-27 06:48:43 +00:00
|
|
|
print "<a class=\"listtasks\" data-extension=\"".$extname."\" data-task=\"".$taskname."\" href=\"../out/out.SchedulerTaskMgr.php?extension=".$extname."&task=".$taskname."\" title=\"".getMLText("list_tasks")."\"><i class=\"fa fa-list\"></i></a>";
|
2018-04-05 06:54:08 +00:00
|
|
|
}
|
2020-08-27 06:48:43 +00:00
|
|
|
print "<a class=\"addtask\" data-extension=\"".$extname."\" data-task=\"".$taskname."\" href=\"../out/out.SchedulerTaskMgr.php?extension=".$extname."&task=".$taskname."\" title=\"".getMLText("add_task")."\"><i class=\"fa fa-plus\"></i></a>";
|
2018-04-05 06:54:08 +00:00
|
|
|
print "</div>";
|
|
|
|
echo "</td>";
|
|
|
|
echo "</tr>";
|
2018-04-04 13:31:43 +00:00
|
|
|
}
|
|
|
|
}
|
2018-04-05 06:54:08 +00:00
|
|
|
echo "</tbody></table>\n";
|
2018-04-04 13:31:43 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
<div id="listtasks" class="ajax" data-view="SchedulerTaskMgr" data-action="tasklist"></div>
|
2021-04-19 17:45:40 +00:00
|
|
|
<?php
|
|
|
|
$this->columnEnd();
|
|
|
|
$this->columnStart(6);
|
|
|
|
?>
|
2018-04-04 13:31:43 +00:00
|
|
|
<div id="editaddtask" class="ajax" data-view="SchedulerTaskMgr" data-action="form"></div>
|
|
|
|
<?php
|
2021-04-19 17:45:40 +00:00
|
|
|
$this->columnEnd();
|
|
|
|
$this->rowEnd();
|
2018-04-04 13:31:43 +00:00
|
|
|
$this->contentEnd();
|
|
|
|
$this->htmlEndPage();
|
|
|
|
} /* }}} */
|
|
|
|
}
|
|
|
|
?>
|