Commit f30498f9ab63e2564eae787548bc1386d3dae257
1 parent
680628a5
KTC-261
"The automatic workflow assignment by Document Type or by Folder does not work." Fixed. Moved the check for which type was assigned into the run_setup() function. Added a deregister plugin helper function. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7818 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
69 additions
and
29 deletions
lib/plugins/plugin.inc.php
| ... | ... | @@ -315,7 +315,7 @@ class KTPlugin { |
| 315 | 315 | */ |
| 316 | 316 | function registerPluginHelper($sNamespace, $sClassName, $path, $object, $view, $type) { |
| 317 | 317 | |
| 318 | - $sql = "SELECT * FROM plugin_helper WHERE namespace = '{$sNamespace}' AND classtype = '{$type}'"; | |
| 318 | + $sql = "SELECT id FROM plugin_helper WHERE namespace = '{$sNamespace}' AND classtype = '{$type}'"; | |
| 319 | 319 | $res = DBUtil::getOneResult($sql); |
| 320 | 320 | |
| 321 | 321 | $aValues = array(); |
| ... | ... | @@ -345,6 +345,13 @@ class KTPlugin { |
| 345 | 345 | return true; |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | + function deRegisterPluginHelper($sNamespace, $sClass) { | |
| 349 | + $aWhere['namespace'] = $sNamespace; | |
| 350 | + $aWhere['classtype'] = $sClass; | |
| 351 | + $res = DBUtil::whereDelete('plugin_helper', $aWhere); | |
| 352 | + return $res; | |
| 353 | + } | |
| 354 | + | |
| 348 | 355 | function _fixFilename($sFilename) { |
| 349 | 356 | if (empty($sFilename)) { |
| 350 | 357 | $sFilename = $this->sFilename; |
| ... | ... | @@ -391,13 +398,17 @@ class KTPlugin { |
| 391 | 398 | * |
| 392 | 399 | */ |
| 393 | 400 | function load() { |
| 401 | + // Include any required resources, javascript files, etc | |
| 402 | + $res = $this->run_setup(); | |
| 403 | + | |
| 404 | + if(!$res){ | |
| 405 | + return false; | |
| 406 | + } | |
| 407 | + | |
| 394 | 408 | // Get actions, portlets, etc, create arrays as part of plugin |
| 395 | 409 | $query = "SELECT * FROM plugin_helper h WHERE plugin = '{$this->sNamespace}'"; |
| 396 | 410 | $aPluginHelpers = DBUtil::getResultArray($query); |
| 397 | 411 | |
| 398 | - // Include any required resources, javascript files, etc | |
| 399 | - $this->run_setup(); | |
| 400 | - | |
| 401 | 412 | if(!empty($aPluginHelpers)){ |
| 402 | 413 | foreach ($aPluginHelpers as $plugin) { |
| 403 | 414 | $sName = $plugin['namespace']; |
| ... | ... | @@ -500,6 +511,7 @@ class KTPlugin { |
| 500 | 511 | } |
| 501 | 512 | } |
| 502 | 513 | } |
| 514 | + return true; | |
| 503 | 515 | } |
| 504 | 516 | |
| 505 | 517 | /** |
| ... | ... | @@ -636,7 +648,7 @@ class KTPlugin { |
| 636 | 648 | } |
| 637 | 649 | |
| 638 | 650 | function run_setup() { |
| 639 | - return; | |
| 651 | + return true; | |
| 640 | 652 | } |
| 641 | 653 | |
| 642 | 654 | function stripKtDir($sFilename) { | ... | ... |
plugins/ktstandard/workflow/FolderAssociator.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | * |
| 36 | 36 | */ |
| ... | ... | @@ -54,7 +54,14 @@ class KTFolderWorkflowAssociationPlugin extends KTPlugin { |
| 54 | 54 | function setup() { |
| 55 | 55 | $this->registerTrigger('workflow', 'objectModification', 'FolderWorkflowAssociator', |
| 56 | 56 | 'ktstandard.triggers.workflowassociation.folder.handler'); |
| 57 | + } | |
| 57 | 58 | |
| 59 | + /** | |
| 60 | + * Method to setup the plugin on rendering it | |
| 61 | + * | |
| 62 | + * @return unknown | |
| 63 | + */ | |
| 64 | + function run_setup() { | |
| 58 | 65 | $sQuery = 'SELECT selection_ns FROM ' . KTUtil::getTableName('trigger_selection'); |
| 59 | 66 | $sQuery .= ' WHERE event_ns = ?'; |
| 60 | 67 | $aParams = array('ktstandard.workflowassociation.handler'); |
| ... | ... | @@ -63,8 +70,11 @@ class KTFolderWorkflowAssociationPlugin extends KTPlugin { |
| 63 | 70 | if ($res == 'ktstandard.triggers.workflowassociation.folder.handler') { |
| 64 | 71 | $this->registerAction('folderaction', 'FolderWorkflowAssignmentFolderAction', |
| 65 | 72 | 'ktstandard.workflowassociation.folder.action'); |
| 66 | - } | |
| 73 | + }else{ | |
| 74 | + $this->deRegisterPluginHelper('ktstandard.workflowassociation.folder.action', 'action'); | |
| 67 | 75 | } |
| 76 | + return true; | |
| 77 | + } | |
| 68 | 78 | } |
| 69 | 79 | |
| 70 | 80 | class FolderWorkflowAssociator extends KTWorkflowAssociationHandler { | ... | ... |
plugins/ktstandard/workflow/TypeAssociator.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 29 | * these Appropriate Legal Notices must retain the display of the "Powered by |
| 30 | - * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 31 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices |
| 32 | - * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | - * copyright notice. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | * |
| 36 | 36 | */ |
| ... | ... | @@ -50,19 +50,28 @@ class KTDocTypeWorkflowAssociationPlugin extends KTPlugin { |
| 50 | 50 | function setup() { |
| 51 | 51 | $this->registerTrigger('workflow', 'objectModification', 'DocumentTypeWorkflowAssociator', |
| 52 | 52 | 'ktstandard.triggers.workflowassociation.documenttype.handler'); |
| 53 | + $this->registeri18n('knowledgeTree', KT_DIR . '/i18n'); | |
| 54 | + } | |
| 53 | 55 | |
| 56 | + /** | |
| 57 | + * Method to setup the plugin on rendering it | |
| 58 | + * | |
| 59 | + * @return unknown | |
| 60 | + */ | |
| 61 | + function run_setup() { | |
| 54 | 62 | $sQuery = 'SELECT selection_ns FROM ' . KTUtil::getTableName('trigger_selection'); |
| 55 | - $sQuery .= ' WHERE event_ns = ?'; | |
| 56 | - $aParams = array('ktstandard.workflowassociation.handler'); | |
| 57 | - $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'selection_ns'); | |
| 63 | + $sQuery .= ' WHERE event_ns = ?'; | |
| 64 | + $aParams = array('ktstandard.workflowassociation.handler'); | |
| 65 | + $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'selection_ns'); | |
| 58 | 66 | |
| 59 | 67 | if ($res == 'ktstandard.triggers.workflowassociation.documenttype.handler') { |
| 60 | 68 | $this->registerAdminPage('workflow_type_allocation', 'WorkflowTypeAllocationDispatcher', |
| 61 | 69 | 'documents', _kt('Workflow Allocation by Document Types'), |
| 62 | 70 | _kt('This installation assigns workflows by Document Type. Configure this process here.'), __FILE__); |
| 63 | - $this->registeri18n('knowledgeTree', KT_DIR . '/i18n'); | |
| 71 | + }else{ | |
| 72 | + $this->deRegisterPluginHelper('documents/workflow_type_allocation', 'admin_page'); | |
| 64 | 73 | } |
| 65 | - | |
| 74 | + return true; | |
| 66 | 75 | } |
| 67 | 76 | } |
| 68 | 77 | |
| ... | ... | @@ -107,6 +116,15 @@ class WorkflowTypeAllocationDispatcher extends KTAdminDispatcher { |
| 107 | 116 | $res = parent::check(); |
| 108 | 117 | if (!$res) { return false; } |
| 109 | 118 | |
| 119 | + $sQuery = 'SELECT selection_ns FROM ' . KTUtil::getTableName('trigger_selection'); | |
| 120 | + $sQuery .= ' WHERE event_ns = ?'; | |
| 121 | + $aParams = array('ktstandard.workflowassociation.handler'); | |
| 122 | + $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'selection_ns'); | |
| 123 | + | |
| 124 | + if ($res != 'ktstandard.triggers.workflowassociation.documenttype.handler') { | |
| 125 | + return false; | |
| 126 | + } | |
| 127 | + | |
| 110 | 128 | $this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name'=> _kt('Workflow Allocation by Document Types')); |
| 111 | 129 | |
| 112 | 130 | return true; | ... | ... |