Commit 752f0839a415dcba2f132eb4c3b6ffb2cae86342

Authored by bshuttle
1 parent 4f93303e

workflow disabling.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4750 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/admin/workflows.php
... ... @@ -438,6 +438,35 @@ class KTWorkflowDispatcher extends KTAdminDispatcher {
438 438 }
439 439 // }}}
440 440  
  441 +
  442 +
  443 + // {{{ do_disableWorkflow
  444 + function do_disableWorkflow() {
  445 + $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']);
  446 +
  447 + $this->startTransaction();
  448 +
  449 + $oWorkflow->setStartStateId(null);
  450 + $res = $oWorkflow->update();
  451 +
  452 + $this->oValidator->notErrorFalse($res, array(
  453 + 'redirect_to' => array('main'),
  454 + 'message' => _('Error saving workflow'),
  455 + ));
  456 +
  457 + $this->commitTransaction();
  458 +
  459 + $this->successRedirectToMain(_('Changes saved'));
  460 + exit(0);
  461 + }
  462 + // }}}
  463 +
  464 +
  465 +
  466 +
  467 +
  468 +
  469 +
441 470 function do_manageActions() {
442 471 $oTemplate =& $this->oValidator->validateTemplate('ktcore/workflow/manageActions');
443 472 $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']);
... ...
templates/ktcore/workflow/listWorkflows.smarty
... ... @@ -25,12 +25,37 @@ lifecycle of the document.{/i18n}</p>
25 25  
26 26 {if $aWorkflow}
27 27 <h3>{i18n}Existing workflows{/i18n}</h3>
28   -<p class="descriptiveText">{i18n}Select a workflow to modify.{/i18n}</p>
29   -<ul>
  28 +<p class="descriptiveText">{i18n}Select a workflow to modify. To enable a disabled workflow, edit it and set a proper starting state.{/i18n}</p>
  29 +
  30 +<table class="listing" style="width:auto">
  31 +
  32 + <thead>
  33 + <tr>
  34 + <th>Name</th>
  35 + <th>Status</th>
  36 + <th>Edit</th>
  37 + <th>&nbsp</th>
  38 + </tr>
  39 + </thead>
  40 +
  41 + <tbody>
  42 +
30 43 {foreach from=$aWorkflow item=oWorkflow}
31   - <li><a href="?action=editWorkflow&fWorkflowId={$oWorkflow->getId()}" title="Workflow: {$oWorkflow->getId()}">{$oWorkflow->getName()}</a></li>
  44 +{assign var="startId" value=$oWorkflow->getStartStateId()}
  45 +
  46 + <tr>
  47 + <td>{$oWorkflow->getName()}</td>
  48 + <td>{if $startId===NULL}Disabled{else}Enabled{/if}</td>
  49 + <td><a class="ktAction ktEdit" href="?action=editWorkflow&fWorkflowId={$oWorkflow->getId()}" title="Workflow: {$oWorkflow->getId()}">Edit</a></td>
  50 + <td>
  51 + {if $startId!==NULL}<a href="?action=disableWorkflow&fWorkflowId={$oWorkflow->getId()}" title="Workflow: {$oWorkflow->getId()}">Disable</a>
  52 + {else}&nbsp;{/if}
  53 + </td>
  54 + </tr>
32 55 {/foreach}
33   -</ul>
  56 + </tbody>
  57 +</table>
  58 +
34 59 {/if}
35 60  
36 61  
... ...