Commit 59c2cbbd96a2fa15c1be8f040e1dc84ab579abee

Authored by nbm
1 parent a47c54f4

Been moved into a document action.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4153 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/documentWorkflow.php deleted
1   -<?php
2   -
3   -require_once("../../../../config/dmsDefaults.php");
4   -
5   -require_once(KT_DIR . "/presentation/Html.inc");
6   -
7   -require_once(KT_LIB_DIR . "/templating/templating.inc.php");
8   -require_once(KT_LIB_DIR . "/foldermanagement/Folder.inc");
9   -
10   -$sectionName = "Manage Documents";
11   -require_once(KT_DIR . "/presentation/webpageTemplate.inc");
12   -
13   -require_once(KT_LIB_DIR . "/dispatcher.inc.php");
14   -require_once(KT_LIB_DIR . "/validation/dispatchervalidation.inc.php");
15   -
16   -require_once(KT_LIB_DIR . '/workflow/workflow.inc.php');
17   -require_once(KT_LIB_DIR . '/workflow/workflowutil.inc.php');
18   -
19   -class DocumentWorkflowDispatcher extends KTStandardDispatcher {
20   - var $bAutomaticTransaction = true;
21   -
22   - function do_main() {
23   - $oTemplate =& $this->oValidator->validateTemplate("ktcore/workflow/documentWorkflow");
24   - $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']);
25   -
26   - $oWorkflow = KTWorkflowUtil::getWorkflowForDocument($oDocument);
27   - $oWorkflowState = KTWorkflowUtil::getWorkflowStateForDocument($oDocument);
28   -
29   - $oUser =& User::get($_SESSION['userID']);
30   - $aTransitions = KTWorkflowUtil::getTransitionsForDocumentUser($oDocument, $oUser);
31   - $aWorkflows = KTWorkflow::getList();
32   -
33   - $aTemplateData = array(
34   - 'oDocument' => $oDocument,
35   - 'oWorkflow' => $oWorkflow,
36   - 'oState' => $oWorkflowState,
37   - 'aTransitions' => $aTransitions,
38   - 'aWorkflows' => $aWorkflows,
39   - );
40   - return $oTemplate->render($aTemplateData);
41   - }
42   -
43   - function do_startWorkflow() {
44   - $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']);
45   - $oWorkflow =& $this->oValidator->validateWorkflow($_REQUEST['fWorkflowId']);
46   - $res = KTWorkflowUtil::startWorkflowOnDocument($oWorkflow, $oDocument);
47   - $this->successRedirectToMain('Workflow started',
48   - array('fDocumentId' => $oDocument->getId()));
49   - exit(0);
50   - }
51   -
52   - function do_performTransition() {
53   - $oDocument =& $this->oValidator->validateDocument($_REQUEST['fDocumentId']);
54   - $oTransition =& $this->oValidator->validateWorkflowTransition($_REQUEST['fTransitionId']);
55   - $sComments =& $this->oValidator->notEmpty($_REQUEST['fComments']);
56   - $oUser =& User::get($_SESSION['userID']);
57   - $res = KTWorkflowUtil::performTransitionOnDocument($oTransition, $oDocument, $oUser, $sComments);
58   - $this->successRedirectToMain('Transition performed',
59   - array('fDocumentId' => $oDocument->getId()));
60   - }
61   -}
62   -
63   -$oDispatcher = new DocumentWorkflowDispatcher;
64   -$oDispatcher->dispatch();
65   -
66   -?>