From 955477ae1e2814ba493bf96a0d9ff4dd81da2c5d Mon Sep 17 00:00:00 2001 From: megan_w Date: Tue, 20 Nov 2007 18:41:09 +0000 Subject: [PATCH] Merged in from DEV trunk... --- config/dmsDefaults.php | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------- lib/plugins/KTAdminNavigation.php | 30 +++++++++++++++--------------- lib/plugins/plugin.inc.php | 359 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------------------- lib/plugins/pluginregistry.inc.php | 16 +++++++++++++--- lib/plugins/pluginutil.inc.php | 271 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------- lib/templating/kt3template.inc.php | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------- lib/templating/templating.inc.php | 29 +++++++++++++++++++++++------ sql/mysql/install/structure.sql | 894 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8 files changed, 1166 insertions(+), 699 deletions(-) diff --git a/config/dmsDefaults.php b/config/dmsDefaults.php index 7ca0bfb..d4d8a22 100644 --- a/config/dmsDefaults.php +++ b/config/dmsDefaults.php @@ -8,7 +8,7 @@ * License Version 1.1.2 ("License"); You may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.knowledgetree.com/KPL - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and @@ -19,9 +19,9 @@ * (ii) the KnowledgeTree copyright notice * in the same form as they appear in the distribution. See the License for * requirements. - * + * * The Original Code is: KnowledgeTree Open Source - * + * * The Initial Developer of the Original Code is The Jam Warehouse Software * (Pty) Ltd, trading as KnowledgeTree. * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -52,7 +52,7 @@ unset($microtime_simple); if (!defined('KT_DIR')) { $rootLoc = realpath(dirname(__FILE__) . '/..'); if (substr(PHP_OS, 0, 3) == 'WIN') { - $rootLoc = str_replace('\\','/',$rootLoc); + $rootLoc = str_replace('\\','/',$rootLoc); } define('KT_DIR', $rootLoc); } @@ -85,7 +85,7 @@ class KTInit { global $default; require_once(KT_LIB_DIR . '/Log.inc'); $oKTConfig =& KTConfig::getSingleton(); - + if(!defined('APP_NAME')) { define('APP_NAME', $oKTConfig->get('ui/appName', 'KnowledgeTree')); } @@ -122,7 +122,7 @@ class KTInit { $default->phpErrorLog =& Log::factory('composite'); if ($default->phpErrorLogFile) { - $fileLog =& Log::factory('file', $oKTConfig->get('urls/logDirectory') . '/php_error_log', 'KT', array(), $logLevel); + $fileLog =& Log::factory('file', $oKTConfig->get('urls/logDirectory') . '/php_error_log', 'KT', array(), $logLevel); $default->phpErrorLog->addChild($fileLog); } @@ -195,9 +195,9 @@ class KTInit { // {{{ cleanGlobals() function cleanGlobals () { - /* + /* * Borrowed from TikiWiki - * + * * Copyright (c) 2002-2004, Luis Argerich, Garland Foster, * Eduardo Polidor, et. al. */ @@ -360,9 +360,9 @@ class KTInit { return ''; } // }}} - + // {{{ initConfig - function initConfig() { + function initConfig() { global $default; $use_cache = false; $store_cache = false; @@ -371,36 +371,36 @@ class KTInit { $user = KTLegacyLog::running_user(); // handle vhosts. $truehost = KTUtil::arrayGet($_SERVER, 'HTTP_HOST', 'default'); - $trueport = KTUtil::arrayGet($_SERVER, 'SERVER_PORT', '80'); + $trueport = KTUtil::arrayGet($_SERVER, 'SERVER_PORT', '80'); $cache_file = trim(file_get_contents(KT_DIR . '/config/cache-path')) . '/configcache' . $user . $truehost . $trueport; - if (!KTUtil::isAbsolutePath($cache_file)) { $cache_file = sprintf('%s/%s', KT_DIR, $cache_file); } - $config_file = trim(file_get_contents(KT_DIR . '/config/config-path')); + if (!KTUtil::isAbsolutePath($cache_file)) { $cache_file = sprintf('%s/%s', KT_DIR, $cache_file); } + $config_file = trim(file_get_contents(KT_DIR . '/config/config-path')); if (!KTUtil::isAbsolutePath($config_file)) { $config_file = sprintf('%s/%s', KT_DIR, $config_file); } - + $exists = file_exists($cache_file); if ($exists) { $cachestat = stat($cache_file); $configstat = stat($config_file); $tval = 9; - // print sprintf("is %d > %d\n", $cachestat[$tval], $configstat[$tval]); + // print sprintf("is %d > %d\n", $cachestat[$tval], $configstat[$tval]); if ($cachestat[$tval] > $configstat[$tval]) { $use_cache = true; } - } - - + } + + } - + if ($use_cache) { $oKTConfig =& KTConfig::getSingleton(); $oKTConfig->loadCache($cache_file); - + foreach ($oKTConfig->flat as $k => $v) { $default->$k = $oKTConfig->get($k); } } else { $oKTConfig =& KTConfig::getSingleton(); - + $oKTConfig->setdefaultns('ui', 'appName', 'KnowledgeTree'); $oKTConfig->setdefaultns('KnowledgeTree', 'fileSystemRoot', KT_DIR); $oKTConfig->setdefaultns('KnowledgeTree', 'serverName', KTUtil::arrayGet($_SERVER, 'HTTP_HOST', 'localhost')); @@ -416,55 +416,55 @@ class KTInit { $oKTConfig->setdefaultns('KnowledgeTree', 'pathInfoSupport', false); $oKTConfig->setdefaultns('dashboard', 'alwaysShowYCOD', true); - + $oKTConfig->setdefaultns('storage', 'manager', 'KTOnDiskHashedStorageManager'); $oKTConfig->setdefaultns('config', 'useDatabaseConfiguration', false); - $oKTConfig->setdefaultns('urls', 'tmpDirectory', '${varDirectory}/tmp'); + $oKTConfig->setdefaultns('urls', 'tmpDirectory', '${varDirectory}/tmp'); $oKTConfig->setdefaultns('urls', 'stopwordsFile', '${fileSystemRoot}/config/stopwords.txt'); - + $oKTConfig->setdefaultns('tweaks', 'browseToUnitFolder', false); $oKTConfig->setdefaultns('tweaks', 'genericMetaDataRequired', true); $oKTConfig->setdefaultns('tweaks', 'phpErrorLogFile', false); $oKTConfig->setdefaultns('tweaks', 'developmentWindowLog', false); - $oKTConfig->setdefaultns('tweaks', 'noisyBulkOperations', false); - + $oKTConfig->setdefaultns('tweaks', 'noisyBulkOperations', false); + $oKTConfig->setdefaultns('user_prefs', 'passwordLength', 6); $oKTConfig->setdefaultns('user_prefs', 'restrictAdminPasswords', false); - + $oKTConfig->setdefaultns('session', 'allowAnonymousLogin', false); - + $oKTConfig->setdefaultns('ui', 'ieGIF', true); $oKTConfig->setdefaultns('ui', 'alwaysShowAll', false); $oKTConfig->setdefaultns('ui', 'condensedAdminUI', false); - + $oKTConfig->setdefaultns(null, 'logLevel', 'INFO'); $oKTConfig->setdefaultns('import', 'unzip', 'unzip'); $oKTConfig->setdefaultns('cache', 'cacheDirectory', '${varDirectory}/cache'); $oKTConfig->setdefaultns('cache', 'cacheEnabled', 'false'); $oKTConfig->setdefaultns('cache', 'proxyCacheDirectory', '${varDirectory}/proxies'); $oKTConfig->setdefaultns('cache', 'proxyCacheEnabled', 'true'); - + $oKTConfig->setdefaultns('webservice', 'uploadDirectory', '${varDirectory}/uploads'); $oKTConfig->setdefaultns('webservice', 'downloadUrl', '${rootUrl}/ktwebservice/download.php'); $oKTConfig->setdefaultns('webservice', 'uploadExpiry', '30'); $oKTConfig->setdefaultns('webservice', 'downloadExpiry', '30'); $oKTConfig->setdefaultns('webservice', 'randomKeyText', 'bkdfjhg23yskjdhf2iu'); - + $oKTConfig->setdefaultns('clientToolPolicies', 'explorerMetadataCapture', true); $oKTConfig->setdefaultns('clientToolPolicies', 'officeMetadataCapture', true); - + $res = $this->readConfig(); if (PEAR::isError($res)) { return $res; } - + $oKTConfig =& KTConfig::getSingleton(); @touch($cache_file); if ($store_cache && is_writable($cache_file)) { $oKTConfig->createCache($cache_file); } - - + + } } // }}} @@ -479,13 +479,13 @@ class KTInit { } else { $res = $oKTConfig->loadFile(sprintf('%s/%s', KT_DIR, $sConfigFile)); } - - if (PEAR::isError($res)) { + + if (PEAR::isError($res)) { $this->handleInitError($res); // returns only in checkup return $res; - } - + } + foreach (array_keys($oKTConfig->flat) as $k) { $v = $oKTConfig->get($k); if ($v === 'default') { @@ -493,7 +493,7 @@ class KTInit { } if ($v === 'false') { $v = false; - + } if ($v === 'true') { $v = true; @@ -518,9 +518,9 @@ class KTInit { exit(0); } $res = $oKTConfig->loadFile($sConfigFile); - if (PEAR::isError($res)) { + if (PEAR::isError($res)) { return $res; - } + } $_SESSION['userID'] = 1; } // }}} @@ -545,11 +545,11 @@ require_once(KT_LIB_DIR . '/ktentity.inc'); require_once(KT_LIB_DIR . '/config/config.inc.php'); -$KTInit->initConfig(); +$KTInit->initConfig(); $KTInit->setupI18n(); if ($GLOBALS['kt_test']) { - $KTInit->initTesting(); + $KTInit->initTesting(); } $oKTConfig =& KTConfig::getSingleton(); @@ -586,7 +586,12 @@ require_once(KT_LIB_DIR . '/session/control.inc'); require_once(KT_LIB_DIR . '/plugins/pluginutil.inc.php'); if ($checkup !== true) { - KTPluginUtil::loadPlugins(); + /* ** Get the page being loaded and load the plugins specific to the page ** */ + $sScriptName = $GLOBALS['_SERVER']['SCRIPT_NAME']; + $sScript = basename($sScriptName); + $pos = strpos($sScript, '.'); + $sType = substr($sScript, 0, $pos); + KTPluginUtil::loadPlugins($sType); } if ($checkup !== true) { diff --git a/lib/plugins/KTAdminNavigation.php b/lib/plugins/KTAdminNavigation.php index 69c2060..95124a9 100644 --- a/lib/plugins/KTAdminNavigation.php +++ b/lib/plugins/KTAdminNavigation.php @@ -6,7 +6,7 @@ * License Version 1.1.2 ("License"); You may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.knowledgetree.com/KPL - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and @@ -17,9 +17,9 @@ * (ii) the KnowledgeTree copyright notice * in the same form as they appear in the distribution. See the License for * requirements. - * + * * The Original Code is: KnowledgeTree Open Source - * + * * The Initial Developer of the Original Code is The Jam Warehouse Software * (Pty) Ltd, trading as KnowledgeTree. * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -52,18 +52,18 @@ class KTAdminNavigationRegistry { "name" => $sName, "class" => $sClass, "title" => $sTitle, - "description"=> $sDescription, - "filepath" => $sDispatcherFilePath, + "description"=> $sDescription, + "filepath" => $sDispatcherFilePath, "url" => $sURL, - "fullname" => $sFullname); + "fullname" => $sFullname); $this->aResources[$sFullname] = $aInfo; // is this a toplevel item? if ($sCategory != null) { - if (!array_key_exists($sCategory, $this->aCategories)) { - $this->registerCategory($sCategory, $sCategory, ''); + if (!array_key_exists($sCategory, $this->aCategories)) { + $this->registerCategory($sCategory, $sCategory, ''); } $this->aCategorisation[$sCategory][] = $aInfo; - } + } } function isRegistered($sName) { @@ -72,32 +72,32 @@ class KTAdminNavigationRegistry { } return false; } - + function registerCategory($sName, $sTitle, $sDescription) { $this->aCategories[$sName] = array("title" => $sTitle, "description" => $sDescription, "name" => $sName); } function getCategories() { return $this->aCategories; } function getCategory($sCategory) { return $this->aCategories[$sCategory]; } function getItemsForCategory($sCategory) { return $this->aCategorisation[$sCategory]; } - + function getDispatcher($sName) { // FIXME this probably needs to use require_once mojo. $aInfo = $this->aResources[$sName]; if ($aInfo["filepath"] !== null) { require_once($aInfo["filepath"]); } - if ($aInfo["url"] !== null) { + if (!empty($aInfo["url"])) { return new RedirectingDispatcher($aInfo["url"]); } - return new $aInfo["class"]; + return new $aInfo["class"]; } } class RedirectingDispatcher { var $url = ''; - + function RedirectingDispatcher($sURL) { $this->url = $sURL; } - + function dispatch() { redirect($this->url); } diff --git a/lib/plugins/plugin.inc.php b/lib/plugins/plugin.inc.php index a08a85c..552596c 100644 --- a/lib/plugins/plugin.inc.php +++ b/lib/plugins/plugin.inc.php @@ -6,7 +6,7 @@ * License Version 1.1.2 ("License"); You may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.knowledgetree.com/KPL - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and @@ -17,9 +17,9 @@ * (ii) the KnowledgeTree copyright notice * in the same form as they appear in the distribution. See the License for * requirements. - * + * * The Original Code is: KnowledgeTree Open Source - * + * * The Initial Developer of the Original Code is The Jam Warehouse Software * (Pty) Ltd, trading as KnowledgeTree. * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -39,9 +39,9 @@ class KTPlugin { var $iOrder = 0; var $sFriendlyName = null; var $sSQLDir = null; - + var $autoRegister = false; - + var $_aPortlets = array(); var $_aTriggers = array(); var $_aActions = array(); @@ -55,14 +55,14 @@ class KTPlugin { var $_aLanguage = array(); var $_aHelpLanguage = array(); var $_aWFTriggers = array(); - var $_aColumns = array(); - var $_aViews = array(); - var $_aNotificationHandlers = array(); - var $_aTemplateLocations = array(); - var $_aWidgets = array(); - var $_aValidators = array(); - var $_aCriteria = array(); - var $_aInterceptors = array(); + var $_aColumns = array(); + var $_aViews = array(); + var $_aNotificationHandlers = array(); + var $_aTemplateLocations = array(); + var $_aWidgets = array(); + var $_aValidators = array(); + var $_aCriteria = array(); + var $_aInterceptors = array(); function KTPlugin($sFilename = null) { $this->sFilename = $sFilename; @@ -75,27 +75,51 @@ class KTPlugin { function registerPortlet($aLocation, $sPortletClassName, $sPortletNamespace, $sFilename = null) { $sFilename = $this->_fixFilename($sFilename); $this->_aPortlets[$sPortletNamespace] = array($aLocation, $sPortletClassName, $sPortletNamespace, $sFilename, $this->sNamespace); + + // Register helper in DB + if(is_array($aLocation)){ + $sLocation = implode('_|', $aLocation); + } + $params = $sLocation.'|'.$sPortletClassName.'|'.$sPortletNamespace.'|'.$sFilename.'|'.$this->sNamespace; + $this->registerPluginHelper($sPortletNamespace, $sPortletClassName, $sFilename, $params, 'general', 'portlet'); } function registerTrigger($sAction, $sStage, $sTriggerClassName, $sTriggerNamespace, $sFilename = null) { $sFilename = $this->_fixFilename($sFilename); $this->_aTriggers[$sTriggerNamespace] = array($sAction, $sStage, $sTriggerClassName, $sTriggerNamespace, $sFilename, $this->sNamespace); + + // Register helper in DB + $params = $sAction.'|'.$sStage.'|'.$sTriggerClassName.'|'.$sTriggerNamespace.'|'.$sFilename.'|'.$this->sNamespace; + $this->registerPluginHelper($sTriggerNamespace, $sTriggerClassName, $sFilename, $params, 'general', 'trigger'); } function registerAction($sActionType, $sActionClassName, $sActionNamespace, $sFilename = null) { $sFilename = $this->_fixFilename($sFilename); $this->_aActions[$sActionNamespace] = array($sActionType, $sActionClassName, $sActionNamespace, $sFilename, $this->sNamespace); + + // Register helper in DB + $params = $sActionType.'|'.$sActionClassName.'|'.$sActionNamespace.'|'.$sFilename.'|'.$this->sNamespace; + $this->registerPluginHelper($sActionNamespace, $sActionClassName, $sFilename, $params, 'general', 'action'); } function registerPage($sWebPath, $sPageClassName, $sFilename = null) { $sFilename = $this->_fixFilename($sFilename); $sWebPath = sprintf("%s/%s", $this->sNamespace, $sWebPath); + $this->_aPages[$sWebPath] = array($sWebPath, $sPageClassName, $sFilename, $this->sNamespace); + + // Register helper in DB + $params = $sWebPath.'|'.$sPageClassName.'|'.$sFilename.'|'.$this->sNamespace; + $this->registerPluginHelper($sWebPath, $sPageClassName, $sFilename, $params, 'general', 'page'); } - + function registerWorkflowTrigger($sNamespace, $sTriggerClassName, $sFilename = null) { $sFilename = $this->_fixFilename($sFilename); $this->_aWFTriggers[$sNamespace] = array($sNamespace, $sTriggerClassName, $sFilename); + + // Register helper in DB + $params = $sNamespace.'|'.$sTriggerClassName.'|'.$sFilename; + $this->registerPluginHelper($sNamespace, $sTriggerClassName, $sFilename, $params, 'general', 'workflow_trigger'); } function getPagePath($sPath) { @@ -114,27 +138,52 @@ class KTPlugin { function registerAuthenticationProvider($sName, $sClass, $sNamespace, $sFilename = null) { $sFilename = $this->_fixFilename($sFilename); $this->_aAuthenticationProviders[$sNamespace] = array($sName, $sClass, $sNamespace, $sFilename, $this->sNamespace); + + // Register helper in DB + $params = $sName.'|'.$sClass.'|'.$sNamespace.'|'.$sFilename.'|'.$this->sNamespace; + $this->registerPluginHelper($sNamespace, $sClass, $sFilename, $params, 'general', 'authentication_provider'); } -//registerLocation($sName, $sClass, $sCategory, $sTitle, $sDescription, $sDispatcherFilePath = null, $sURL = null) function registerAdminPage($sName, $sClass, $sCategory, $sTitle, $sDescription, $sFilename) { $sFullname = $sCategory . '/' . $sName; $sFilename = $this->_fixFilename($sFilename); $this->_aAdminPages[$sFullname] = array($sName, $sClass, $sCategory, $sTitle, $sDescription, $sFilename, null, $this->sNamespace); + + // Register helper in DB + $params = $sName.'|'.$sClass.'|'.$sCategory.'|'.$sTitle.'|'.$sDescription.'|'.$sFilename.'|'.null.'|'.$this->sNamespace; + $this->registerPluginHelper($sFullname, $sClass, $sFilename, $params, 'general', 'admin_page'); } function registerAdminCategory($sPath, $sName, $sDescription) { $this->_aAdminCategories[$sPath] = array($sPath, $sName, $sDescription); + + // Register helper in DB + $params = $sPath.'|'.$sName.'|'.$sDescription; + $this->registerPluginHelper($sPath, $sName, $sPath, $params, 'general', 'admin_category'); } - + + /** + * Register a new dashlet + * + * @param string $sClassName + * @param string $sNamespace + * @param string $sFilename + */ function registerDashlet($sClassName, $sNamespace, $sFilename) { $sFilename = $this->_fixFilename($sFilename); $this->_aDashlets[$sNamespace] = array($sClassName, $sNamespace, $sFilename, $this->sNamespace); + + $params = $sClassName.'|'.$sNamespace.'|'.$sFilename.'|'.$this->sNamespace; + $this->registerPluginHelper($sNamespace, $sClassName, $sFilename, $params, 'dashboard', 'dashlet'); } function registeri18n($sDomain, $sPath) { $sPath = $this->_fixFilename($sPath); $this->_ai18n[$sDomain] = array($sDomain, $sPath); + + // Register helper in DB + $params = $sDomain.'|'.$sPath; + $this->registerPluginHelper($sDomain, $sDomain, $sPath, $params, 'general', 'i18n'); } function registeri18nLang($sDomain, $sLang, $sPath) { @@ -142,55 +191,150 @@ class KTPlugin { $sPath = $this->_fixFilename($sPath); } $this->_ai18nLang["$sDomain/$sLang"] = array($sDomain, $sLang, $sPath); + + // Register helper in DB + $params = $sDomain.'|'.$sLang.'|'.$sPath; + $this->registerPluginHelper("$sDomain/$sLang", $sDomain, $sPath, $params, 'general', 'i18nlang'); } function registerLanguage($sLanguage, $sLanguageName) { $this->_aLanguage[$sLanguage] = array($sLanguage, $sLanguageName); + + // Register helper in DB + $params = $sLanguage.'|'.$sLanguageName; + $this->registerPluginHelper($sLanguage, $sClassName, $sFilename, $params, 'general', 'language'); } - + function registerHelpLanguage($sPlugin, $sLanguage, $sBasedir) { $this->_aHelpLanguage[$sLanguage] = array($sPlugin, $sLanguage, $sBasedir); + + // Register helper in DB + $params = $sPlugin.'|'.$sLanguage.'|'.$sBasedir; + $this->registerPluginHelper($sLanguage, $sClassName, $sFilename, $params, 'general', 'help_language'); } - + function registerColumn($sName, $sNamespace, $sClassName, $sFile) { $sFile = $this->_fixFilename($sFile); $this->_aColumns[$sNamespace] = array($sName, $sNamespace, $sClassName, $sFile); - } - + + // Register helper in DB + $params = $sName.'|'.$sNamespace.'|'.$sClassName.'|'.$sFile; + $this->registerPluginHelper($sNamespace, $sClassName, $sFile, $params, 'general', 'column'); + } + function registerView($sName, $sNamespace) { $this->_aViews[$sNamespace] = array($sName, $sNamespace); - } + + // Register helper in DB + $params = $sName.'|'.$sNamespace; + $this->registerPluginHelper($sNamespace, '', '', $params, 'general', 'view'); + } function registerNotificationHandler($sName, $sNamespace, $sPath) { $sPath = $this->_fixFilename($sPath); $this->_aNotificationHandlers[$sNamespace] = array($sNamespace, $sName, $sPath); - } + + // Register helper in DB + $params = $sNamespace.'|'.$sName.'|'.$sPath; + $this->registerPluginHelper($sNamespace, $sName, $sPath, $params, 'general', 'notification_handler'); + } function registerTemplateLocation($sName, $sPath) { $sPath = $this->_fixFilename($sPath); $this->_aTemplateLocations[$sName] = array($sName, $sPath); - } - + // Register helper in DB + $params = $sName.'|'.$sPath; + $this->registerPluginHelper($sName, $sName, $sPath, $params, 'general', 'template_location'); + } + + /** + * Register a new widget + * + * @param unknown_type $sClassname + * @param unknown_type $sNamespace + * @param unknown_type $sPath + */ function registerWidget($sClassname, $sNamespace, $sPath) { $sPath = $this->_fixFilename($sPath); $this->_aWidgets[$sNamespace] = array($sClassname, $sNamespace, $sPath); + + // Register helper in DB + $params = $sClassname.'|'.$sNamespace.'|'.$sPath; + $this->registerPluginHelper($sNamespace, $sClassname, $sPath, $params, 'general', 'widget'); } - + function registerValidator($sClassname, $sNamespace, $sPath) { $sPath = $this->_fixFilename($sPath); $this->_aValidators[$sNamespace] = array($sClassname, $sNamespace, $sPath); + + // Register helper in DB + $params = $sClassname.'|'.$sNamespace.'|'.$sPath; + $this->registerPluginHelper($sNamespace, $sClassname, $sPath, $params, 'general', 'validator'); } function registerCriterion($sClassName, $sNamespace, $sFilename = null, $aInitialize = null) { $sFilename = $this->_fixFilename($sFilename); $this->_aCriteria[$sNamespace] = array($sClassName, $sNamespace, $sFilename, $aInitialize); + + // Register helper in DB + if(is_array($aInitialize)){ + $sInitialize = implode('_|', $aInitialize); + } + + $params = $sClassName.'|'.$sNamespace.'|'.$sFilename.'|'.$sInitialize; + $this->registerPluginHelper($sNamespace, $sClassName, $sFilename, $params, 'general', 'criterion'); } function registerInterceptor($sClassname, $sNamespace, $sPath = null) { $sPath = $this->_fixFilename($sPath); $this->_aInterceptors[$sNamespace] = array($sClassname, $sNamespace, $sPath); + + // Register helper in DB + $params = $sClassname.'|'.$sNamespace.'|'.$sPath; + $this->registerPluginHelper($sNamespace, $sClassname, $sPath, $params, 'general', 'interceptor'); + } + + /* ** Refactor into another class ** */ + /** + * Register the plugin in the DB + * + * @param unknown_type $sClassName + * @param unknown_type $path + * @param unknown_type $object + * @param unknown_type $type + */ + function registerPluginHelper($sNamespace, $sClassName, $path, $object, $view, $type) { + + $sql = "SELECT * FROM plugin_helper WHERE namespace = '{$sNamespace}' AND classtype = '{$type}'"; + $res = DBUtil::getOneResult($sql); + + $aValues = array(); + $aValues['namespace'] = $sNamespace; + $aValues['plugin'] = (!empty($this->sNamespace)) ? $this->sNamespace : $sNamespace; + $aValues['classname'] = $sClassName; + $aValues['pathname'] = $path; + $aValues['object'] = $object; + $aValues['viewtype'] = $view; + $aValues['classtype'] = $type; + + // if record exists - update it. + if(!empty($res)){ + $id = $res['id']; + $updateRes = DBUtil::autoUpdate('plugin_helper', $aValues, $id); + if(PEAR::isError($updateRes)){ + return $updateRes; + } + return true; + } + + // Insert into DB + $res = DBUtil::autoInsert('plugin_helper', $aValues); + if(PEAR::isError($res)){ + return $res; + } + return true; } function _fixFilename($sFilename) { @@ -234,7 +378,120 @@ class KTPlugin { return true; } + /** + * Load the actions, portlets, etc as part of the parent plugin + * + */ function load() { + // Get actions, portlets, etc, create arrays as part of plugin + $query = "SELECT * FROM plugin_helper h WHERE plugin = '{$this->sNamespace}'"; + $aPluginHelpers = DBUtil::getResultArray($query); + + if(!empty($aPluginHelpers)){ + foreach ($aPluginHelpers as $plugin) { + $sName = $plugin['namespace']; + $sParams = $plugin['object']; + $aParams = explode('|', $sParams); + $sClassType = $plugin['classtype']; + + switch ($sClassType) { + case 'portlet': + $aLocation = explode('_|', $aParams[0]); + $aParams[0] = $aLocation; + $this->_aPortlets[$sName] = $aParams; + break; + + case 'trigger': + $this->_aTriggers[$sName] = $aParams; + break; + + case 'action': + $this->_aActions[$sName] = $aParams; + break; + + case 'page': + $this->_aPages[$sName] = $aParams; + break; + + case 'authentication_provider': + $this->_aAuthenticationProviders[$sName] = $aParams; + break; + + case 'admin_category': + $this->_aAdminCategories[$sName] = $aParams; + break; + + case 'admin_page': + $this->_aAdminPages[$sName] = $aParams; + break; + + case 'dashlet': + $this->_aDashlets[$sName] = $aParams; + break; + + case 'i18n': + $this->_ai18n[$sName] = $aParams; + break; + + case 'i18nlang': + $this->_ai18nLang[$sName] = $aParams; + break; + + case 'language': + $this->_aLanguage[$sName] = $aParams; + break; + + case 'help_language': + $this->_aHelpLanguage[$sName] = $aParams; + break; + + case 'workflow_trigger': + $this->_aWFTriggers[$sName] = $aParams; + break; + + case 'column': + $this->_aColumns[$sName] = $aParams; + break; + + case 'view': + $this->_aViews[$sName] = $aParams; + break; + + case 'notification_handler': + $this->_aNotificationHandlers[$sName] = $aParams; + break; + + case 'template_location': + $this->_aTemplateLocations[$sName] = $aParams; + break; + + case 'criterion': + $aInit = explode('_|', $aParams[3]); + $aParams[3] = $aInit; + $this->_aCriteria[$sName] = $aParams; + break; + + case 'widget': + $this->_aWidgets[$sName] = $aParams; + break; + + case 'validator': + $this->_aValidators[$sName] = $aParams; + break; + + case 'interceptor': + $this->_aInterceptors[$sName] = $aParams; + break; + } + } + } + } + + /** + * Old load function + * + */ + function load_old() { if (!$this->isRegistered()) { return; } @@ -245,15 +502,15 @@ class KTPlugin { require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php'); require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); - require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); - require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); - require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php"); + require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); + require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); + require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php"); require_once(KT_LIB_DIR . "/help/help.inc.php"); require_once(KT_LIB_DIR . "/workflow/workflowutil.inc.php"); - require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php"); - require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php"); - require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php"); - require_once(KT_LIB_DIR . "/browse/criteriaregistry.php"); + require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php"); + require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php"); + require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php"); + require_once(KT_LIB_DIR . "/browse/criteriaregistry.php"); require_once(KT_LIB_DIR . "/authentication/interceptorregistry.inc.php"); $oPRegistry =& KTPortletRegistry::getSingleton(); @@ -261,16 +518,16 @@ class KTPlugin { $oARegistry =& KTActionRegistry::getSingleton(); $oPageRegistry =& KTPageRegistry::getSingleton(); $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton(); - $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); + $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton(); $oDashletRegistry =& KTDashletRegistry::getSingleton(); $oi18nRegistry =& KTi18nRegistry::getSingleton(); $oKTHelpRegistry =& KTHelpRegistry::getSingleton(); $oWFTriggerRegistry =& KTWorkflowTriggerRegistry::getSingleton(); - $oColumnRegistry =& KTColumnRegistry::getSingleton(); + $oColumnRegistry =& KTColumnRegistry::getSingleton(); $oNotificationHandlerRegistry =& KTNotificationRegistry::getSingleton(); $oTemplating =& KTTemplating::getSingleton(); $oWidgetFactory =& KTWidgetFactory::getSingleton(); - $oValidatorFactory =& KTValidatorFactory::getSingleton(); + $oValidatorFactory =& KTValidatorFactory::getSingleton(); $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton(); $oInterceptorRegistry =& KTInterceptorRegistry::getSingleton(); @@ -301,7 +558,7 @@ class KTPlugin { foreach ($this->_aAdminPages as $k => $v) { call_user_func_array(array(&$oAdminRegistry, 'registerLocation'), $v); } - + foreach ($this->_aDashlets as $k => $v) { call_user_func_array(array(&$oDashletRegistry, 'registerDashlet'), $v); } @@ -317,38 +574,38 @@ class KTPlugin { foreach ($this->_aLanguage as $k => $v) { call_user_func_array(array(&$oi18nRegistry, 'registerLanguage'), $v); } - + foreach ($this->_aHelpLanguage as $k => $v) { call_user_func_array(array(&$oKTHelpRegistry, 'registerHelp'), $v); } - + foreach ($this->_aWFTriggers as $k => $v) { call_user_func_array(array(&$oWFTriggerRegistry, 'registerWorkflowTrigger'), $v); } - + foreach ($this->_aColumns as $k => $v) { call_user_func_array(array(&$oColumnRegistry, 'registerColumn'), $v); - } - + } + foreach ($this->_aViews as $k => $v) { call_user_func_array(array(&$oColumnRegistry, 'registerView'), $v); - } + } foreach ($this->_aNotificationHandlers as $k => $v) { call_user_func_array(array(&$oNotificationHandlerRegistry, 'registerNotificationHandler'), $v); - } + } foreach ($this->_aTemplateLocations as $k => $v) { call_user_func_array(array(&$oTemplating, 'addLocation'), $v); - } + } foreach ($this->_aCriteria as $k => $v) { call_user_func_array(array(&$oCriteriaRegistry, 'registerCriterion'), $v); - } - + } + foreach ($this->_aWidgets as $k => $v) { call_user_func_array(array(&$oWidgetFactory, 'registerWidget'), $v); - } + } foreach ($this->_aValidators as $k => $v) { call_user_func_array(array(&$oValidatorFactory, 'registerValidator'), $v); @@ -369,9 +626,9 @@ class KTPlugin { } return $sFilename; } - + function upgradePlugin($iStart, $iEnd) { - if (is_null($this->sSQLDir)) { + if (is_null($this->sSQLDir)) { return $iEnd; // no db changes, must reach the "end". } global $default; @@ -382,7 +639,7 @@ class KTPlugin { if (!file_exists($sqlfile)) { continue; // skip it. } - $queries = SQLFile::sqlFromFile($sqlfile); + $queries = SQLFile::sqlFromFile($sqlfile); $res = DBUtil::runQueries($queries, $default->_admindb); if (PEAR::isError($res)) { @@ -415,7 +672,7 @@ class KTPlugin { 'friendlyname' => $friendly_name, )); // FIXME we -really- need to raise an error here, somehow. - return $oEntity; + return $oEntity; } else { $oEntity->updateFromArray(array( 'path' => $this->stripKtDir($this->sFilename), diff --git a/lib/plugins/pluginregistry.inc.php b/lib/plugins/pluginregistry.inc.php index 1d8a638..ca8f0eb 100644 --- a/lib/plugins/pluginregistry.inc.php +++ b/lib/plugins/pluginregistry.inc.php @@ -6,7 +6,7 @@ * License Version 1.1.2 ("License"); You may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.knowledgetree.com/KPL - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and @@ -17,9 +17,9 @@ * (ii) the KnowledgeTree copyright notice * in the same form as they appear in the distribution. See the License for * requirements. - * + * * The Original Code is: KnowledgeTree Open Source - * + * * The Initial Developer of the Original Code is The Jam Warehouse Software * (Pty) Ltd, trading as KnowledgeTree. * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -40,8 +40,18 @@ class KTPluginRegistry { return $GLOBALS['_KT_PLUGIN']['oKTPluginRegistry']; } + /** + * Register the plugin in the database + * + * @param unknown_type $sClassName + * @param unknown_type $sNamespace + * @param unknown_type $sFilename + */ function registerPlugin($sClassName, $sNamespace, $sFilename = null) { $this->_aPluginDetails[$sNamespace] = array($sClassName, $sNamespace, $sFilename); + + $object = $sClassName.'|'.$sNamespace.'|'.$sFilename; + $res = KTPlugin::registerPluginHelper($sNamespace, $sClassName, $sFilename, $object, 'general', 'plugin'); } function &getPlugin($sNamespace) { diff --git a/lib/plugins/pluginutil.inc.php b/lib/plugins/pluginutil.inc.php index 88cd0d8..d18a3db 100644 --- a/lib/plugins/pluginutil.inc.php +++ b/lib/plugins/pluginutil.inc.php @@ -6,7 +6,7 @@ * License Version 1.1.2 ("License"); You may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.knowledgetree.com/KPL - * + * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. * See the License for the specific language governing rights and @@ -17,9 +17,9 @@ * (ii) the KnowledgeTree copyright notice * in the same form as they appear in the distribution. See the License for * requirements. - * + * * The Original Code is: KnowledgeTree Open Source - * + * * The Initial Developer of the Original Code is The Jam Warehouse Software * (Pty) Ltd, trading as KnowledgeTree. * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright @@ -59,69 +59,210 @@ class KTPluginResourceRegistry { } class KTPluginUtil { - function loadPlugins () { - $sPluginCache = KT_DIR . '/var/plugin-cache'; - if (file_exists($sPluginCache)) { - require_once(KT_LIB_DIR . "/plugins/plugin.inc.php"); - require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php'); - require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php'); - require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php'); - require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php'); - require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php'); - require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php"); - require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php"); - require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php"); - require_once(KT_LIB_DIR . "/help/help.inc.php"); - require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php"); - require_once(KT_LIB_DIR . "/authentication/interceptorregistry.inc.php"); - require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php"); - require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php"); - $GLOBALS['_KT_PLUGIN'] = unserialize(file_get_contents($sPluginCache)); - $GLOBALS['_KT_PLUGIN']['oKTPluginRegistry']->_aPlugins = array(); - return; + /** + * Load the plugins for the current page + * + * @param unknown_type $sType + */ + function loadPlugins ($sType) { + + if($sType != 'dashboard'){ + $sType = 'general'; } $GLOBALS['_KT_PLUGIN'] = array(); - $aPlugins = KTPluginEntity::getList("disabled=0"); - if (count($aPlugins) === 0) { + + $aPlugins = array(); + $aPluginHelpers = array(); + + // Get the list of enabled plugins + $query = "SELECT * FROM plugin_helper h, plugins p + WHERE p.namespace = h.plugin AND p.disabled = 0 AND h.classtype='plugin'"; + $aPluginHelpers = DBUtil::getResultArray($query); + + // Check that there are plugins and if not, register them + if (empty($aPluginHelpers)) { KTPluginUtil::registerPlugins(); + + $query = "SELECT * FROM plugin_helper h, plugins p + WHERE p.namespace = h.plugin AND p.disabled = 0 AND h.viewtype='{$sType}' AND h.classtype='plugin'"; + $aPluginHelpers = DBUtil::getResultArray($query); } - $aPaths = array(); - $aPaths[] = KT_DIR . '/plugins/ktcore/KTCorePlugin.php'; - $aPaths[] = KT_DIR . '/plugins/ktcore/KTCoreLanguagePlugin.php'; - foreach ($aPlugins as $oPlugin) { - if (!is_a($oPlugin, 'KTPluginEntity')) { - print "
";
-                print "loadPlugins()\n";
-                var_dump($aPlugins);
-                exit(0);
-            }
-            $sPath = $oPlugin->getPath();
-            if (!KTUtil::isAbsolutePath($sPath)) {
-                $sPath = sprintf("%s/%s", KT_DIR, $sPath);
-            }
-            $aPaths[] = $sPath;
-        }
-        $aPaths = array_unique($aPaths);
-        foreach ($aPaths as $sPath) {
-            if (file_exists($sPath)) {
-                require_once($sPath);
+
+        // Create plugin objects
+        foreach ($aPluginHelpers as $aItem){
+            $classname = $aItem['classname'];
+            $path = $aItem['pathname'];
+
+            if (!empty($path)) {
+                require_once($path);
             }
+
+        	$oPlugin = new $classname($path);
+        	$aPlugins[] = $oPlugin;
+        	$oPlugin->load();
         }
-        $oRegistry =& KTPluginRegistry::getSingleton();
-        $aPlugins =& $oRegistry->getPlugins();
-        foreach ($aPlugins as $oPlugin) {
-            if (!isset($aOrder[$oPlugin->iOrder])) {
-                $aOrder[$oPlugin->iOrder] = array();
+
+        // load plugin helpers into global space
+        $query = "SELECT h.* FROM plugin_helper h, plugins p
+        	   WHERE p.namespace = h.plugin AND p.disabled = 0 ";//WHERE viewtype='{$sType}'";
+        $aPluginList = DBUtil::getResultArray($query);
+        KTPluginUtil::load($aPluginList);
+
+        // Load the template locations
+        $query = "SELECT * FROM plugin_helper h WHERE h.classtype='locations'";
+        $aLocations = DBUtil::getResultArray($query);
+        if(!empty($aLocations)){
+            $oTemplating =& KTTemplating::getSingleton();
+            foreach ($aLocations as $location){
+                $aParams = explode('|', $location['object']);
+                call_user_func_array(array(&$oTemplating, 'addLocation2'), $aParams);
             }
-            $aOrder[$oPlugin->iOrder][] = $oPlugin;
         }
-        ksort($aOrder, SORT_NUMERIC);
-        foreach ($aOrder as $iOrder => $aOrderPlugins) {
-            foreach ($aOrderPlugins as $oPlugin) {
-                $oPlugin->load();
-            }
+        return;
+    }
+
+    /**
+     * Load the plugins into the global space
+     *
+     * @param array $aPlugins
+     */
+    function load($aPlugins) {
+        require_once(KT_LIB_DIR . '/actions/actionregistry.inc.php');
+        require_once(KT_LIB_DIR . '/actions/portletregistry.inc.php');
+        require_once(KT_LIB_DIR . '/triggers/triggerregistry.inc.php');
+        require_once(KT_LIB_DIR . '/plugins/pageregistry.inc.php');
+        require_once(KT_LIB_DIR . '/authentication/authenticationproviderregistry.inc.php');
+        require_once(KT_LIB_DIR . "/plugins/KTAdminNavigation.php");
+        require_once(KT_LIB_DIR . "/dashboard/dashletregistry.inc.php");
+        require_once(KT_LIB_DIR . "/i18n/i18nregistry.inc.php");
+        require_once(KT_LIB_DIR . "/help/help.inc.php");
+        require_once(KT_LIB_DIR . "/workflow/workflowutil.inc.php");
+        require_once(KT_LIB_DIR . "/widgets/widgetfactory.inc.php");
+        require_once(KT_LIB_DIR . "/validation/validatorfactory.inc.php");
+        require_once(KT_LIB_DIR . "/browse/columnregistry.inc.php");
+        require_once(KT_LIB_DIR . "/browse/criteriaregistry.php");
+        require_once(KT_LIB_DIR . "/authentication/interceptorregistry.inc.php");
+
+        $oPRegistry =& KTPortletRegistry::getSingleton();
+        $oTRegistry =& KTTriggerRegistry::getSingleton();
+        $oARegistry =& KTActionRegistry::getSingleton();
+        $oPageRegistry =& KTPageRegistry::getSingleton();
+        $oAPRegistry =& KTAuthenticationProviderRegistry::getSingleton();
+        $oAdminRegistry =& KTAdminNavigationRegistry::getSingleton();
+        $oDashletRegistry =& KTDashletRegistry::getSingleton();
+        $oi18nRegistry =& KTi18nRegistry::getSingleton();
+        $oKTHelpRegistry =& KTHelpRegistry::getSingleton();
+        $oWFTriggerRegistry =& KTWorkflowTriggerRegistry::getSingleton();
+        $oColumnRegistry =& KTColumnRegistry::getSingleton();
+        $oNotificationHandlerRegistry =& KTNotificationRegistry::getSingleton();
+        $oTemplating =& KTTemplating::getSingleton();
+        $oWidgetFactory =& KTWidgetFactory::getSingleton();
+        $oValidatorFactory =& KTValidatorFactory::getSingleton();
+        $oCriteriaRegistry =& KTCriteriaRegistry::getSingleton();
+        $oInterceptorRegistry =& KTInterceptorRegistry::getSingleton();
+        $oKTPluginRegistry =& KTPluginRegistry::getSingleton();
+
+        // Loop through the loaded plugins and register them
+        foreach ($aPlugins as $plugin){
+            $sName = $plugin['namespace'];
+        	$sParams = $plugin['object'];
+        	$aParams = explode('|', $sParams);
+        	$sClassType = $plugin['classtype'];
+
+        	switch ($sClassType) {
+        	    case 'portlet':
+        	        $aLocation = explode('_|', $aParams[0]);
+        	        $aParams[0] = $aLocation;
+        	        call_user_func_array(array(&$oPRegistry, 'registerPortlet'), $aParams);
+        	        break;
+
+        	    case 'trigger':
+        	        call_user_func_array(array(&$oTRegistry, 'registerTrigger'), $aParams);
+        	        break;
+
+        	    case 'action':
+        	        call_user_func_array(array(&$oARegistry, 'registerAction'), $aParams);
+        	        break;
+
+        	    case 'page':
+        	        call_user_func_array(array(&$oPageRegistry, 'registerPage'), $aParams);
+        	        break;
+
+        	    case 'authentication_provider':
+        	        call_user_func_array(array(&$oAPRegistry, 'registerAuthenticationProvider'), $aParams);
+        	        break;
+
+        	    case 'admin_category':
+        	        call_user_func_array(array(&$oAdminRegistry, 'registerCategory'), $aParams);
+        	        break;
+
+        	    case 'admin_page':
+        	        call_user_func_array(array(&$oAdminRegistry, 'registerLocation'), $aParams);
+        	        break;
+
+        	    case 'dashlet':
+        	        call_user_func_array(array(&$oDashletRegistry, 'registerDashlet'), $aParams);
+        	        break;
+
+        	    case 'i18n':
+        	        call_user_func_array(array(&$oi18nRegistry, 'registeri18n'), $aParams);
+        	        break;
+
+        	    case 'i18nlang':
+        	        call_user_func_array(array(&$oi18nRegistry, 'registeri18nLang'), $aParams);
+        	        break;
+
+        	    case 'language':
+        	        call_user_func_array(array(&$oi18nRegistry, 'registerLanguage'), $aParams);
+        	        break;
+
+        	    case 'help_language':
+        	        call_user_func_array(array(&$oKTHelpRegistry, 'registerHelp'), $aParams);
+        	        break;
+
+        	    case 'workflow_trigger':
+        	        call_user_func_array(array(&$oWFTriggerRegistry, 'registerWorkflowTrigger'), $aParams);
+        	        break;
+
+        	    case 'column':
+        	        call_user_func_array(array(&$oColumnRegistry, 'registerColumn'), $aParams);
+        	        break;
+
+        	    case 'view':
+        	        call_user_func_array(array(&$oColumnRegistry, 'registerView'), $aParams);
+        	        break;
+
+        	    case 'notification_handler':
+        	        call_user_func_array(array(&$oNotificationHandlerRegistry, 'registerNotificationHandler'), $aParams);
+        	        break;
+
+        	    case 'template_location':
+        	        call_user_func_array(array(&$oTemplating, 'addLocation'), $aParams);
+        	        break;
+
+        	    case 'criterion':
+            	    $aInit = explode('_|', $aParams[3]);
+        	        $aParams[3] = $aInit;
+        	        call_user_func_array(array(&$oCriteriaRegistry, 'registerCriterion'), $aParams);
+        	        break;
+
+        	    case 'widget':
+        	        call_user_func_array(array(&$oWidgetFactory, 'registerWidget'), $aParams);
+        	        break;
+
+        	    case 'validator':
+        	        call_user_func_array(array(&$oValidatorFactory, 'registerValidator'), $aParams);
+        	        break;
+
+        	    case 'interceptor':
+        	        call_user_func_array(array(&$oInterceptorRegistry, 'registerInterceptor'), $aParams);
+        	        break;
+
+        	    case 'plugin':
+        	        $oKTPluginRegistry->_aPluginDetails[$sName] = $aParams;
+        	        break;
+        	}
         }
-        // file_put_contents($sPluginCache, serialize($GLOBALS['_KT_PLUGIN']));
     }
 
     function registerPlugins () {
@@ -214,7 +355,7 @@ class KTPluginUtil {
         $oRegistry =& KTPluginResourceRegistry::getSingleton();
         return $oRegistry->isRegistered($path);
     }
-    
+
     function registerResource($path) {
         $oRegistry =& KTPluginResourceRegistry::getSingleton();
         $oRegistry->registerResource($path);
@@ -244,20 +385,20 @@ class KTPluginUtil {
 
     // utility function to detect if the plugin is loaded and active.
     function pluginIsActive($sNamespace) {
-		
-	    
-		
+
+
+
 		$oReg =& KTPluginRegistry::getSingleton();
 		$plugin = $oReg->getPlugin($sNamespace);
-		
-		
-		
+
+
+
 		if (is_null($plugin) || PEAR::isError($plugin)) { return false; }  // no such plugin
 		else { // check if its active
 			$ent = KTPluginEntity::getByNamespace($sNamespace);
 
 			if (PEAR::isError($ent)) { return false; }
-			
+
 			// we now can ask
 			return (!$ent->getDisabled());
 		}
diff --git a/lib/templating/kt3template.inc.php b/lib/templating/kt3template.inc.php
index dc87b79..cd23c45 100644
--- a/lib/templating/kt3template.inc.php
+++ b/lib/templating/kt3template.inc.php
@@ -6,7 +6,7 @@
  * License Version 1.1.2 ("License"); You may not use this file except in
  * compliance with the License. You may obtain a copy of the License at
  * http://www.knowledgetree.com/KPL
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS"
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  * See the License for the specific language governing rights and
@@ -17,9 +17,9 @@
  *    (ii) the KnowledgeTree copyright notice
  * in the same form as they appear in the distribution.  See the License for
  * requirements.
- * 
+ *
  * The Original Code is: KnowledgeTree Open Source
- * 
+ *
  * The Initial Developer of the Original Code is The Jam Warehouse Software
  * (Pty) Ltd, trading as KnowledgeTree.
  * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -33,12 +33,12 @@
  * KT3 Template Base
  *
  * Represents core UI logic, including how sub-components interact with
- * the overall page. 
+ * the overall page.
  *
  * For the meaning of each of the variables and functions, see inline.
  *
  */
- 
+
 require_once(KT_LIB_DIR . "/plugins/pluginregistry.inc.php");
 require_once(KT_LIB_DIR . "/templating/templating.inc.php");
 require_once(KT_LIB_DIR . "/session/control.inc");
@@ -55,13 +55,13 @@ class KTPage {
 	var $theme_ie_only_css = Array();
     var $js_standalone = Array();
     var $css_standalone = Array();
-	
+
 	/** context-relevant information */
 	var $errStack = Array();
     var $infoStack = Array();
 	var $portlets = Array();
 	var $show_portlets = true;
-    
+
     /** miscellaneous items */
     var $title = '';
     var $systemName = APP_NAME;
@@ -72,11 +72,11 @@ class KTPage {
     var $menu = null;
     var $userMenu = null;
     var $helpPage = null;
-    
+
     /** the "component".  Used to set the page header (see documentation for explanation). */
     var $componentLabel = 'Browse Documents';
     var $componentClass = 'browse_collections';
-    
+
     /** $contents is the center of the page.  In KT < 3, this was CentralPayload. */
     var $contents = '';
 
@@ -84,14 +84,14 @@ class KTPage {
 
     var $contentType = 'text/html';
     var $charset = 'UTF-8';
-    
+
     var $content_class;
-    
+
     /* further initialisation */
     function KTPage() {
-        global $default; 
+        global $default;
         $oConfig = KTConfig::getSingleton();
-        
+
         /* default css files initialisation */
         $aCSS = Array(
            "resources/css/kt-framing.css",
@@ -99,7 +99,7 @@ class KTPage {
            "resources/css/kt-headings.css"
         );
         $this->requireCSSResources($aCSS);
-        
+
         if($oConfig->get('ui/morphEnabled') == '1'){
         	$morphTheme = $oConfig->get('ui/morphTo');
         	$this->requireThemeCSSResource('skins/kts_'.$oConfig->get('ui/morphTo').'/kt-morph.css');
@@ -107,13 +107,13 @@ class KTPage {
         }
         // IE only
         $this->requireCSSResource("resources/css/kt-ie-icons.css", true);
-        
+
         /* default js files initialisation */
         $aJS = Array();
 
 		$aJS[] = 'thirdpartyjs/yui/yahoo/yahoo.js';
 		$aJS[] = 'thirdpartyjs/yui/utilities/utilities.js';
-        /*	
+        /*
         $aJS[] = 'thirdpartyjs/MochiKit/MochiKit.js';
 	$aJS[] = 'thirdpartyjs/MochiKit/New.js';
 	$aJS[] = 'thirdpartyjs/MochiKit/DragAndDrop.js';
@@ -127,58 +127,63 @@ class KTPage {
         $aJS[] = 'thirdpartyjs/curvycorners/rounded_corners_lite.inc.js';
         $aJS[] = 'resources/js/loader.js';
         $aJS[] = 'thirdpartyjs/yui/tools/tools.js';
-        
 
-        
+
+
         //$aJS[] = 'thirdpartyjs/MochiKit/Iter.js';
         //$aJS[] = 'thirdpartyjs/MochiKit/DOM.js';
         //$aJS[] = 'thirdpartyjs/MochiKit/Logging.js';
         //$aJS[] = 'thirdpartyjs/MochiKit/Async.js';
-        //$aJS[] = 'thirdpartyjs/MochiKit/Signal.js';	
+        //$aJS[] = 'thirdpartyjs/MochiKit/Signal.js';
         //$aJS[] = 'thirdpartyjs/MochiKit/.js';
         //$aJS[] = 'resources/js/translate.js';
 
         $this->requireJSResources($aJS);
-        
+
         // this is horrid, but necessary.
 		$this->requireJSStandalone('addLoadEvent(partial(initDeleteProtection, "' . _kt('Are you sure you wish to delete this item?') . '"));');
-        
+
         /* menu initialisation*/
         // FIXME:  how do we want to handle the menu?
         $this->initMenu();
-        
+
         /* portlet initialisation */
         $this->show_portlets = true;
         /* breadcrumbs */
     }
-       
+
 	// initiliase the menu.
     function initMenu() {
-	// FIXME:  we lost the getDefaultAction stuff - do we care?
-	// note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active"
-	$this->menu = array("dashboard" => $this->_actionHelper(array("name" => _kt("Dashboard"), "action" => "dashboard", "active" => 0)),
+    	// FIXME:  we lost the getDefaultAction stuff - do we care?
+    	// note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active"
+    	$this->menu = array();
+    	$this->menu['dashboard'] = array('label' => _kt("Dashboard"), 'url' => 'dashboard.php');
+		$this->menu['browse'] = array('label' => _kt("Browse Documents"), 'url' => 'browse.php');
+		$this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => 'admin.php');
+	   /*
+	   $this->menu = array("dashboard" => $this->_actionHelper(array("name" => _kt("Dashboard"), "action" => "dashboard", "active" => 0)),
 			    "browse" => $this->_actionHelper(array("name" => _kt("Browse Documents"), "action" => "browse", "active" => 0)),
 			    "administration" => $this->_actionHelper(array("name" => _kt("DMS Administration"), "action" => "administration", "active" => 0)),);
-    }
-	
-	
-    function setTitle($sTitle) { 
-	$this->title = $sTitle; 
+    */
     }
     
-    /* javascript handling */    
+    function setTitle($sTitle) {
+	$this->title = $sTitle;
+    }
+
+    /* javascript handling */
     // require that the specified JS file is referenced.
     function requireJSResource($sResourceURL) {
-	$this->js_resources[$sResourceURL] = 1; // use the keys to prevent multiple copies.		
+	$this->js_resources[$sResourceURL] = 1; // use the keys to prevent multiple copies.
     }
-    
+
     // require that the specified JS files are referenced.
     function requireJSResources($aResourceURLs) {
         foreach ($aResourceURLs as $sResourceURL) {
             $this->js_resources[$sResourceURL] = 1;
         }
     }
-    
+
     // list the distinct js resources.
     function getJSResources() {
         return array_keys($this->js_resources);
@@ -191,7 +196,7 @@ class KTPage {
     function getJSStandalone() {
         return array_keys($this->js_standalone);
     }
-    
+
     /* css handling */
     // require that the specified CSS file is referenced.
     function requireCSSResource($sResourceURL, $ieOnly = false) {
@@ -201,7 +206,7 @@ class KTPage {
 		    $this->ie_only_css[$sResourceURL] = 1;
 		}
     }
-    
+
     // require that the specified CSS file is referenced.
     function requireThemeCSSResource($sResourceURL, $ieOnly = false) {
         if ($ieOnly !== true) {
@@ -210,28 +215,28 @@ class KTPage {
 		    $this->theme_ie_only_css[$sResourceURL] = 1;
 		}
     }
-    
+
     // require that the specified CSS files are referenced.
     function requireCSSResources($aResourceURLs) {
         foreach ($aResourceURLs as $sResourceURL) {
             $this->css_resources[$sResourceURL] = 1;
         }
     }
-    
+
     // list the distinct CSS resources.
     function getCSSResources() {
         return array_keys($this->css_resources);
     }
-    
+
     // list the distinct CSS resources.
     function getThemeCSSResources() {
         return array_keys($this->theme_css_resources);
     }
-	
+
 	function getCSSResourcesForIE() {
         return array_keys($this->ie_only_css);
     }
-    
+
     function getThemeCSSResourcesForIE() {
         return array_keys($this->theme_ie_only_css);
     }
@@ -243,13 +248,13 @@ class KTPage {
     function getCSSStandalone() {
         return array_keys($this->css_standalone);
     }
-    
+
     function setPageContents($contents) { $this->contents = $contents; }
     function setShowPortlets($bShow) { $this->show_portlets = $bShow; }
-    
+
     /* set the breadcrumbs.  the first item is the area name.
        the rest are breadcrumbs. */
-    function setBreadcrumbs($aBreadcrumbs) { 
+    function setBreadcrumbs($aBreadcrumbs) {
         $breadLength = count($aBreadcrumbs);
         if ($breadLength != 0) {
             $this->breadcrumbSection = $this->_actionhelper($aBreadcrumbs[0]);
@@ -262,12 +267,12 @@ class KTPage {
             $this->breadcrumbs = array_map(array(&$this, "_actionhelper"), array_slice($aBreadcrumbs, 1));
         }
     }
-    
+
     function setBreadcrumbDetails($sBreadcrumbDetails) { $this->breadcrumbDetails = $sBreadcrumbDetails; }
 	function setUser($oUser) { $this->user = $oUser; }
-    
-    function setContentClass($sClass) { $this->content_class = $sClass; }    
-    
+
+    function setContentClass($sClass) { $this->content_class = $sClass; }
+
     // FIXME refactor setSection to be generic, not an if-else.
     // assume this is admin for now.
     function setSection($sSection) {
@@ -277,54 +282,54 @@ class KTPage {
 			$this->menu['administration']['active'] = 1;
 		} else if ($sSection == 'dashboard') {
 		    $this->componentLabel = _kt('Dashboard');
-            $this->componentClass = 'dashboard';	    
+            $this->componentClass = 'dashboard';
 		} else if ($sSection == 'browse') {
 		    $this->componentLabel = _kt('Browse Documents');
-            $this->componentClass = 'browse_collections';	  						
+            $this->componentClass = 'browse_collections';
 		} else if ($sSection == 'view_details') {
 		    $this->componentLabel = _kt('Document Details');
-            $this->componentClass = 'document_details';	    
+            $this->componentClass = 'document_details';
 		} else if ($sSection == 'search') {
 		    $this->componentLabel = _kt('Search');
-            $this->componentClass = 'search';				
+            $this->componentClass = 'search';
 		} else if ($sSection == 'preferences') {
 		    $this->componentLabel = _kt('Preferences');
-            $this->componentClass = 'preferences';				
+            $this->componentClass = 'preferences';
 	    } else {
 			$this->componentLabel = _kt('Dashboard');
-			$this->componentClass = 'dashboard';	    
+			$this->componentClass = 'dashboard';
 		}
 
 	}
 
 	function addError($sError) { array_push($this->errStack, $sError); }
 	function addInfo($sInfo) { array_push($this->infoStack, $sInfo); }
-	
+
 	/** no-one cares what a portlet is, but it should be renderable, and have its ->title member set. */
 	function addPortlet($oPortlet) {
 	    array_push($this->portlets, $oPortlet);
 	}
-	
+
 	/* LEGACY */
 	var $deprecationWarning = "Legacy UI API: ";
 	function setCentralPayload($sCentral) {
 	    $this->contents = $sCentral;
 		$this->addError($this->deprecationWarning . "called setCentralPayload");
 	}
-	
+
 	function setOnloadJavascript($appendix) { $this->addError($this->deprecationWarning . "called setOnloadJavascript (no-act)"); }
 	function setDHtmlScrolling($appendix) { $this->addError($this->deprecationWarning . "called setDHTMLScrolling (no-act)"); }
 	function setFormAction($appendix) { $this->addError($this->deprecationWarning . "called setFormAction (no-act)"); }
 	function setSubmitMethod($appendix) { $this->addError($this->deprecationWarning . "called setSubmitMethod (no-act)"); }
 	function setHasRequiredFields($appendix) { $this->addError($this->deprecationWarning . "called setHasRequiredFields (no-act)"); }
 	function setAdditionalJavascript($appendix) { $this->addError($this->deprecationWarning . "called setAdditionalJavascript (no-act)"); }
-    
+
 	function hideSection() { $this->hide_section = true; }
 	function setSecondaryTitle($sSecondary) { $this->secondary_title = $sSecondary; }
-    
+
     /* final render call. */
     function render() {
-	global $default; 
+	global $default;
         $oConfig = KTConfig::getSingleton();
 
         if (empty($this->contents)) {
@@ -335,16 +340,16 @@ class KTPage {
             $this->addError(_kt("This page did not produce any content"));
             $this->contents = "";
         }
-		
+
 	if (!is_string($this->contents)) {
 	    $this->contents = $this->contents->render();
 	}
-		
+
 	// if we have no portlets, make the ui a tad nicer.
 	if (empty($this->portlets)) {
 	    $this->show_portlets = false;
 	}
-		
+
 	if (empty($this->title)) {
 	    if (!empty($this->breadcrumbDetails)) {
 		$this->title = $this->breadcrumbDetails;
@@ -357,9 +362,9 @@ class KTPage {
 		$this->title = $this->componentLabel;
 	    }
 	}
-		
+
 	$this->userMenu = array();
-	if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {	    
+	if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
 	    if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) {
 		$this->userMenu = array("logout" => $this->_actionHelper(array("name" => _kt("Logout"), "action" => "logout", "active" => 0)),);
 	    } else {
@@ -369,24 +374,24 @@ class KTPage {
 	    }
 	} else {
 	    $this->userMenu = array("login" => $this->_actionHelper(array("name" => _kt("Login"), "action" => "login")),);
-	}		
-		
+	}
+
 	// FIXME we need a more complete solution to navigation restriction
 	if (!is_null($this->menu['administration']) && !is_null($this->user)) {
 	    if (!Permission::userIsSystemAdministrator($this->user->getId())) {
 		unset($this->menu['administration']);
 	    }
 	}
-	
+
 	$sContentType = 'Content-type: ' . $this->contentType;
 	if(!empty($this->charset)) {
 	    $sContentType .= '; charset=' . $this->charset;
 	};
-    
+
 
 	header($sContentType);
-		
-        $oTemplating =& KTTemplating::getSingleton();        
+
+        $oTemplating =& KTTemplating::getSingleton();
         $oTemplate = $oTemplating->loadTemplate($this->template);
         $aTemplateData = array("page" => $this,
 			       "systemversion" => $default->systemVersion,
@@ -394,17 +399,17 @@ class KTPage {
         if ($oConfig->get("ui/automaticRefresh", false)) {
             $aTemplateData['refreshTimeout'] = (int)$oConfig->get("session/sessionTimeout") + 3;
         }
-        
+
         // unlike the rest of KT, we use echo here.
         echo $oTemplate->render($aTemplateData);
     }
-    
+
 
 	/**   heler functions */
 	// returns an array ("url", "label")
     function _actionhelper($aActionTuple) {
         $aTuple = Array("label" => $aActionTuple["name"]);
-        if ($aActionTuple["action"]) {        
+        if ($aActionTuple["action"]) {
            $aTuple["url"] = generateControllerLink($aActionTuple["action"], $aActionTuple["query"]);
         } else if ($aActionTuple["url"]) {
            $sUrl = $aActionTuple["url"];
@@ -418,22 +423,22 @@ class KTPage {
 		} else {
 		   $aTuple["url"] = false;
 		}
-		
+
 		return $aTuple;
     }
-    
+
     function setHelp($sHelpPage) {
 	$this->helpPage = $sHelpPage;
     }
-	
+
     function getHelpURL() {
-	if (empty($this->helpPage)) { 
+	if (empty($this->helpPage)) {
 	    return null;
 	}
-	
-	return KTUtil::ktLink('help.php',$this->helpPage); 
+
+	return KTUtil::ktLink('help.php',$this->helpPage);
     }
-	
+
     function getReqTime() {
         $microtime_simple = explode(' ', microtime());
         $finaltime = (float) $microtime_simple[1] + (float) $microtime_simple[0];
@@ -449,7 +454,7 @@ class KTPage {
             return;
         }
     }
-	
+
 }
 
 ?>
diff --git a/lib/templating/templating.inc.php b/lib/templating/templating.inc.php
index 3728078..69f24c9 100644
--- a/lib/templating/templating.inc.php
+++ b/lib/templating/templating.inc.php
@@ -8,7 +8,7 @@
  * License Version 1.1.2 ("License"); You may not use this file except in
  * compliance with the License. You may obtain a copy of the License at
  * http://www.knowledgetree.com/KPL
- * 
+ *
  * Software distributed under the License is distributed on an "AS IS"
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  * See the License for the specific language governing rights and
@@ -19,9 +19,9 @@
  *    (ii) the KnowledgeTree copyright notice
  * in the same form as they appear in the distribution.  See the License for
  * requirements.
- * 
+ *
  * The Original Code is: KnowledgeTree Open Source
- * 
+ *
  * The Initial Developer of the Original Code is The Jam Warehouse Software
  * (Pty) Ltd, trading as KnowledgeTree.
  * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -38,7 +38,7 @@ class KTTemplating {
 
     /** Location registry */
     var $aLocationRegistry;
-    
+
     // {{{ KTTemplating
     function KTTemplating() {
         $this->aTemplateRegistry = array(
@@ -88,7 +88,7 @@ class KTTemplating {
         return $this->_chooseTemplate($templatename, $aPossibilities);
     }
     // }}}
-    
+
     // {{{ loadTemplate
     /**
      * Create an object that conforms to the template interface, using
@@ -108,15 +108,32 @@ class KTTemplating {
         if (!class_exists($sClass)) {
             return PEAR::raiseError(_kt("Could not find template language"));
         }
-        
+
         $oTemplate =& new $sClass($sTemplatePath);
         return $oTemplate;
     }
     // }}}
 
     // {{{ addLocation
+    /**
+     * Register a new location in the database
+     *
+     * @param unknown_type $descr
+     * @param unknown_type $loc
+     */
     function addLocation ($descr, $loc) {
         $this->aLocationRegistry[$descr] = $loc;
+        KTPlugin::registerPluginHelper($descr, $descr, $loc, $descr.'|'.$loc, 'general', 'locations');
+    }
+
+    /**
+     * Add the template location to the location registry
+     *
+     * @param unknown_type $descr
+     * @param unknown_type $loc
+     */
+    function addLocation2 ($descr, $loc) {
+        $this->aLocationRegistry[$descr] = $loc;
     }
     // }}}
 
diff --git a/sql/mysql/install/structure.sql b/sql/mysql/install/structure.sql
index c807f3e..d191be4 100644
--- a/sql/mysql/install/structure.sql
+++ b/sql/mysql/install/structure.sql
@@ -1,11 +1,11 @@
 --
 -- $Id$
---    
+--
 -- The contents of this file are subject to the KnowledgeTree Public
 -- License Version 1.1.2 ("License"); You may not use this file except in
 -- compliance with the License. You may obtain a copy of the License at
 -- http://www.knowledgetree.com/KPL
--- 
+--
 -- Software distributed under the License is distributed on an "AS IS"
 -- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
 -- See the License for the specific language governing rights and
@@ -16,9 +16,9 @@
 --    (ii) the KnowledgeTree copyright notice
 -- in the same form as they appear in the distribution.  See the License for
 -- requirements.
--- 
+--
 -- The Original Code is: KnowledgeTree Open Source
--- 
+--
 -- The Initial Developer of the Original Code is The Jam Warehouse Software
 -- (Pty) Ltd, trading as KnowledgeTree.
 -- Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
@@ -28,15 +28,15 @@
 --
 
 SET FOREIGN_KEY_CHECKS=0;
--- 
+--
 -- Database: `pristine`
--- 
+--
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `active_sessions`
--- 
+--
 
 CREATE TABLE `active_sessions` (
   `id` int(11) NOT NULL default '0',
@@ -50,9 +50,9 @@ CREATE TABLE `active_sessions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `archive_restoration_request`
--- 
+--
 
 CREATE TABLE `archive_restoration_request` (
   `id` int(11) NOT NULL default '0',
@@ -65,9 +65,9 @@ CREATE TABLE `archive_restoration_request` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `archiving_settings`
--- 
+--
 
 CREATE TABLE `archiving_settings` (
   `id` int(11) NOT NULL default '0',
@@ -80,9 +80,9 @@ CREATE TABLE `archiving_settings` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `archiving_type_lookup`
--- 
+--
 
 CREATE TABLE `archiving_type_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -92,9 +92,9 @@ CREATE TABLE `archiving_type_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `authentication_sources`
--- 
+--
 
 CREATE TABLE `authentication_sources` (
   `id` int(11) NOT NULL default '0',
@@ -110,9 +110,9 @@ CREATE TABLE `authentication_sources` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `column_entries`
--- 
+--
 
 CREATE TABLE `column_entries` (
   `id` int(11) NOT NULL default '0',
@@ -127,9 +127,9 @@ CREATE TABLE `column_entries` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `comment_searchable_text`
--- 
+--
 
 CREATE TABLE `comment_searchable_text` (
   `comment_id` int(11) NOT NULL default '0',
@@ -141,9 +141,9 @@ CREATE TABLE `comment_searchable_text` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `dashlet_disables`
--- 
+--
 
 CREATE TABLE `dashlet_disables` (
   `id` int(11) NOT NULL default '0',
@@ -156,9 +156,9 @@ CREATE TABLE `dashlet_disables` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `data_types`
--- 
+--
 
 CREATE TABLE `data_types` (
   `id` int(11) NOT NULL default '0',
@@ -168,9 +168,9 @@ CREATE TABLE `data_types` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `discussion_comments`
--- 
+--
 
 CREATE TABLE `discussion_comments` (
   `id` int(11) NOT NULL default '0',
@@ -185,9 +185,9 @@ CREATE TABLE `discussion_comments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `discussion_threads`
--- 
+--
 
 CREATE TABLE `discussion_threads` (
   `id` int(11) NOT NULL default '0',
@@ -205,9 +205,9 @@ CREATE TABLE `discussion_threads` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_archiving_link`
--- 
+--
 
 CREATE TABLE `document_archiving_link` (
   `id` int(11) NOT NULL default '0',
@@ -218,9 +218,9 @@ CREATE TABLE `document_archiving_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_content_version`
--- 
+--
 
 CREATE TABLE `document_content_version` (
   `id` int(11) NOT NULL default '0',
@@ -238,9 +238,9 @@ CREATE TABLE `document_content_version` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_fields`
--- 
+--
 
 CREATE TABLE `document_fields` (
   `id` int(11) NOT NULL default '0',
@@ -258,9 +258,9 @@ CREATE TABLE `document_fields` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_fields_link`
--- 
+--
 
 CREATE TABLE `document_fields_link` (
   `id` int(11) NOT NULL default '0',
@@ -274,9 +274,9 @@ CREATE TABLE `document_fields_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_incomplete`
--- 
+--
 
 CREATE TABLE `document_incomplete` (
   `id` int(10) unsigned NOT NULL default '0',
@@ -287,9 +287,9 @@ CREATE TABLE `document_incomplete` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_link`
--- 
+--
 
 CREATE TABLE `document_link` (
   `id` int(11) NOT NULL default '0',
@@ -301,9 +301,9 @@ CREATE TABLE `document_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_link_types`
--- 
+--
 
 CREATE TABLE `document_link_types` (
   `id` int(11) NOT NULL default '0',
@@ -315,9 +315,9 @@ CREATE TABLE `document_link_types` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_metadata_version`
--- 
+--
 
 CREATE TABLE `document_metadata_version` (
   `id` int(11) NOT NULL default '0',
@@ -345,9 +345,9 @@ CREATE TABLE `document_metadata_version` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_role_allocations`
--- 
+--
 
 CREATE TABLE `document_role_allocations` (
   `id` int(11) NOT NULL default '0',
@@ -360,9 +360,9 @@ CREATE TABLE `document_role_allocations` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_searchable_text`
--- 
+--
 
 CREATE TABLE `document_searchable_text` (
   `document_id` int(11) default NULL,
@@ -373,9 +373,9 @@ CREATE TABLE `document_searchable_text` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_subscriptions`
--- 
+--
 
 CREATE TABLE `document_subscriptions` (
   `id` int(11) NOT NULL default '0',
@@ -387,9 +387,9 @@ CREATE TABLE `document_subscriptions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_text`
--- 
+--
 
 CREATE TABLE `document_text` (
   `document_id` int(11) default NULL,
@@ -400,9 +400,9 @@ CREATE TABLE `document_text` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_transaction_text`
--- 
+--
 
 CREATE TABLE `document_transaction_text` (
   `document_id` int(11) default NULL,
@@ -413,9 +413,9 @@ CREATE TABLE `document_transaction_text` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_transaction_types_lookup`
--- 
+--
 
 CREATE TABLE `document_transaction_types_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -427,9 +427,9 @@ CREATE TABLE `document_transaction_types_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_transactions`
--- 
+--
 
 CREATE TABLE `document_transactions` (
   `id` int(11) NOT NULL default '0',
@@ -451,9 +451,9 @@ CREATE TABLE `document_transactions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_type_fields_link`
--- 
+--
 
 CREATE TABLE `document_type_fields_link` (
   `id` int(11) NOT NULL default '0',
@@ -465,9 +465,9 @@ CREATE TABLE `document_type_fields_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_type_fieldsets_link`
--- 
+--
 
 CREATE TABLE `document_type_fieldsets_link` (
   `id` int(11) NOT NULL default '0',
@@ -480,9 +480,9 @@ CREATE TABLE `document_type_fieldsets_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `document_types_lookup`
--- 
+--
 
 CREATE TABLE `document_types_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -495,9 +495,9 @@ CREATE TABLE `document_types_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `documents`
--- 
+--
 
 CREATE TABLE `documents` (
   `id` int(11) NOT NULL default '0',
@@ -533,9 +533,9 @@ CREATE TABLE `documents` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `field_behaviour_options`
--- 
+--
 
 CREATE TABLE `field_behaviour_options` (
   `behaviour_id` int(11) NOT NULL default '0',
@@ -548,9 +548,9 @@ CREATE TABLE `field_behaviour_options` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `field_behaviours`
--- 
+--
 
 CREATE TABLE `field_behaviours` (
   `id` int(11) NOT NULL default '0',
@@ -564,9 +564,9 @@ CREATE TABLE `field_behaviours` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `field_orders`
--- 
+--
 
 CREATE TABLE `field_orders` (
   `parent_field_id` int(11) NOT NULL default '0',
@@ -579,9 +579,9 @@ CREATE TABLE `field_orders` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `field_value_instances`
--- 
+--
 
 CREATE TABLE `field_value_instances` (
   `id` int(11) NOT NULL default '0',
@@ -596,9 +596,9 @@ CREATE TABLE `field_value_instances` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `fieldsets`
--- 
+--
 
 CREATE TABLE `fieldsets` (
   `id` int(11) NOT NULL default '0',
@@ -621,9 +621,9 @@ CREATE TABLE `fieldsets` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folder_doctypes_link`
--- 
+--
 
 CREATE TABLE `folder_doctypes_link` (
   `id` int(11) NOT NULL default '0',
@@ -636,9 +636,9 @@ CREATE TABLE `folder_doctypes_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folder_searchable_text`
--- 
+--
 
 CREATE TABLE `folder_searchable_text` (
   `folder_id` int(11) NOT NULL default '0',
@@ -650,9 +650,9 @@ CREATE TABLE `folder_searchable_text` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folder_subscriptions`
--- 
+--
 
 CREATE TABLE `folder_subscriptions` (
   `id` int(11) NOT NULL default '0',
@@ -664,9 +664,9 @@ CREATE TABLE `folder_subscriptions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folder_transactions`
--- 
+--
 
 CREATE TABLE `folder_transactions` (
   `id` int(11) NOT NULL default '0',
@@ -686,9 +686,9 @@ CREATE TABLE `folder_transactions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folder_workflow_map`
--- 
+--
 
 CREATE TABLE `folder_workflow_map` (
   `folder_id` int(11) NOT NULL default '0',
@@ -699,9 +699,9 @@ CREATE TABLE `folder_workflow_map` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folders`
--- 
+--
 
 CREATE TABLE `folders` (
   `id` int(11) NOT NULL default '0',
@@ -725,9 +725,9 @@ CREATE TABLE `folders` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `folders_users_roles_link`
--- 
+--
 
 CREATE TABLE `folders_users_roles_link` (
   `id` int(11) NOT NULL default '0',
@@ -743,9 +743,9 @@ CREATE TABLE `folders_users_roles_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `groups_groups_link`
--- 
+--
 
 CREATE TABLE `groups_groups_link` (
   `id` int(11) NOT NULL default '0',
@@ -758,9 +758,9 @@ CREATE TABLE `groups_groups_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `groups_lookup`
--- 
+--
 
 CREATE TABLE `groups_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -780,9 +780,9 @@ CREATE TABLE `groups_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `help`
--- 
+--
 
 CREATE TABLE `help` (
   `id` int(11) NOT NULL default '0',
@@ -793,9 +793,9 @@ CREATE TABLE `help` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `help_replacement`
--- 
+--
 
 CREATE TABLE `help_replacement` (
   `id` int(11) NOT NULL default '0',
@@ -807,9 +807,9 @@ CREATE TABLE `help_replacement` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `interceptor_instances`
--- 
+--
 
 CREATE TABLE `interceptor_instances` (
   `id` int(11) NOT NULL,
@@ -822,9 +822,9 @@ CREATE TABLE `interceptor_instances` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `links`
--- 
+--
 
 CREATE TABLE `links` (
   `id` int(11) NOT NULL default '0',
@@ -836,9 +836,9 @@ CREATE TABLE `links` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `metadata_lookup`
--- 
+--
 
 CREATE TABLE `metadata_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -854,9 +854,9 @@ CREATE TABLE `metadata_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `metadata_lookup_tree`
--- 
+--
 
 CREATE TABLE `metadata_lookup_tree` (
   `id` int(11) NOT NULL default '0',
@@ -870,9 +870,9 @@ CREATE TABLE `metadata_lookup_tree` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `mime_types`
--- 
+--
 
 CREATE TABLE `mime_types` (
   `id` int(11) NOT NULL default '0',
@@ -885,9 +885,9 @@ CREATE TABLE `mime_types` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `news`
--- 
+--
 
 CREATE TABLE `news` (
   `id` int(11) NOT NULL default '0',
@@ -903,9 +903,9 @@ CREATE TABLE `news` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `notifications`
--- 
+--
 
 CREATE TABLE `notifications` (
   `id` int(11) NOT NULL default '0',
@@ -925,9 +925,9 @@ CREATE TABLE `notifications` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `organisations_lookup`
--- 
+--
 
 CREATE TABLE `organisations_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -938,9 +938,9 @@ CREATE TABLE `organisations_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_assignments`
--- 
+--
 
 CREATE TABLE `permission_assignments` (
   `id` int(11) NOT NULL default '0',
@@ -956,9 +956,9 @@ CREATE TABLE `permission_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_descriptor_groups`
--- 
+--
 
 CREATE TABLE `permission_descriptor_groups` (
   `descriptor_id` int(11) NOT NULL default '0',
@@ -970,9 +970,9 @@ CREATE TABLE `permission_descriptor_groups` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_descriptor_roles`
--- 
+--
 
 CREATE TABLE `permission_descriptor_roles` (
   `descriptor_id` int(11) NOT NULL default '0',
@@ -984,9 +984,9 @@ CREATE TABLE `permission_descriptor_roles` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_descriptor_users`
--- 
+--
 
 CREATE TABLE `permission_descriptor_users` (
   `descriptor_id` int(11) NOT NULL default '0',
@@ -998,9 +998,9 @@ CREATE TABLE `permission_descriptor_users` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_descriptors`
--- 
+--
 
 CREATE TABLE `permission_descriptors` (
   `id` int(11) NOT NULL default '0',
@@ -1013,9 +1013,9 @@ CREATE TABLE `permission_descriptors` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_dynamic_assignments`
--- 
+--
 
 CREATE TABLE `permission_dynamic_assignments` (
   `dynamic_condition_id` int(11) NOT NULL default '0',
@@ -1026,9 +1026,9 @@ CREATE TABLE `permission_dynamic_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_dynamic_conditions`
--- 
+--
 
 CREATE TABLE `permission_dynamic_conditions` (
   `id` int(11) NOT NULL default '0',
@@ -1043,9 +1043,9 @@ CREATE TABLE `permission_dynamic_conditions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_lookup_assignments`
--- 
+--
 
 CREATE TABLE `permission_lookup_assignments` (
   `id` int(11) NOT NULL default '0',
@@ -1061,9 +1061,9 @@ CREATE TABLE `permission_lookup_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_lookups`
--- 
+--
 
 CREATE TABLE `permission_lookups` (
   `id` int(11) NOT NULL default '0',
@@ -1072,9 +1072,9 @@ CREATE TABLE `permission_lookups` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permission_objects`
--- 
+--
 
 CREATE TABLE `permission_objects` (
   `id` int(11) NOT NULL default '0',
@@ -1083,9 +1083,9 @@ CREATE TABLE `permission_objects` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `permissions`
--- 
+--
 
 CREATE TABLE `permissions` (
   `id` int(11) NOT NULL default '0',
@@ -1098,9 +1098,9 @@ CREATE TABLE `permissions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `plugins`
--- 
+--
 
 CREATE TABLE `plugins` (
   `id` int(11) NOT NULL default '0',
@@ -1117,9 +1117,30 @@ CREATE TABLE `plugins` (
 
 -- --------------------------------------------------------
 
--- 
+--
+-- Table structure for table `plugin_helper`
+--
+
+CREATE TABLE `plugin_helper` (
+	`id` INT NOT NULL default '0',
+	`namespace` VARCHAR(120) NOT NULL,
+	`plugin` VARCHAR(120) NOT NULL,
+	`classname` VARCHAR(120),
+	`pathname` VARCHAR(255),
+	`object` VARCHAR(1000) NOT NULL,
+	`classtype` VARCHAR(120) NOT NULL,
+	`viewtype` ENUM('general', 'dashboard', 'plugin', 'folder', 'document', 'admindispatcher', 'dispatcher') NOT NULL default 'general',
+    PRIMARY KEY  (`id`),
+    KEY `name` (`namespace`),
+    KEY `parent` (`plugin`),
+    KEY `view` (`viewtype`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- --------------------------------------------------------
+
+--
 -- Table structure for table `role_allocations`
--- 
+--
 
 CREATE TABLE `role_allocations` (
   `id` int(11) NOT NULL default '0',
@@ -1132,9 +1153,9 @@ CREATE TABLE `role_allocations` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `roles`
--- 
+--
 
 CREATE TABLE `roles` (
   `id` int(11) NOT NULL default '0',
@@ -1145,9 +1166,9 @@ CREATE TABLE `roles` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `saved_searches`
--- 
+--
 
 CREATE TABLE `saved_searches` (
   `id` int(11) NOT NULL default '0',
@@ -1166,9 +1187,9 @@ CREATE TABLE `saved_searches` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `search_document_user_link`
--- 
+--
 
 CREATE TABLE `search_document_user_link` (
   `document_id` int(11) default NULL,
@@ -1179,9 +1200,9 @@ CREATE TABLE `search_document_user_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `status_lookup`
--- 
+--
 
 CREATE TABLE `status_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -1191,9 +1212,9 @@ CREATE TABLE `status_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `system_settings`
--- 
+--
 
 CREATE TABLE `system_settings` (
   `id` int(11) NOT NULL default '0',
@@ -1204,9 +1225,9 @@ CREATE TABLE `system_settings` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `time_period`
--- 
+--
 
 CREATE TABLE `time_period` (
   `id` int(11) NOT NULL default '0',
@@ -1217,9 +1238,9 @@ CREATE TABLE `time_period` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `time_unit_lookup`
--- 
+--
 
 CREATE TABLE `time_unit_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -1229,9 +1250,9 @@ CREATE TABLE `time_unit_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `trigger_selection`
--- 
+--
 
 CREATE TABLE `trigger_selection` (
   `event_ns` varchar(255) NOT NULL default '',
@@ -1242,9 +1263,9 @@ CREATE TABLE `trigger_selection` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `type_workflow_map`
--- 
+--
 
 CREATE TABLE `type_workflow_map` (
   `document_type_id` int(11) NOT NULL default '0',
@@ -1255,9 +1276,9 @@ CREATE TABLE `type_workflow_map` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `units_lookup`
--- 
+--
 
 CREATE TABLE `units_lookup` (
   `id` int(11) NOT NULL default '0',
@@ -1270,9 +1291,9 @@ CREATE TABLE `units_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `units_organisations_link`
--- 
+--
 
 CREATE TABLE `units_organisations_link` (
   `id` int(11) NOT NULL default '0',
@@ -1285,9 +1306,9 @@ CREATE TABLE `units_organisations_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `upgrades`
--- 
+--
 
 CREATE TABLE `upgrades` (
   `id` int(10) unsigned NOT NULL default '0',
@@ -1303,9 +1324,9 @@ CREATE TABLE `upgrades` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `user_history`
--- 
+--
 
 CREATE TABLE `user_history` (
   `id` int(11) NOT NULL,
@@ -1323,9 +1344,9 @@ CREATE TABLE `user_history` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `users`
--- 
+--
 
 CREATE TABLE `users` (
   `id` int(11) NOT NULL default '0',
@@ -1362,9 +1383,9 @@ CREATE TABLE `users` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `users_groups_link`
--- 
+--
 
 CREATE TABLE `users_groups_link` (
   `id` int(11) NOT NULL default '0',
@@ -1377,9 +1398,9 @@ CREATE TABLE `users_groups_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_actions`
--- 
+--
 
 CREATE TABLE `workflow_actions` (
   `workflow_id` int(11) NOT NULL default '0',
@@ -1390,9 +1411,9 @@ CREATE TABLE `workflow_actions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_documents`
--- 
+--
 
 CREATE TABLE `workflow_documents` (
   `document_id` int(11) NOT NULL default '0',
@@ -1405,9 +1426,9 @@ CREATE TABLE `workflow_documents` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_state_actions`
--- 
+--
 
 CREATE TABLE `workflow_state_actions` (
   `state_id` int(11) NOT NULL default '0',
@@ -1418,9 +1439,9 @@ CREATE TABLE `workflow_state_actions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_state_disabled_actions`
--- 
+--
 
 CREATE TABLE `workflow_state_disabled_actions` (
   `state_id` int(11) NOT NULL default '0',
@@ -1431,9 +1452,9 @@ CREATE TABLE `workflow_state_disabled_actions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_state_permission_assignments`
--- 
+--
 
 CREATE TABLE `workflow_state_permission_assignments` (
   `id` int(11) NOT NULL default '0',
@@ -1448,9 +1469,9 @@ CREATE TABLE `workflow_state_permission_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_state_transitions`
--- 
+--
 
 CREATE TABLE `workflow_state_transitions` (
   `state_id` int(11) NOT NULL default '0',
@@ -1459,9 +1480,9 @@ CREATE TABLE `workflow_state_transitions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_states`
--- 
+--
 
 CREATE TABLE `workflow_states` (
   `id` int(11) NOT NULL default '0',
@@ -1479,9 +1500,9 @@ CREATE TABLE `workflow_states` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_transitions`
--- 
+--
 
 CREATE TABLE `workflow_transitions` (
   `id` int(11) NOT NULL default '0',
@@ -1506,9 +1527,9 @@ CREATE TABLE `workflow_transitions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflow_trigger_instances`
--- 
+--
 
 CREATE TABLE `workflow_trigger_instances` (
   `id` int(10) unsigned NOT NULL default '0',
@@ -1522,9 +1543,9 @@ CREATE TABLE `workflow_trigger_instances` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `workflows`
--- 
+--
 
 CREATE TABLE `workflows` (
   `id` int(11) NOT NULL default '0',
@@ -1539,9 +1560,9 @@ CREATE TABLE `workflows` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_active_sessions`
--- 
+--
 
 CREATE TABLE `zseq_active_sessions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1550,9 +1571,9 @@ CREATE TABLE `zseq_active_sessions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_archive_restoration_request`
--- 
+--
 
 CREATE TABLE `zseq_archive_restoration_request` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1561,9 +1582,9 @@ CREATE TABLE `zseq_archive_restoration_request` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_archiving_settings`
--- 
+--
 
 CREATE TABLE `zseq_archiving_settings` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1572,9 +1593,9 @@ CREATE TABLE `zseq_archiving_settings` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_archiving_type_lookup`
--- 
+--
 
 CREATE TABLE `zseq_archiving_type_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1583,9 +1604,9 @@ CREATE TABLE `zseq_archiving_type_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_authentication_sources`
--- 
+--
 
 CREATE TABLE `zseq_authentication_sources` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1594,9 +1615,9 @@ CREATE TABLE `zseq_authentication_sources` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_browse_criteria`
--- 
+--
 
 CREATE TABLE `zseq_browse_criteria` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1605,9 +1626,9 @@ CREATE TABLE `zseq_browse_criteria` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_column_entries`
--- 
+--
 
 CREATE TABLE `zseq_column_entries` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1616,9 +1637,9 @@ CREATE TABLE `zseq_column_entries` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_dashlet_disables`
--- 
+--
 
 CREATE TABLE `zseq_dashlet_disables` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1627,9 +1648,9 @@ CREATE TABLE `zseq_dashlet_disables` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_data_types`
--- 
+--
 
 CREATE TABLE `zseq_data_types` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1638,9 +1659,9 @@ CREATE TABLE `zseq_data_types` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_dependant_document_instance`
--- 
+--
 
 CREATE TABLE `zseq_dependant_document_instance` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1649,9 +1670,9 @@ CREATE TABLE `zseq_dependant_document_instance` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_dependant_document_template`
--- 
+--
 
 CREATE TABLE `zseq_dependant_document_template` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1660,9 +1681,9 @@ CREATE TABLE `zseq_dependant_document_template` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_discussion_comments`
--- 
+--
 
 CREATE TABLE `zseq_discussion_comments` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1671,9 +1692,9 @@ CREATE TABLE `zseq_discussion_comments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_discussion_threads`
--- 
+--
 
 CREATE TABLE `zseq_discussion_threads` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1682,9 +1703,9 @@ CREATE TABLE `zseq_discussion_threads` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_archiving_link`
--- 
+--
 
 CREATE TABLE `zseq_document_archiving_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1693,9 +1714,9 @@ CREATE TABLE `zseq_document_archiving_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_content_version`
--- 
+--
 
 CREATE TABLE `zseq_document_content_version` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1704,9 +1725,9 @@ CREATE TABLE `zseq_document_content_version` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_fields`
--- 
+--
 
 CREATE TABLE `zseq_document_fields` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1715,9 +1736,9 @@ CREATE TABLE `zseq_document_fields` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_fields_link`
--- 
+--
 
 CREATE TABLE `zseq_document_fields_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1726,9 +1747,9 @@ CREATE TABLE `zseq_document_fields_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_link`
--- 
+--
 
 CREATE TABLE `zseq_document_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1737,9 +1758,9 @@ CREATE TABLE `zseq_document_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_link_types`
--- 
+--
 
 CREATE TABLE `zseq_document_link_types` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1748,9 +1769,9 @@ CREATE TABLE `zseq_document_link_types` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_metadata_version`
--- 
+--
 
 CREATE TABLE `zseq_document_metadata_version` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1759,9 +1780,9 @@ CREATE TABLE `zseq_document_metadata_version` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_role_allocations`
--- 
+--
 
 CREATE TABLE `zseq_document_role_allocations` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1770,9 +1791,9 @@ CREATE TABLE `zseq_document_role_allocations` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_subscriptions`
--- 
+--
 
 CREATE TABLE `zseq_document_subscriptions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1781,9 +1802,9 @@ CREATE TABLE `zseq_document_subscriptions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_transaction_types_lookup`
--- 
+--
 
 CREATE TABLE `zseq_document_transaction_types_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1792,9 +1813,9 @@ CREATE TABLE `zseq_document_transaction_types_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_transactions`
--- 
+--
 
 CREATE TABLE `zseq_document_transactions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1803,9 +1824,9 @@ CREATE TABLE `zseq_document_transactions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_type_fields_link`
--- 
+--
 
 CREATE TABLE `zseq_document_type_fields_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1814,9 +1835,9 @@ CREATE TABLE `zseq_document_type_fields_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_type_fieldsets_link`
--- 
+--
 
 CREATE TABLE `zseq_document_type_fieldsets_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1825,9 +1846,9 @@ CREATE TABLE `zseq_document_type_fieldsets_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_document_types_lookup`
--- 
+--
 
 CREATE TABLE `zseq_document_types_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1836,9 +1857,9 @@ CREATE TABLE `zseq_document_types_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_documents`
--- 
+--
 
 CREATE TABLE `zseq_documents` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1847,9 +1868,9 @@ CREATE TABLE `zseq_documents` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_field_behaviours`
--- 
+--
 
 CREATE TABLE `zseq_field_behaviours` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1858,9 +1879,9 @@ CREATE TABLE `zseq_field_behaviours` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_field_value_instances`
--- 
+--
 
 CREATE TABLE `zseq_field_value_instances` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1869,9 +1890,9 @@ CREATE TABLE `zseq_field_value_instances` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_fieldsets`
--- 
+--
 
 CREATE TABLE `zseq_fieldsets` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1880,9 +1901,9 @@ CREATE TABLE `zseq_fieldsets` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_folder_doctypes_link`
--- 
+--
 
 CREATE TABLE `zseq_folder_doctypes_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1891,9 +1912,9 @@ CREATE TABLE `zseq_folder_doctypes_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_folder_subscriptions`
--- 
+--
 
 CREATE TABLE `zseq_folder_subscriptions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1902,9 +1923,9 @@ CREATE TABLE `zseq_folder_subscriptions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_folder_transactions`
--- 
+--
 
 CREATE TABLE `zseq_folder_transactions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1913,9 +1934,9 @@ CREATE TABLE `zseq_folder_transactions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_folders`
--- 
+--
 
 CREATE TABLE `zseq_folders` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1924,9 +1945,9 @@ CREATE TABLE `zseq_folders` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_folders_users_roles_link`
--- 
+--
 
 CREATE TABLE `zseq_folders_users_roles_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1935,9 +1956,9 @@ CREATE TABLE `zseq_folders_users_roles_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_groups_groups_link`
--- 
+--
 
 CREATE TABLE `zseq_groups_groups_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1946,9 +1967,9 @@ CREATE TABLE `zseq_groups_groups_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_groups_lookup`
--- 
+--
 
 CREATE TABLE `zseq_groups_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1957,9 +1978,9 @@ CREATE TABLE `zseq_groups_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_help`
--- 
+--
 
 CREATE TABLE `zseq_help` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1968,9 +1989,9 @@ CREATE TABLE `zseq_help` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_help_replacement`
--- 
+--
 
 CREATE TABLE `zseq_help_replacement` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1979,9 +2000,9 @@ CREATE TABLE `zseq_help_replacement` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_interceptor_instances`
--- 
+--
 
 CREATE TABLE `zseq_interceptor_instances` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -1990,9 +2011,9 @@ CREATE TABLE `zseq_interceptor_instances` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_links`
--- 
+--
 
 CREATE TABLE `zseq_links` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2001,9 +2022,9 @@ CREATE TABLE `zseq_links` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_metadata_lookup`
--- 
+--
 
 CREATE TABLE `zseq_metadata_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2012,9 +2033,9 @@ CREATE TABLE `zseq_metadata_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_metadata_lookup_tree`
--- 
+--
 
 CREATE TABLE `zseq_metadata_lookup_tree` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2023,9 +2044,9 @@ CREATE TABLE `zseq_metadata_lookup_tree` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_mime_types`
--- 
+--
 
 CREATE TABLE `zseq_mime_types` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2034,9 +2055,9 @@ CREATE TABLE `zseq_mime_types` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_news`
--- 
+--
 
 CREATE TABLE `zseq_news` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2045,9 +2066,9 @@ CREATE TABLE `zseq_news` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_notifications`
--- 
+--
 
 CREATE TABLE `zseq_notifications` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2056,9 +2077,9 @@ CREATE TABLE `zseq_notifications` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_organisations_lookup`
--- 
+--
 
 CREATE TABLE `zseq_organisations_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2067,9 +2088,9 @@ CREATE TABLE `zseq_organisations_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permission_assignments`
--- 
+--
 
 CREATE TABLE `zseq_permission_assignments` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2078,9 +2099,9 @@ CREATE TABLE `zseq_permission_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permission_descriptors`
--- 
+--
 
 CREATE TABLE `zseq_permission_descriptors` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2089,9 +2110,9 @@ CREATE TABLE `zseq_permission_descriptors` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permission_dynamic_conditions`
--- 
+--
 
 CREATE TABLE `zseq_permission_dynamic_conditions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2100,9 +2121,9 @@ CREATE TABLE `zseq_permission_dynamic_conditions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permission_lookup_assignments`
--- 
+--
 
 CREATE TABLE `zseq_permission_lookup_assignments` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2111,9 +2132,9 @@ CREATE TABLE `zseq_permission_lookup_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permission_lookups`
--- 
+--
 
 CREATE TABLE `zseq_permission_lookups` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2122,9 +2143,9 @@ CREATE TABLE `zseq_permission_lookups` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permission_objects`
--- 
+--
 
 CREATE TABLE `zseq_permission_objects` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2133,9 +2154,9 @@ CREATE TABLE `zseq_permission_objects` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_permissions`
--- 
+--
 
 CREATE TABLE `zseq_permissions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2144,9 +2165,9 @@ CREATE TABLE `zseq_permissions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_plugins`
--- 
+--
 
 CREATE TABLE `zseq_plugins` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2155,9 +2176,20 @@ CREATE TABLE `zseq_plugins` (
 
 -- --------------------------------------------------------
 
--- 
+--
+-- Table structure for table `zseq_plugin_helper`
+--
+
+CREATE TABLE `zseq_plugin_helper` (
+  `id` int(10) unsigned NOT NULL auto_increment,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- --------------------------------------------------------
+
+--
 -- Table structure for table `zseq_role_allocations`
--- 
+--
 
 CREATE TABLE `zseq_role_allocations` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2166,9 +2198,9 @@ CREATE TABLE `zseq_role_allocations` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_roles`
--- 
+--
 
 CREATE TABLE `zseq_roles` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2177,9 +2209,9 @@ CREATE TABLE `zseq_roles` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_saved_searches`
--- 
+--
 
 CREATE TABLE `zseq_saved_searches` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2188,9 +2220,9 @@ CREATE TABLE `zseq_saved_searches` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_status_lookup`
--- 
+--
 
 CREATE TABLE `zseq_status_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2199,9 +2231,9 @@ CREATE TABLE `zseq_status_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_system_settings`
--- 
+--
 
 CREATE TABLE `zseq_system_settings` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2210,9 +2242,9 @@ CREATE TABLE `zseq_system_settings` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_time_period`
--- 
+--
 
 CREATE TABLE `zseq_time_period` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2221,9 +2253,9 @@ CREATE TABLE `zseq_time_period` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_time_unit_lookup`
--- 
+--
 
 CREATE TABLE `zseq_time_unit_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2232,9 +2264,9 @@ CREATE TABLE `zseq_time_unit_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_units_lookup`
--- 
+--
 
 CREATE TABLE `zseq_units_lookup` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2243,9 +2275,9 @@ CREATE TABLE `zseq_units_lookup` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_units_organisations_link`
--- 
+--
 
 CREATE TABLE `zseq_units_organisations_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2254,9 +2286,9 @@ CREATE TABLE `zseq_units_organisations_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_upgrades`
--- 
+--
 
 CREATE TABLE `zseq_upgrades` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2265,9 +2297,9 @@ CREATE TABLE `zseq_upgrades` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_user_history`
--- 
+--
 
 CREATE TABLE `zseq_user_history` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2276,9 +2308,9 @@ CREATE TABLE `zseq_user_history` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_users`
--- 
+--
 
 CREATE TABLE `zseq_users` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2287,9 +2319,9 @@ CREATE TABLE `zseq_users` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_users_groups_link`
--- 
+--
 
 CREATE TABLE `zseq_users_groups_link` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2298,9 +2330,9 @@ CREATE TABLE `zseq_users_groups_link` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_workflow_state_disabled_actions`
--- 
+--
 
 CREATE TABLE `zseq_workflow_state_disabled_actions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2309,9 +2341,9 @@ CREATE TABLE `zseq_workflow_state_disabled_actions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_workflow_state_permission_assignments`
--- 
+--
 
 CREATE TABLE `zseq_workflow_state_permission_assignments` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2320,9 +2352,9 @@ CREATE TABLE `zseq_workflow_state_permission_assignments` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_workflow_states`
--- 
+--
 
 CREATE TABLE `zseq_workflow_states` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2331,9 +2363,9 @@ CREATE TABLE `zseq_workflow_states` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_workflow_transitions`
--- 
+--
 
 CREATE TABLE `zseq_workflow_transitions` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2342,9 +2374,9 @@ CREATE TABLE `zseq_workflow_transitions` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_workflow_trigger_instances`
--- 
+--
 
 CREATE TABLE `zseq_workflow_trigger_instances` (
   `id` int(10) unsigned NOT NULL auto_increment,
@@ -2353,34 +2385,34 @@ CREATE TABLE `zseq_workflow_trigger_instances` (
 
 -- --------------------------------------------------------
 
--- 
+--
 -- Table structure for table `zseq_workflows`
--- 
+--
 
 CREATE TABLE `zseq_workflows` (
   `id` int(10) unsigned NOT NULL auto_increment,
   PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
 
--- 
+--
 -- Constraints for dumped tables
--- 
+--
 
--- 
+--
 -- Constraints for table `document_fields`
--- 
+--
 ALTER TABLE `document_fields`
   ADD CONSTRAINT `document_fields_ibfk_1` FOREIGN KEY (`parent_fieldset`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `document_fields_link`
--- 
+--
 ALTER TABLE `document_fields_link`
   ADD CONSTRAINT `document_fields_link_ibfk_2` FOREIGN KEY (`document_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `document_metadata_version`
--- 
+--
 ALTER TABLE `document_metadata_version`
   ADD CONSTRAINT `document_metadata_version_ibfk_4` FOREIGN KEY (`document_id`) REFERENCES `documents` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `document_metadata_version_ibfk_5` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`),
@@ -2389,163 +2421,163 @@ ALTER TABLE `document_metadata_version`
   ADD CONSTRAINT `document_metadata_version_ibfk_8` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`),
   ADD CONSTRAINT `document_metadata_version_ibfk_9` FOREIGN KEY (`workflow_state_id`) REFERENCES `workflow_states` (`id`);
 
--- 
+--
 -- Constraints for table `document_type_fieldsets_link`
--- 
+--
 ALTER TABLE `document_type_fieldsets_link`
   ADD CONSTRAINT `document_type_fieldsets_link_ibfk_1` FOREIGN KEY (`document_type_id`) REFERENCES `document_types_lookup` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `document_type_fieldsets_link_ibfk_2` FOREIGN KEY (`fieldset_id`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `field_behaviour_options`
--- 
+--
 ALTER TABLE `field_behaviour_options`
   ADD CONSTRAINT `field_behaviour_options_ibfk_1` FOREIGN KEY (`behaviour_id`) REFERENCES `field_behaviours` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `field_behaviour_options_ibfk_2` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `field_behaviour_options_ibfk_3` FOREIGN KEY (`instance_id`) REFERENCES `field_value_instances` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `field_behaviours`
--- 
+--
 ALTER TABLE `field_behaviours`
   ADD CONSTRAINT `field_behaviours_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `field_orders`
--- 
+--
 ALTER TABLE `field_orders`
   ADD CONSTRAINT `field_orders_ibfk_1` FOREIGN KEY (`parent_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `field_orders_ibfk_2` FOREIGN KEY (`child_field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `field_orders_ibfk_3` FOREIGN KEY (`fieldset_id`) REFERENCES `fieldsets` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `field_value_instances`
--- 
+--
 ALTER TABLE `field_value_instances`
   ADD CONSTRAINT `field_value_instances_ibfk_1` FOREIGN KEY (`field_id`) REFERENCES `document_fields` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `field_value_instances_ibfk_2` FOREIGN KEY (`field_value_id`) REFERENCES `metadata_lookup` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `field_value_instances_ibfk_3` FOREIGN KEY (`behaviour_id`) REFERENCES `field_behaviours` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `fieldsets`
--- 
+--
 ALTER TABLE `fieldsets`
   ADD CONSTRAINT `fieldsets_ibfk_1` FOREIGN KEY (`master_field`) REFERENCES `document_fields` (`id`) ON DELETE SET NULL;
 
--- 
+--
 -- Constraints for table `folder_transactions`
--- 
+--
 ALTER TABLE `folder_transactions`
   ADD CONSTRAINT `folder_transactions_ibfk_1` FOREIGN KEY (`folder_id`) REFERENCES `folders` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `folder_transactions_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `groups_groups_link`
--- 
+--
 ALTER TABLE `groups_groups_link`
   ADD CONSTRAINT `groups_groups_link_ibfk_1` FOREIGN KEY (`parent_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `groups_groups_link_ibfk_2` FOREIGN KEY (`member_group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `groups_lookup`
--- 
+--
 ALTER TABLE `groups_lookup`
   ADD CONSTRAINT `groups_lookup_ibfk_1` FOREIGN KEY (`unit_id`) REFERENCES `units_lookup` (`id`);
 
--- 
+--
 -- Constraints for table `permission_assignments`
--- 
+--
 ALTER TABLE `permission_assignments`
   ADD CONSTRAINT `permission_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_assignments_ibfk_2` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_assignments_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `permission_descriptor_groups`
--- 
+--
 ALTER TABLE `permission_descriptor_groups`
   ADD CONSTRAINT `permission_descriptor_groups_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_descriptor_groups_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `permission_descriptor_roles`
--- 
+--
 ALTER TABLE `permission_descriptor_roles`
   ADD CONSTRAINT `permission_descriptor_roles_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_descriptor_roles_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `permission_descriptor_users`
--- 
+--
 ALTER TABLE `permission_descriptor_users`
   ADD CONSTRAINT `permission_descriptor_users_ibfk_1` FOREIGN KEY (`descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_descriptor_users_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `permission_dynamic_assignments`
--- 
+--
 ALTER TABLE `permission_dynamic_assignments`
   ADD CONSTRAINT `permission_dynamic_assignments_ibfk_2` FOREIGN KEY (`dynamic_condition_id`) REFERENCES `permission_dynamic_conditions` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_dynamic_assignments_ibfk_3` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `permission_dynamic_conditions`
--- 
+--
 ALTER TABLE `permission_dynamic_conditions`
   ADD CONSTRAINT `permission_dynamic_conditions_ibfk_1` FOREIGN KEY (`permission_object_id`) REFERENCES `permission_objects` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_dynamic_conditions_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_dynamic_conditions_ibfk_3` FOREIGN KEY (`condition_id`) REFERENCES `saved_searches` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `permission_lookup_assignments`
--- 
+--
 ALTER TABLE `permission_lookup_assignments`
   ADD CONSTRAINT `permission_lookup_assignments_ibfk_1` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_lookup_assignments_ibfk_2` FOREIGN KEY (`permission_lookup_id`) REFERENCES `permission_lookups` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `permission_lookup_assignments_ibfk_3` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `saved_searches`
--- 
+--
 ALTER TABLE `saved_searches`
   ADD CONSTRAINT `saved_searches_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
 
--- 
+--
 -- Constraints for table `user_history`
--- 
+--
 ALTER TABLE `user_history`
   ADD CONSTRAINT `user_history_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `users`
--- 
+--
 ALTER TABLE `users`
   ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`authentication_source_id`) REFERENCES `authentication_sources` (`id`) ON DELETE SET NULL;
 
--- 
+--
 -- Constraints for table `users_groups_link`
--- 
+--
 ALTER TABLE `users_groups_link`
   ADD CONSTRAINT `users_groups_link_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `groups_lookup` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `users_groups_link_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `workflow_state_permission_assignments`
--- 
+--
 ALTER TABLE `workflow_state_permission_assignments`
   ADD CONSTRAINT `workflow_state_permission_assignments_ibfk_7` FOREIGN KEY (`permission_id`) REFERENCES `permissions` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `workflow_state_permission_assignments_ibfk_8` FOREIGN KEY (`permission_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE CASCADE;
 
--- 
+--
 -- Constraints for table `workflow_states`
--- 
+--
 ALTER TABLE `workflow_states`
   ADD CONSTRAINT `workflow_states_ibfk_1` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`),
   ADD CONSTRAINT `workflow_states_ibfk_2` FOREIGN KEY (`inform_descriptor_id`) REFERENCES `permission_descriptors` (`id`) ON DELETE SET NULL;
 
--- 
+--
 -- Constraints for table `workflow_transitions`
--- 
+--
 ALTER TABLE `workflow_transitions`
   ADD CONSTRAINT `workflow_transitions_ibfk_45` FOREIGN KEY (`workflow_id`) REFERENCES `workflows` (`id`) ON DELETE CASCADE,
   ADD CONSTRAINT `workflow_transitions_ibfk_46` FOREIGN KEY (`target_state_id`) REFERENCES `workflow_states` (`id`) ON DELETE CASCADE,
@@ -2554,79 +2586,79 @@ ALTER TABLE `workflow_transitions`
   ADD CONSTRAINT `workflow_transitions_ibfk_49` FOREIGN KEY (`guard_role_id`) REFERENCES `roles` (`id`) ON DELETE SET NULL,
   ADD CONSTRAINT `workflow_transitions_ibfk_50` FOREIGN KEY (`guard_condition_id`) REFERENCES `saved_searches` (`id`) ON DELETE SET NULL;
 
--- 
+--
 -- Constraints for table `workflows`
--- 
+--
 ALTER TABLE `workflows`
   ADD CONSTRAINT `workflows_ibfk_1` FOREIGN KEY (`start_state_id`) REFERENCES `workflow_states` (`id`);
 
 
-CREATE TABLE `plugin_rss` 
+CREATE TABLE `plugin_rss`
 ( `id` int(11) NOT NULL,
   `user_id` int(11) NOT NULL,
   `url` varchar(200) NOT NULL,
   `title` varchar(20) NOT NULL,
-  PRIMARY KEY  (`id`)) 
+  PRIMARY KEY  (`id`))
 ENGINE=MyISAM DEFAULT CHARSET=utf8;
 
-CREATE TABLE `zseq_plugin_rss` 
+CREATE TABLE `zseq_plugin_rss`
 (
-  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,  
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    PRIMARY KEY  (`id`)
 ) ENGINE=MyISAM AUTO_INCREMENT=1;
 
-CREATE TABLE `tag_words` (            
-   `id` int(10) NOT NULL,     
-   `tag` varchar(100) default NULL,    
+CREATE TABLE `tag_words` (
+   `id` int(10) NOT NULL,
+   `tag` varchar(100) default NULL,
    PRIMARY KEY  (`id`))
-ENGINE=InnoDB DEFAULT CHARSET=utf8;  
+ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 CREATE TABLE `document_tags` (
-   `document_id` int(10) NOT NULL, 
-   `tag_id` int(10) NOT NULL,       
+   `document_id` int(10) NOT NULL,
+   `tag_id` int(10) NOT NULL,
    PRIMARY KEY  (`document_id`,`tag_id`),
    CONSTRAINT fk_document_tags_document_id FOREIGN KEY (document_id) REFERENCES documents(id) ON UPDATE CASCADE ON DELETE CASCADE,
    CONSTRAINT fk_document_tags_tag_id FOREIGN KEY (tag_id) REFERENCES tag_words(id) ON UPDATE CASCADE ON DELETE CASCADE
 )
 ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-CREATE TABLE `zseq_document_tags` (                    
-   `id` int(10) NOT NULL auto_increment,       
+CREATE TABLE `zseq_document_tags` (
+   `id` int(10) NOT NULL auto_increment,
    PRIMARY KEY  (`id`))
 ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
 
-CREATE TABLE `zseq_tag_words` (                         
-   `id` int(10) NOT NULL auto_increment,        
+CREATE TABLE `zseq_tag_words` (
+   `id` int(10) NOT NULL auto_increment,
    PRIMARY KEY  (`id`))
 ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
 
 ALTER TABLE fieldsets ADD disabled tinyint not null default 0;
 
-CREATE TABLE `uploaded_files` (                                                           
-`tempfilename` varchar(100) NOT NULL,                                                   
-`filename` varchar(100) NOT NULL,                                                       
-`userid` int(11) NOT NULL,                                                              
-`uploaddate` timestamp NOT NULL,  
-`action` char(1) NOT NULL COMMENT 'A = Add, C = Checkin',                         
-`document_id` int(11) default NULL                                                      
+CREATE TABLE `uploaded_files` (
+`tempfilename` varchar(100) NOT NULL,
+`filename` varchar(100) NOT NULL,
+`userid` int(11) NOT NULL,
+`uploaddate` timestamp NOT NULL,
+`action` char(1) NOT NULL COMMENT 'A = Add, C = Checkin',
+`document_id` int(11) default NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
-CREATE TABLE `download_files` (                              
-`document_id` int(10) unsigned NOT NULL,                   
-`session` varchar(100) NOT NULL,                           
-`download_date` timestamp NULL default CURRENT_TIMESTAMP,  
-`downloaded` int(10) unsigned NOT NULL default '0',        
-`filesize` int(10) unsigned NOT NULL,                      
-`content_version` int(10) unsigned NOT NULL,               
-`hash` varchar(100) NOT NULL,                              
-PRIMARY KEY  (`document_id`,`session`)                     
+CREATE TABLE `download_files` (
+`document_id` int(10) unsigned NOT NULL,
+`session` varchar(100) NOT NULL,
+`download_date` timestamp NULL default CURRENT_TIMESTAMP,
+`downloaded` int(10) unsigned NOT NULL default '0',
+`filesize` int(10) unsigned NOT NULL,
+`content_version` int(10) unsigned NOT NULL,
+`hash` varchar(100) NOT NULL,
+PRIMARY KEY  (`document_id`,`session`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 CREATE TABLE `index_files` (
-`document_id` int(10) unsigned NOT NULL,                                               
-`user_id` int(10) unsigned NOT NULL,                                                   
-`indexdate` timestamp NOT NULL,  
-PRIMARY KEY  (`document_id`)                                                           
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;   
+`document_id` int(10) unsigned NOT NULL,
+`user_id` int(10) unsigned NOT NULL,
+`indexdate` timestamp NOT NULL,
+PRIMARY KEY  (`document_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
 SET FOREIGN_KEY_CHECKS=1;
--
libgit2 0.21.4