diff --git a/lib/plugins/plugin.inc.php b/lib/plugins/plugin.inc.php
index 55f4517..2517b4b 100644
--- a/lib/plugins/plugin.inc.php
+++ b/lib/plugins/plugin.inc.php
@@ -315,7 +315,7 @@ class KTPlugin {
*/
function registerPluginHelper($sNamespace, $sClassName, $path, $object, $view, $type) {
- $sql = "SELECT * FROM plugin_helper WHERE namespace = '{$sNamespace}' AND classtype = '{$type}'";
+ $sql = "SELECT id FROM plugin_helper WHERE namespace = '{$sNamespace}' AND classtype = '{$type}'";
$res = DBUtil::getOneResult($sql);
$aValues = array();
@@ -345,6 +345,13 @@ class KTPlugin {
return true;
}
+ function deRegisterPluginHelper($sNamespace, $sClass) {
+ $aWhere['namespace'] = $sNamespace;
+ $aWhere['classtype'] = $sClass;
+ $res = DBUtil::whereDelete('plugin_helper', $aWhere);
+ return $res;
+ }
+
function _fixFilename($sFilename) {
if (empty($sFilename)) {
$sFilename = $this->sFilename;
@@ -391,13 +398,17 @@ class KTPlugin {
*
*/
function load() {
+ // Include any required resources, javascript files, etc
+ $res = $this->run_setup();
+
+ if(!$res){
+ return false;
+ }
+
// Get actions, portlets, etc, create arrays as part of plugin
$query = "SELECT * FROM plugin_helper h WHERE plugin = '{$this->sNamespace}'";
$aPluginHelpers = DBUtil::getResultArray($query);
- // Include any required resources, javascript files, etc
- $this->run_setup();
-
if(!empty($aPluginHelpers)){
foreach ($aPluginHelpers as $plugin) {
$sName = $plugin['namespace'];
@@ -500,6 +511,7 @@ class KTPlugin {
}
}
}
+ return true;
}
/**
@@ -636,7 +648,7 @@ class KTPlugin {
}
function run_setup() {
- return;
+ return true;
}
function stripKtDir($sFilename) {
diff --git a/plugins/ktstandard/workflow/FolderAssociator.php b/plugins/ktstandard/workflow/FolderAssociator.php
index bd82a06..639401e 100644
--- a/plugins/ktstandard/workflow/FolderAssociator.php
+++ b/plugins/ktstandard/workflow/FolderAssociator.php
@@ -5,32 +5,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*
*/
@@ -54,7 +54,14 @@ class KTFolderWorkflowAssociationPlugin extends KTPlugin {
function setup() {
$this->registerTrigger('workflow', 'objectModification', 'FolderWorkflowAssociator',
'ktstandard.triggers.workflowassociation.folder.handler');
+ }
+ /**
+ * Method to setup the plugin on rendering it
+ *
+ * @return unknown
+ */
+ function run_setup() {
$sQuery = 'SELECT selection_ns FROM ' . KTUtil::getTableName('trigger_selection');
$sQuery .= ' WHERE event_ns = ?';
$aParams = array('ktstandard.workflowassociation.handler');
@@ -63,8 +70,11 @@ class KTFolderWorkflowAssociationPlugin extends KTPlugin {
if ($res == 'ktstandard.triggers.workflowassociation.folder.handler') {
$this->registerAction('folderaction', 'FolderWorkflowAssignmentFolderAction',
'ktstandard.workflowassociation.folder.action');
- }
+ }else{
+ $this->deRegisterPluginHelper('ktstandard.workflowassociation.folder.action', 'action');
}
+ return true;
+ }
}
class FolderWorkflowAssociator extends KTWorkflowAssociationHandler {
diff --git a/plugins/ktstandard/workflow/TypeAssociator.php b/plugins/ktstandard/workflow/TypeAssociator.php
index f0964b6..fcf33a0 100644
--- a/plugins/ktstandard/workflow/TypeAssociator.php
+++ b/plugins/ktstandard/workflow/TypeAssociator.php
@@ -5,32 +5,32 @@
* KnowledgeTree Open Source Edition
* Document Management Made Simple
* Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited
- *
+ *
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License version 3 as published by the
* Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
- *
+ *
* You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,
* Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com.
- *
+ *
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU General Public License version 3.
- *
+ *
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
- * KnowledgeTree" logo and retain the original copyright notice. If the display of the
+ * KnowledgeTree" logo and retain the original copyright notice. If the display of the
* logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
- * must display the words "Powered by KnowledgeTree" and retain the original
- * copyright notice.
+ * must display the words "Powered by KnowledgeTree" and retain the original
+ * copyright notice.
* Contributor( s): ______________________________________
*
*/
@@ -50,19 +50,28 @@ class KTDocTypeWorkflowAssociationPlugin extends KTPlugin {
function setup() {
$this->registerTrigger('workflow', 'objectModification', 'DocumentTypeWorkflowAssociator',
'ktstandard.triggers.workflowassociation.documenttype.handler');
+ $this->registeri18n('knowledgeTree', KT_DIR . '/i18n');
+ }
+ /**
+ * Method to setup the plugin on rendering it
+ *
+ * @return unknown
+ */
+ function run_setup() {
$sQuery = 'SELECT selection_ns FROM ' . KTUtil::getTableName('trigger_selection');
- $sQuery .= ' WHERE event_ns = ?';
- $aParams = array('ktstandard.workflowassociation.handler');
- $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'selection_ns');
+ $sQuery .= ' WHERE event_ns = ?';
+ $aParams = array('ktstandard.workflowassociation.handler');
+ $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'selection_ns');
if ($res == 'ktstandard.triggers.workflowassociation.documenttype.handler') {
$this->registerAdminPage('workflow_type_allocation', 'WorkflowTypeAllocationDispatcher',
'documents', _kt('Workflow Allocation by Document Types'),
_kt('This installation assigns workflows by Document Type. Configure this process here.'), __FILE__);
- $this->registeri18n('knowledgeTree', KT_DIR . '/i18n');
+ }else{
+ $this->deRegisterPluginHelper('documents/workflow_type_allocation', 'admin_page');
}
-
+ return true;
}
}
@@ -107,6 +116,15 @@ class WorkflowTypeAllocationDispatcher extends KTAdminDispatcher {
$res = parent::check();
if (!$res) { return false; }
+ $sQuery = 'SELECT selection_ns FROM ' . KTUtil::getTableName('trigger_selection');
+ $sQuery .= ' WHERE event_ns = ?';
+ $aParams = array('ktstandard.workflowassociation.handler');
+ $res = DBUtil::getOneResultKey(array($sQuery, $aParams), 'selection_ns');
+
+ if ($res != 'ktstandard.triggers.workflowassociation.documenttype.handler') {
+ return false;
+ }
+
$this->aBreadcrumbs[] = array('url' => $_SERVER['PHP_SELF'], 'name'=> _kt('Workflow Allocation by Document Types'));
return true;