From ca6f0303b2ab162f10289709baf53ee05aa83245 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 18 Mar 2016 15:33:18 +0100 Subject: [PATCH] put javascript into its own file and turn on content security policy --- views/bootstrap/class.ApproveDocument.php | 69 ++--- views/bootstrap/class.AttributeMgr.php | 4 +- views/bootstrap/class.Bootstrap.php | 4 +- views/bootstrap/class.ChangePassword.php | 10 +- views/bootstrap/class.EditComment.php | 40 +-- views/bootstrap/class.EditEvent.php | 41 +-- views/bootstrap/class.EditFolder.php | 41 +-- views/bootstrap/class.EditOnline.php | 47 ++-- views/bootstrap/class.GroupView.php | 17 +- views/bootstrap/class.MoveFolder.php | 12 +- .../bootstrap/class.OverrideContentStatus.php | 49 ++-- views/bootstrap/class.PasswordForgotten.php | 35 ++- views/bootstrap/class.RemoveWorkflow.php | 2 +- .../class.RemoveWorkflowFromDocument.php | 2 +- .../bootstrap/class.ReturnFromSubWorkflow.php | 44 ++-- views/bootstrap/class.ReviewDocument.php | 76 +++--- views/bootstrap/class.SearchForm.php | 48 ++-- views/bootstrap/class.SetWorkflow.php | 36 ++- views/bootstrap/class.Statistic.php | 2 +- views/bootstrap/class.TriggerWorkflow.php | 45 ++-- views/bootstrap/class.UserDefaultKeywords.php | 49 ++-- views/bootstrap/class.WorkflowActionsMgr.php | 205 +++++++-------- views/bootstrap/class.WorkflowGraph.php | 71 +++--- views/bootstrap/class.WorkflowMgr.php | 241 ++++++++---------- views/bootstrap/class.WorkflowStatesMgr.php | 227 ++++++++--------- 25 files changed, 758 insertions(+), 659 deletions(-) diff --git a/views/bootstrap/class.ApproveDocument.php b/views/bootstrap/class.ApproveDocument.php index b2264bb2d..e5327d691 100644 --- a/views/bootstrap/class.ApproveDocument.php +++ b/views/bootstrap/class.ApproveDocument.php @@ -31,29 +31,9 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_ApproveDocument extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $document = $this->params['document']; - - $latestContent = $document->getLatestContent(); - $approvals = $latestContent->getApprovalStatus(); - - foreach($approvals as $approval) { - if($approval['approveID'] == $_GET['approveid']) { - $approvalStatus = $approval; - break; - } - } - - $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); - $this->globalNavigation($folder); - $this->contentStart(); - $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); - $this->contentHeading(getMLText("add_approval")); + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkIndForm()) return; + event.preventDefault(); + }); + $('body').on('submit', '#form2', function(ev){ + if(checkGrpForm()) return; + event.preventDefault(); + }); +}); params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $document = $this->params['document']; + + $latestContent = $document->getLatestContent(); + $approvals = $latestContent->getApprovalStatus(); + + foreach($approvals as $approval) { + if($approval['approveID'] == $_GET['approveid']) { + $approvalStatus = $approval; + break; + } + } + + $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); + $this->globalNavigation($folder); + $this->contentStart(); + $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); + $this->contentHeading(getMLText("add_approval")); $this->contentContainerStart(); @@ -118,7 +129,7 @@ function checkGrpForm() print "
\n"; } ?> -
+ @@ -170,7 +181,7 @@ function checkGrpForm() } ?> - +
diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index e49026a8a..9451ab770 100644 --- a/views/bootstrap/class.AttributeMgr.php +++ b/views/bootstrap/class.AttributeMgr.php @@ -162,7 +162,7 @@ $(document).ready( function() { -
:
+
: @@ -315,6 +315,8 @@ $(document).ready( function() { + + contentEnd(); $this->htmlEndPage(); diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index af9bbddbd..7ee83a990 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -43,7 +43,7 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common { } /* }}} */ function htmlStartPage($title="", $bodyClass="") { /* {{{ */ - if(method_exists($this, 'js')) { + if(1 || method_exists($this, 'js')) { /* We still need unsafe-eval, because printDocumentChooserHtml and * printFolderChooserHtml will include a javascript file with ajax * which is evaled by jquery @@ -67,9 +67,9 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common { echo ''."\n"; echo ''."\n"; echo ''."\n"; + echo ''."\n"; if($this->extraheader['css']) echo $this->extraheader['css']; - echo ''."\n"; // echo ''."\n"; echo ''."\n"; diff --git a/views/bootstrap/class.ChangePassword.php b/views/bootstrap/class.ChangePassword.php index 55dcef687..cd094eee0 100644 --- a/views/bootstrap/class.ChangePassword.php +++ b/views/bootstrap/class.ChangePassword.php @@ -31,6 +31,13 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style { + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); +?> +document.form1.newpassword.focus(); +params['dms']; $referuri = $this->params['referuri']; @@ -43,7 +50,7 @@ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style { $this->pageNavigation(getMLText("change_password")); $this->contentContainerStart(); ?> - + "; @@ -80,7 +87,6 @@ class SeedDMS_View_ChangePassword extends SeedDMS_Bootstrap_Style {
contentContainerEnd(); ?> -

contentEnd(); diff --git a/views/bootstrap/class.EditComment.php b/views/bootstrap/class.EditComment.php index 71de6bee0..440c087ed 100644 --- a/views/bootstrap/class.EditComment.php +++ b/views/bootstrap/class.EditComment.php @@ -31,21 +31,10 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_EditComment extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $document = $this->params['document']; - $version = $this->params['version']; + function js() { /* {{{ */ $strictformcheck = $this->params['strictformcheck']; - - $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); - $this->globalNavigation($folder); - $this->contentStart(); - $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); - + header('Content-Type: application/javascript; charset=UTF-8'); ?> - - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); +}); params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $document = $this->params['document']; + $version = $this->params['version']; + $strictformcheck = $this->params['strictformcheck']; + + $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); + $this->globalNavigation($folder); + $this->contentStart(); + $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); + $this->contentHeading(getMLText("edit_comment")); $this->contentContainerStart(); ?> -
+ diff --git a/views/bootstrap/class.EditEvent.php b/views/bootstrap/class.EditEvent.php index b342a4535..9bec4cd97 100644 --- a/views/bootstrap/class.EditEvent.php +++ b/views/bootstrap/class.EditEvent.php @@ -31,21 +31,10 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_EditEvent extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $event = $this->params['event']; + function js() { /* {{{ */ $strictformcheck = $this->params['strictformcheck']; - - $this->htmlStartPage(getMLText("calendar")); - $this->globalNavigation(); - $this->contentStart(); - $this->pageNavigation(getMLText("calendar"), "calendar"); - - $this->contentHeading(getMLText("edit_event")); - $this->contentContainerStart(); + header('Content-Type: application/javascript; charset=UTF-8'); ?> - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); +}); + + function show() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $event = $this->params['event']; + $strictformcheck = $this->params['strictformcheck']; + + $this->htmlStartPage(getMLText("calendar")); + $this->globalNavigation(); + $this->contentStart(); + $this->pageNavigation(getMLText("calendar"), "calendar"); + + $this->contentHeading(getMLText("edit_event")); + $this->contentContainerStart(); +?> + + "> diff --git a/views/bootstrap/class.EditFolder.php b/views/bootstrap/class.EditFolder.php index 5a4b9d835..b9c70f2e3 100644 --- a/views/bootstrap/class.EditFolder.php +++ b/views/bootstrap/class.EditFolder.php @@ -31,22 +31,10 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_EditFolder extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $attrdefs = $this->params['attrdefs']; - $rootfolderid = $this->params['rootfolderid']; + function js() { /* {{{ */ $strictformcheck = $this->params['strictformcheck']; - $orderby = $this->params['orderby']; - - $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); - $this->globalNavigation($folder); - $this->contentStart(); - $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder); + header('Content-Type: application/javascript; charset=UTF-8'); ?> - - - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); +}); params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $attrdefs = $this->params['attrdefs']; + $rootfolderid = $this->params['rootfolderid']; + $strictformcheck = $this->params['strictformcheck']; + $orderby = $this->params['orderby']; + + $this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName())))); + $this->globalNavigation($folder); + $this->contentStart(); + $this->pageNavigation($this->getFolderPathHTML($folder, true), "view_folder", $folder); $this->contentHeading(getMLText("edit_folder_props")); $this->contentContainerStart(); ?> - + diff --git a/views/bootstrap/class.EditOnline.php b/views/bootstrap/class.EditOnline.php index 89bd59fc4..8c1c9e711 100644 --- a/views/bootstrap/class.EditOnline.php +++ b/views/bootstrap/class.EditOnline.php @@ -36,6 +36,32 @@ class SeedDMS_View_EditOnline extends SeedDMS_Bootstrap_Style { var $file_count; var $storage_size; + function js() { /* {{{ */ + $document = $this->params['document']; + header('Content-Type: application/javascript; charset=UTF-8'); +?> +$(document).ready(function() { + $('#markdown').markItUp(mySettings); + + $('#update').click(function(event) { + event.preventDefault(); + $.post("../op/op.EditOnline.php", $('#form1').serialize(), function(response) { + noty({ + text: response.message, + type: response.success === true ? 'success' : 'error', + dismissQueue: true, + layout: 'topRight', + theme: 'defaultTheme', + timeout: 1500, + }); + $('div.ajax').trigger('update', {documentid: getId() ?>}); + }, "json"); + return false; + }); +}); +params['dms']; $document = $this->params['document']; @@ -91,27 +117,6 @@ echo "
\n"; echo "
\n"; $this->contentHeading(getMLText("content")); ?> - diff --git a/views/bootstrap/class.PasswordForgotten.php b/views/bootstrap/class.PasswordForgotten.php index 9a6c2b2cb..49ea96bd9 100644 --- a/views/bootstrap/class.PasswordForgotten.php +++ b/views/bootstrap/class.PasswordForgotten.php @@ -31,6 +31,38 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style { + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); +?> +function checkForm() +{ + msg = new Array(); + if (document.form1.login.value == "") msg.push(""); + if (document.form1.email.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; + event.preventDefault(); + }); +}); +document.form1.email.focus(); +params['referrer']; @@ -41,7 +73,7 @@ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style { ?> contentContainerStart(); ?> - + "; @@ -64,7 +96,6 @@ class SeedDMS_View_PasswordForgotten extends SeedDMS_Bootstrap_Style {
contentContainerEnd(); ?> -

contentEnd(); diff --git a/views/bootstrap/class.RemoveWorkflow.php b/views/bootstrap/class.RemoveWorkflow.php index 9166ba3e6..8ffac1287 100644 --- a/views/bootstrap/class.RemoveWorkflow.php +++ b/views/bootstrap/class.RemoveWorkflow.php @@ -47,7 +47,7 @@ class SeedDMS_View_RemoveWorkflow extends SeedDMS_Bootstrap_Style {

-
+ - -
diff --git a/views/bootstrap/class.RemoveWorkflowFromDocument.php b/views/bootstrap/class.RemoveWorkflowFromDocument.php index f55111ca3..50b8474fb 100644 --- a/views/bootstrap/class.RemoveWorkflowFromDocument.php +++ b/views/bootstrap/class.RemoveWorkflowFromDocument.php @@ -69,7 +69,7 @@ class SeedDMS_View_RemoveWorkflowFromDocument extends SeedDMS_Bootstrap_Style {

- + "; echo ""; echo "\n"; + echo "
diff --git a/views/bootstrap/class.ReturnFromSubWorkflow.php b/views/bootstrap/class.ReturnFromSubWorkflow.php index b72ec811f..b62c93d17 100644 --- a/views/bootstrap/class.ReturnFromSubWorkflow.php +++ b/views/bootstrap/class.ReturnFromSubWorkflow.php @@ -31,22 +31,9 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_ReturnFromSubWorkflow extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $document = $this->params['document']; - $transition = $this->params['transition']; - - $latestContent = $document->getLatestContent(); - - $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); - $this->globalNavigation($folder); - $this->contentStart(); - $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); - $this->contentHeading(getMLText("return_from_subworkflow")); + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); +}); params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $document = $this->params['document']; + $transition = $this->params['transition']; + + $latestContent = $document->getLatestContent(); + + $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); + $this->globalNavigation($folder); + $this->contentStart(); + $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); + $this->contentHeading(getMLText("return_from_subworkflow")); $currentstate = $latestContent->getWorkflowState(); $wkflog = $latestContent->getWorkflowLog(); @@ -93,7 +100,7 @@ function checkForm() ?>
- + @@ -140,4 +147,3 @@ function checkForm() } /* }}} */ } ?> - diff --git a/views/bootstrap/class.ReviewDocument.php b/views/bootstrap/class.ReviewDocument.php index 3f442afa7..501c3180e 100644 --- a/views/bootstrap/class.ReviewDocument.php +++ b/views/bootstrap/class.ReviewDocument.php @@ -31,28 +31,9 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_ReviewDocument extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $document = $this->params['document']; - $content = $this->params['version']; - - $reviews = $content->getReviewStatus(); - foreach($reviews as $review) { - if($review['reviewID'] == $_GET['reviewid']) { - $reviewStatus = $review; - break; - } - } - - $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); - $this->globalNavigation($folder); - $this->contentStart(); - $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); - $this->contentHeading(getMLText("submit_review")); + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkIndForm()) return; + event.preventDefault(); + }); + $('body').on('submit', '#form2', function(ev){ + if(checkGrpForm()) return; + event.preventDefault(); + }); +}); params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $document = $this->params['document']; + $content = $this->params['version']; + + $reviews = $content->getReviewStatus(); + foreach($reviews as $review) { + if($review['reviewID'] == $_GET['reviewid']) { + $reviewStatus = $review; + break; + } + } + + $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); + $this->globalNavigation($folder); + $this->contentStart(); + $this->pageNavigation($this->getFolderPathHTML($folder, true, $document), "view_document", $document); + $this->contentHeading(getMLText("submit_review")); $this->contentContainerStart(); // Display the Review form. @@ -109,7 +127,7 @@ function checkGrpForm() print "
:

"; } ?> - + @@ -167,7 +185,7 @@ function checkGrpForm() } ?> - +
diff --git a/views/bootstrap/class.SearchForm.php b/views/bootstrap/class.SearchForm.php index 8162d5b03..cc5c91f91 100644 --- a/views/bootstrap/class.SearchForm.php +++ b/views/bootstrap/class.SearchForm.php @@ -31,22 +31,9 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_SearchForm extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $folder = $this->params['folder']; - $attrdefs = $this->params['attrdefs']; - $allCats = $this->params['allcategories']; - $allUsers = $this->params['allusers']; - $enablefullsearch = $this->params['enablefullsearch']; - $workflowmode = $this->params['workflowmode']; - - $this->htmlStartPage(getMLText("search")); - $this->globalNavigation($folder); - $this->contentStart(); - $this->pageNavigation(getMLText("search"), ""); + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - + +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); +}); +printFolderChooserJs("form1"); + } /* }}} */ + + function show() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $folder = $this->params['folder']; + $attrdefs = $this->params['attrdefs']; + $allCats = $this->params['allcategories']; + $allUsers = $this->params['allusers']; + $enablefullsearch = $this->params['enablefullsearch']; + $workflowmode = $this->params['workflowmode']; + + $this->htmlStartPage(getMLText("search")); + $this->globalNavigation($folder); + $this->contentStart(); + $this->pageNavigation(getMLText("search"), ""); +?>
@@ -160,7 +172,7 @@ function checkForm() - + diff --git a/views/bootstrap/class.SetWorkflow.php b/views/bootstrap/class.SetWorkflow.php index f92a62afa..3569f80ba 100644 --- a/views/bootstrap/class.SetWorkflow.php +++ b/views/bootstrap/class.SetWorkflow.php @@ -31,6 +31,28 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_SetWorkflow extends SeedDMS_Bootstrap_Style { + function js() { /* {{{ */ + $document = $this->params['document']; + header('Content-Type: application/javascript; charset=UTF-8'); +?> +function showWorkflow(selectObj) { + id = selectObj.options[selectObj.selectedIndex].value; + if (id > 0) { + $('#workflowgraph').show(); + $('#workflowgraph iframe').attr('src', 'out.WorkflowGraph.php?documentid=getID(); ?>&workflow='+id); + } else { + $('#workflowgraph').hide(); + } + +} +$(document).ready( function() { + $( "#selector" ).change(function() { + showWorkflow(this); + }); +}); +params['dms']; $user = $this->params['user']; @@ -48,18 +70,6 @@ class SeedDMS_View_SetWorkflow extends SeedDMS_Bootstrap_Style { $this->contentContainerStart(); // Display the Workflow form. ?> -
- -
:
:printFolderChooser("form1", M_READ, -1, $folder);?>printFolderChooserHtml("form1", M_READ, -1, $folder);?>
: "; + echo " diff --git a/views/bootstrap/class.UserDefaultKeywords.php b/views/bootstrap/class.UserDefaultKeywords.php index d69dd5dd3..95a8a7a6a 100644 --- a/views/bootstrap/class.UserDefaultKeywords.php +++ b/views/bootstrap/class.UserDefaultKeywords.php @@ -31,17 +31,9 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_UserDefaultKeywords extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $categories = $this->params['categories']; - - $this->htmlStartPage(getMLText("edit_default_keywords")); - $this->globalNavigation(); - $this->contentStart(); - $this->pageNavigation(getMLText("my_account"), "my_account"); + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - + +sel = document.getElementById("selector"); +sel.selectedIndex=0; //; +showKeywords(sel); + +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); + $( "#selector" ).change(function() { + showKeywords(this); +// $('div.ajax').trigger('update', {userid: $(this).val()}); + }); +}); params['dms']; + $user = $this->params['user']; + $categories = $this->params['categories']; + + $this->htmlStartPage(getMLText("edit_default_keywords")); + $this->globalNavigation(); + $this->contentStart(); + $this->pageNavigation(getMLText("my_account"), "my_account"); $this->contentHeading(getMLText("edit_default_keywords")); ?>
: -
- - contentEnd(); $this->htmlEndPage(); diff --git a/views/bootstrap/class.WorkflowActionsMgr.php b/views/bootstrap/class.WorkflowActionsMgr.php index dd91b4e40..043442e44 100644 --- a/views/bootstrap/class.WorkflowActionsMgr.php +++ b/views/bootstrap/class.WorkflowActionsMgr.php @@ -31,27 +31,14 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_WorkflowActionsMgr extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $selworkflowaction = $this->params['selworkflowaction']; - - $workflowactions = $dms->getAllWorkflowActions(); - - $this->htmlStartPage(getMLText("admin_tools")); - $this->globalNavigation(); - $this->contentStart(); - $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); - + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - +$(document).ready( function() { + $('body').on('submit', '#form', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); + $( "#selector" ).change(function() { + $('div.ajax').trigger('update', {workflowactionid: $(this).val()}); + }); +}); contentHeading(getMLText("workflow_actions_management")); -?> + } /* }}} */ -
-
-
-: - -
-
+ function info() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + } /* }}} */ -
-
-
:
- - - -getID()."\" style=\"display : none;\">"; -?> -
- - - - - - - - - - - - - - - - + + + + + + + +
+ +
+ +
+
+
+ +
+ +
+
-
-isUsed()) { + function showWorkflowActionForm($action) { /* {{{ */ + if($action) { + if($action->isUsed()) { ?>

- +
-
:
-
-
+params['selworkflowaction']; + + $this->showWorkflowActionForm($selworkflowaction); + } /* }}} */ + + function show() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $selworkflowaction = $this->params['selworkflowaction']; + + $workflowactions = $dms->getAllWorkflowActions(); + + $this->htmlStartPage(getMLText("admin_tools")); + $this->globalNavigation(); + $this->contentStart(); + $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); + $this->contentHeading(getMLText("workflow_actions_management")); +?> + +
+
+
+: +
+
getID()."\"" : "") ?>>
- +
+
+
getID()."\"" : "") ?>>
+
+
+
contentEnd(); $this->htmlEndPage(); diff --git a/views/bootstrap/class.WorkflowGraph.php b/views/bootstrap/class.WorkflowGraph.php index d649840aa..52d50a058 100644 --- a/views/bootstrap/class.WorkflowGraph.php +++ b/views/bootstrap/class.WorkflowGraph.php @@ -31,6 +31,39 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style { + function js() { /* {{{ */ + $this->workflow = $this->params['workflow']; + header('Content-Type: application/javascript; charset=UTF-8'); +?> +$(document).ready(function() { + var width = $('#canvas').width(); + var height = $('#canvas').height();; + var ggg = new Graph(); + ggg.edgeFactory.template.style.directed = true; + + var render_action = function(r, n) { + /* the Raphael set is obligatory, containing all you want to display */ + var set = r.set().push( + /* custom objects go here */ + r.rect(n.point[0]-45, n.point[1]-13, 90, 44).attr({"fill": (n.color == undefined ? "#feb" : n.color), r : "12px", "stroke-width" : "1px" })).push( + r.text(n.point[0], n.point[1] + 10, (n.label || n.id) + "\n(" + (n.maxtime == undefined ? "Infinity" : n.maxtime) + ")")); + return set; + }; + +seentrans = array(); + $state = $this->workflow->getInitState(); + $this->states = array(); + $this->actions = array(); + $this->printGraph(); +?> + var layouter = new Graph.Layout.Spring(ggg); + var renderer = new Graph.Renderer.Raphael('canvas', ggg, width, height); +}); + +workflow->getTransitions(); if($transitions) { @@ -112,42 +145,20 @@ class SeedDMS_View_WorkflowGraph extends SeedDMS_Bootstrap_Style { ''."\n". ''."\n". ''."\n"); + $this->htmlAddHeader(' + +', 'css'); $this->htmlStartPage(getMLText("admin_tools")); // $this->contentContainerStart(); ?> -
- - +
contentContainerEnd(); + if(method_exists($this, 'js')) + echo ''."\n"; echo "\n\n"; } /* }}} */ } diff --git a/views/bootstrap/class.WorkflowMgr.php b/views/bootstrap/class.WorkflowMgr.php index 483910c70..05e77986e 100644 --- a/views/bootstrap/class.WorkflowMgr.php +++ b/views/bootstrap/class.WorkflowMgr.php @@ -31,20 +31,9 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_WorkflowMgr extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $selworkflow = $this->params['selworkflow']; - $workflows = $this->params['allworkflows']; - $workflowstates = $this->params['allworkflowstates']; - - $this->htmlStartPage(getMLText("admin_tools")); - $this->globalNavigation(); - $this->contentStart(); - $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); - + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); + $( "#selector" ).change(function() { + $('div.ajax').trigger('update', {workflowid: $(this).val()}); + }); +}); contentHeading(getMLText("workflow_management")); -?> + } /* }}} */ -
-
-
-: - -
-
- -
+ function info() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $selworkflow = $this->params['selworkflow']; + if($selworkflow) { ?> +
+
+ -
- - - + function showWorkflowForm($workflow) { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $workflows = $this->params['allworkflows']; + $workflowstates = $this->params['allworkflowstates']; -getID()."\" style=\"display : none;\">"; - $transitions = $currWorkflow->getTransitions(); - $initstate = $currWorkflow->getInitState(); + if($workflow) { + $transitions = $workflow->getTransitions(); + $initstate = $workflow->getInitState(); $hasinitstate = true; $missesug = false; if($transitions) { @@ -184,31 +107,37 @@ function showWorkflow(selectObj) { $this->errorMsg('One of the transitions has neither a user nor a group!'); if(!$hasinitstate) $this->errorMsg('None of the transitions starts with the initial state of the workflow!'); -?> - - - - -
- - - - + + + + + + + +
-isUsed()) { + + if($workflow->isUsed()) { ?>

- + -
- + @@ -216,7 +145,7 @@ function showWorkflow(selectObj) { getID()."\""; - if($currWorkflow->getInitState()->getID() == $workflowstate->getID()) + if($workflow && $workflow->getInitState()->getID() == $workflowstate->getID()) echo " selected=\"selected\""; echo ">".htmlspecialchars($workflowstate->getName())."\n"; } @@ -231,11 +160,12 @@ function showWorkflow(selectObj) {
:">
:
getAllWorkflowActions(); if($actions) { - $transitions = $currWorkflow->getTransitions(); - echo ""; - echo ""; + $transitions = $workflow->getTransitions(); + echo "
".getMLText('state_and_next_state')."".getMLText('action')."".getMLText('users_and_groups')."
"; + echo ""; if($transitions) { foreach($transitions as $transition) { $state = $transition->getState(); @@ -273,7 +203,7 @@ function showWorkflow(selectObj) { ?> - + @@ -282,9 +212,11 @@ function showWorkflow(selectObj) { echo "\n"; } } + echo "
".getMLText('state_and_next_state')."".getMLText('action')."".getMLText('users_and_groups')."
"; ?>
"; echo ""; ?> - + "> "; echo "
"; ?> "; + } + } + } /* }}} */ + + function form() { /* {{{ */ + $selworkflow = $this->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->htmlStartPage(getMLText("admin_tools")); + $this->globalNavigation(); + $this->contentStart(); + $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); + $this->contentHeading(getMLText("workflow_management")); +?> + +
+
+
+: +
-
+
+
getID()."\"" : "") ?>>
- +
+
+
getID()."\"" : "") ?>>
+
+
+ contentEnd(); diff --git a/views/bootstrap/class.WorkflowStatesMgr.php b/views/bootstrap/class.WorkflowStatesMgr.php index 6710ae082..89df42033 100644 --- a/views/bootstrap/class.WorkflowStatesMgr.php +++ b/views/bootstrap/class.WorkflowStatesMgr.php @@ -31,27 +31,15 @@ require_once("class.Bootstrap.php"); */ class SeedDMS_View_WorkflowStatesMgr extends SeedDMS_Bootstrap_Style { - function show() { /* {{{ */ - $dms = $this->params['dms']; - $user = $this->params['user']; - $selworkflowstate = $this->params['selworkflowstate']; - - $workflowstates = $dms->getAllWorkflowStates(); - - $this->htmlStartPage(getMLText("admin_tools")); - $this->globalNavigation(); - $this->contentStart(); - $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); - + function js() { /* {{{ */ + header('Content-Type: application/javascript; charset=UTF-8'); ?> - +$(document).ready(function() { + $('body').on('submit', '#form1', function(ev){ + if(checkForm()) return; + event.preventDefault(); + }); + $( "#selector" ).change(function() { + $('div.ajax').trigger('update', {workflowstateid: $(this).val()}); + }); +}); contentHeading(getMLText("workflow_states_management")); -?> + } /* }}} */ -
-
-
-: - -
-
+ function info() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + } /* }}} */ -
-
- - - - -getID()."\" style=\"display : none;\">"; -?> -
- - - - - - - + + + - - - - - - - - - - - - - + + + + + +
+ +
+ +
+
-
-isUsed()) { + function showWorkflowStateForm($state) { /* {{{ */ + if($state) { + if($state->isUsed()) { ?>

- +
-
:
: + +
+ +
+ +
+
+
+ +
+
- - - -
+params['selworkflowstate']; + + $this->showWorkflowStateForm($selworkflowstate); + } /* }}} */ + + function show() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $selworkflowstate = $this->params['selworkflowstate']; + + $workflowstates = $dms->getAllWorkflowStates(); + + $this->htmlStartPage(getMLText("admin_tools")); + $this->globalNavigation(); + $this->contentStart(); + $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); + $this->contentHeading(getMLText("workflow_states_management")); +?> + +
+
+
+: +
+
getID()."\"" : "") ?>>
- +
+
+
getID()."\"" : "") ?>>
+
+
+
contentEnd();