diff --git a/workflow/engine/classes/class.plugin.php b/workflow/engine/classes/class.plugin.php index 7b11acc0b..400fa6df5 100644 --- a/workflow/engine/classes/class.plugin.php +++ b/workflow/engine/classes/class.plugin.php @@ -297,6 +297,26 @@ class caseSchedulerPlugin { $this->sActionGetFields = $sActionGetFields; } } +class taskExtendedProperty { + var $sNamespace; + var $sPage; + var $sName; + var $sIcon; + /** + * This function is the constructor of the taskExtendedProperty class + * @param string $sNamespace + * @param string $sPage + * @param string $sName + * @param string $sIcon + * @return void + */ + function __construct( $sNamespace, $sPage, $sName, $sIcon ) { + $this->sNamespace = $sNamespace; + $this->sPage = $sPage; + $this->sName = $sName; + $this->sIcon = $sIcon; + } + } class PMPlugin { var $sNamespace; @@ -516,4 +536,13 @@ class PMPlugin { $oPluginRegistry =& PMPluginRegistry::getSingleton(); $oPluginRegistry->registerCaseSchedulerPlugin( $this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields ); } +/** + * With this function we can register a Dashboard Page for Cases Dashboard + * @param string $sPage + * @return void + */ + function registerTaskExtendedProperty( $sPage, $sName, $sIcon="") { + $oPluginRegistry =& PMPluginRegistry::getSingleton(); + $oPluginRegistry->registerTaskExtendedProperty ( $this->sNamespace, $sPage, $sName, $sIcon ); + } } \ No newline at end of file diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index 2d87ddf47..c4f77ed76 100644 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -79,6 +79,7 @@ class PMPluginRegistry { private $_aCSSStyleSheets = array(); private $_aToolbarFiles = array(); private $_aCaseSchedulerPlugin = array(); + private $_aTaskExtendedProperties = array(); static private $instance = NULL; @@ -148,8 +149,8 @@ class PMPluginRegistry { function registerPlugin( $sNamespace, $sFilename = null) { $sClassName = $sNamespace . 'plugin'; - //if ( isset( $this->_aPluginDetails[$sNamespace] ) ) - // return; + if ( isset( $this->_aPluginDetails[$sNamespace] ) ) + return; //require_once ( $sFilename ); $plugin = new $sClassName ($sNamespace, $sFilename); $detail = new pluginDetail ( @@ -165,9 +166,9 @@ class PMPluginRegistry { $detail->aWorkspaces = $plugin->aWorkspaces; if ( isset ($plugin->bPrivate) ) $detail->bPrivate = $plugin->bPrivate; - if ( isset( $this->_aPluginDetails[$sNamespace] ) ){ - $detail->enabled=$this->_aPluginDetails[$sNamespace]->enabled; - } + //if ( isset( $this->_aPluginDetails[$sNamespace] ) ){ + // $detail->enabled=$this->_aPluginDetails[$sNamespace]->enabled; + //} $this->_aPluginDetails[$sNamespace] = $detail; } @@ -274,6 +275,12 @@ class PMPluginRegistry { if ( $detail->sNamespace == $sNamespace ) unset ( $this->_aCaseSchedulerPlugin[ $key ] ); } + foreach ( $this->_aTaskExtendedProperties as $key=>$detail ) { + if ( $detail->sNamespace == $sNamespace ) + unset ( $this->_aTaskExtendedProperties[ $key ] ); + } + + } /** @@ -921,4 +928,35 @@ class PMPluginRegistry { function getCaseSchedulerPlugins( ) { return $this->_aCaseSchedulerPlugin; } + + /** + * Register a Task Extended property page in the singleton + * + * @param unknown_type $sNamespace + * @param unknown_type $sPage + */ + + function registerTaskExtendedProperty($sNamespace, $sPage, $sName, $sIcon ) { + $found = false; + foreach ( $this->_aTaskExtendedProperties as $row=>$detail ) { + if ( $sPage == $detail->sPage && $sNamespace == $detail->sNamespace ){ + $detail->sName=$sName; + $detail->sIcon=$sIcon; + $found = true; + } + } + if ( !$found ) { + $taskExtendedProperty = new taskExtendedProperty ($sNamespace, $sPage, $sName, $sIcon); + $this->_aTaskExtendedProperties[] = $taskExtendedProperty; + } + } + + /** + * return all dashboard pages + * + * @return array + */ + function getTaskExtendedProperties() { + return $this->_aTaskExtendedProperties; + } } diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php index 41fccd66f..783571f12 100644 --- a/workflow/engine/classes/class.processMap.php +++ b/workflow/engine/classes/class.processMap.php @@ -354,6 +354,16 @@ class processMap { $oDataset->next(); } $oPM->derivation = array('Sequential', 'Evaluate (manual)', 'Evaluate (auto)', 'Parallel (fork)', 'Parallel by evaluation (fork)', 'Parallel (sequential join)', 'Parallel (sequential main join)'); + + //Load extended task properties from plugin. By JHL Jan 18, 2011 + $oPluginRegistry =& PMPluginRegistry::getSingleton(); + $activePluginsForTaskProperties=$oPluginRegistry->getTaskExtendedProperties(); + $oPM->taskOptions = array(); + foreach($activePluginsForTaskProperties as $key => $taskPropertiesInfo){ + $taskOption['title']=$taskPropertiesInfo->sName; + $taskOption['id']=$taskPropertiesInfo->sNamespace."--".$taskPropertiesInfo->sName; + $oPM->taskOptions[]=$taskOption; + } $oJSON = new Services_JSON ( ); return $oJSON->encode($oPM); @@ -1293,6 +1303,21 @@ class processMap { case 7 : $sFilename = 'tasks/tasks_Notifications.xml'; break; + default: + print "