* @copyright Copyright (C) 2013 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ require_once("class.Bootstrap.php"); /** * Class which outputs the html page for SchedulerTaskMgr view * * @category DMS * @package SeedDMS * @author Uwe Steinmann * @copyright Copyright (C) 2013 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_SchedulerTaskMgr extends SeedDMS_Bootstrap_Style { 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')}); }); $('#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 = ''; bootbox.dialog(confirmmsg, [{ "label" : " ", "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" : "", "class" : "btn-cancel", "callback": function() { } }]); }); }); params['dms']; $user = $this->params['user']; $extname = $this->params['extname']; $taskname = $this->params['taskname']; if($extname && $taskname) { $taskobj = $GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$extname][$taskname]; if(method_exists($taskobj, 'getAdditionalParams')) $additionalparams = $taskobj->getAdditionalParams(); else $additionalparams = null; ?>
::
formField( getMLText("task_".$extname."_".$taskname."_".$param['name']), array( 'element'=>'input', 'type'=>'checkbox', 'id'=>'params_'.$param['name'], 'name'=>'params['.$param['name'].']', 'value'=>'1', 'checked'=>false, ) ); break; default: ?>
params['dms']; $user = $this->params['user']; $scheduler = $this->params['scheduler']; $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()]; ?>
getExtension() ?>::getTask() ?>
getAdditionalParams()) { foreach($additionalparams as $param) { switch($param['type']) { 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', 'checked'=>$task->getParameter($param['name']) == 1, ) ); break; default: ?>
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; $this->contentHeading(getMLText("scheduler_class_tasks")); echo "\n"; print "\n\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; foreach($tasks as $task) { if(!isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()])) $class = 'error'; else $class = 'success'; echo "getID()."\" class=\"".(!$task->getDisabled() ? " ".$class : "")."\">"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
".getMLText('scheduler_class')."".getMLText('task_name')."/".getMLText('task_description')."".getMLText('task_frequency')."".getMLText('task_next_run')."".getMLText('task_last_run')."
"; echo $task->getExtension()."::".$task->getTask(); echo ""; echo "".$task->getName()."
"; echo $task->getDescription(); echo "
"; echo $task->getFrequency(); echo ""; echo $task->getNextRun(); echo ""; echo $task->getLastRun(); echo ""; print ""; echo "
\n"; } /* }}} */ function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $extname = $this->params['extname']; $taskname = $this->params['taskname']; $scheduler = $this->params['scheduler']; $this->htmlAddHeader(''."\n", 'js'); $this->htmlStartPage(getMLText("admin_tools")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); $this->contentHeading(getMLText("scheduler_task_mgr")); ?>
\n"; print "\n\n"; print "".getMLText('scheduler_class')."\n"; print "".getMLText('scheduler_class_description')."\n"; print "".getMLText('scheduler_class_parameter')."\n"; print "\n"; print "\n"; $errmsgs = array(); foreach($GLOBALS['SEEDDMS_SCHEDULER']['tasks'] as $extname=>$tasks) { foreach($tasks as $taskname=>$task) { echo ""; echo ""; echo $extname."::".$taskname; echo ""; echo ""; echo $task->getDescription(); echo ""; echo ""; $params = $task->getAdditionalParams(); $k = array(); foreach($params as $param) $k[] = $param['name']; echo implode(', ', $k); echo ""; echo ""; print "
"; $t = $scheduler->getTasksByExtension($extname, $taskname); if($t) { print ""; } print ""; print "
"; echo ""; echo ""; } } echo "\n"; } ?>
contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>