* @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ /** * Include parent class */ //require_once("class.Bootstrap.php"); /** * Class which outputs the html page for WorkspaceMgr view * * @category DMS * @package SeedDMS * @author Markus Westphal, Malcolm Cowe, Uwe Steinmann * @copyright Copyright (C) 2002-2005 Markus Westphal, * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, * 2010-2012 Uwe Steinmann * @version Release: @package_version@ */ class SeedDMS_View_WorkflowMgr extends SeedDMS_Theme_Style { function js() { /* {{{ */ header('Content-Type: application/javascript; charset=UTF-8'); parent::jsTranslations(array('js_form_error', 'js_form_errors')); ?> function runValidation() { $("#form1").validate({ rules: { name: { required: true }, initstate: { required: true }, }, messages: { name: "", } }); } function checkForm(num) { msg = new Array(); eval("var formObj = document.form" + num + ";"); if (formObj.name.value == "") msg.push(""); if (msg != "") { noty({ text: msg.join('
'), type: 'error', dismissQueue: true, layout: 'topRight', theme: 'defaultTheme', _timeout: 1500, }); return false; } else return true; } $(document).ready(function() { $('body').on('submit', '#form1', function(ev){ if(checkForm()) return; ev.preventDefault(); }); $( "#selector" ).change(function() { $('div.ajax').trigger('update', {workflowid: $(this).val()}); }); }); params['dms']; $user = $this->params['user']; $selworkflow = $this->params['selworkflow']; if($selworkflow && $selworkflow->getTransitions()) { ?>
params['dms']; $user = $this->params['user']; $selworkflow = $this->params['selworkflow']; $workflows = $this->params['allworkflows']; $workflowstates = $this->params['allworkflowstates']; if($selworkflow && !$selworkflow->isUsed()) { $button = array( 'label'=>getMLText('action'), 'menuitems'=>array( ) ); if(!$selworkflow->isUsed()) { $button['menuitems'][] = array('label'=>' '.getMLText("rm_workflow"), 'link'=>'../out/out.RemoveWorkflow.php?workflowid='.$selworkflow->getID()); } self::showButtonwithMenu($button); } } /* }}} */ function showWorkflowForm($workflow) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $workflows = $this->params['allworkflows']; $workflowstates = $this->params['allworkflowstates']; if($workflow) { $path = $workflow->checkForCycles(); if($path) { $names = array(); foreach($path as $state) { $names[] = htmlspecialchars($state->getName()); } $this->errorMsg(getMLText('workflow_has_cycle').": ".implode(' ', $names)); } $transitions = $workflow->getTransitions(); $initstate = $workflow->getInitState(); $hasinitstate = true; $hasreleased = true; $hasrejected = true; $missesug = false; if($transitions) { $hasinitstate = false; $hasreleased = false; $hasrejected = false; foreach($transitions as $transition) { $transusers = $transition->getUsers(); $transgroups = $transition->getGroups(); if(!$transusers && !$transgroups) { $missesug = true; } if($transition->getNextState()->getDocumentStatus() == S_RELEASED) $hasreleased = true; if($transition->getNextState()->getDocumentStatus() == S_REJECTED) $hasrejected = true; if($transition->getState()->getID() == $initstate->getID()) $hasinitstate = true; } } if($missesug) $this->errorMsg(getMLText('workflow_transition_without_user_group')); if(!$hasinitstate) $this->errorMsg(getMLText('workflow_no_initial_state')); if(!$hasreleased) $this->errorMsg(getMLText('workflow_no_doc_released_state')); if(!$hasrejected) $this->errorMsg(getMLText('workflow_no_doc_rejected_state')); if($workflow->isUsed()) { $this->infoMsg(getMLText('workflow_in_use')); } } ?>
contentContainerStart(); $this->formField( getMLText("workflow_name"), array( 'element'=>'input', 'type'=>'text', 'id'=>'name', 'name'=>'name', 'value'=>($workflow ? htmlspecialchars($workflow->getName()) : '') ) ); $options = array(); foreach($workflowstates as $workflowstate) { $options[] = array($workflowstate->getID(), htmlspecialchars($workflowstate->getName()), $workflow && $workflow->getInitState()->getID() == $workflowstate->getID()); } $this->formField( getMLText("workflow_initstate"), array( 'element'=>'select', 'name'=>'initstate', 'options'=>$options ) ); $this->contentContainerEnd(); $this->formSubmit(' '.getMLText("save")); ?>
getAllWorkflowActions(); if($actions) { $transitions = $workflow->getTransitions(); echo ""; echo ""; if($transitions) { foreach($transitions as $transition) { $state = $transition->getState(); $nextstate = $transition->getNextState(); $action = $transition->getAction(); $transusers = $transition->getUsers(); $transgroups = $transition->getGroups(); echo ""; echo ""; echo ""; echo "\n"; } } echo "
".getMLText('state_and_next_state')."".getMLText('action')."".getMLText('users_and_groups')."
".' '.htmlspecialchars($state->getName())."
"; $docstatus = $nextstate->getDocumentStatus(); echo ' '.htmlspecialchars($nextstate->getName()); if($docstatus == S_RELEASED || $docstatus == S_REJECTED) { echo "
".getOverallStatusText($docstatus); } echo "
".htmlspecialchars($action->getName()).""; foreach($transusers as $transuser) { $u = $transuser->getUser(); echo ' '.htmlspecialchars($u->getLogin()." - ".$u->getFullName()); echo "
"; } foreach($transgroups as $transgroup) { $g = $transgroup->getGroup(); echo ' '.getMLText('at_least_n_users_of_group', array("number_of_users" => $transgroup->getNumOfUsers(), "group" => htmlspecialchars($g->getName()))); echo "
"; } echo "
"; ?>
"; echo "
"; ?>
"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo ""; echo ""; echo ""; ?> "> "; echo "\n"; echo ""; ?>
params['selworkflow']; $this->showWorkflowForm($selworkflow); } /* }}} */ function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $selworkflow = $this->params['selworkflow']; $workflows = $this->params['allworkflows']; $workflowstates = $this->params['allworkflowstates']; $this->htmlAddHeader(''."\n", 'js'); $this->htmlAddHeader(''."\n", 'js'); $this->htmlStartPage(getMLText("admin_tools")); $this->globalNavigation(); $this->contentStart(); $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); $this->contentHeading(getMLText("workflow_management")); $this->rowStart(); $this->columnStart(5); ?>
getID(), htmlspecialchars($currWorkflow->getName()),$selworkflow && $currWorkflow->getID()==$selworkflow->getID()); } $this->formField( null, //getMLText("selection"), array( 'element'=>'select', 'id'=>'selector', 'class'=>'chzn-select', 'options'=>$options ) ); ?>
getID()."\"" : "") ?>>
getID()."\"" : "") ?>>
columnEnd(); $this->columnStart(7); ?>
getID()."\"" : "") ?>>
columnEnd(); $this->rowEnd(); $this->contentEnd(); $this->htmlEndPage(); } /* }}} */ } ?>