Extended Property for Tasks

This commit is contained in:
Hugo Loza
2011-01-18 22:14:46 +00:00
parent 8b3663df5f
commit 324bb69a6a
4 changed files with 112 additions and 5 deletions

View File

@@ -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 );
}
}

View File

@@ -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;
}
}

View File

@@ -355,6 +355,16 @@ class processMap {
}
$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);
} catch (Exception $oError) {
@@ -1293,6 +1303,21 @@ class processMap {
case 7 :
$sFilename = 'tasks/tasks_Notifications.xml';
break;
default:
print "<h1>$iForm</h1>";
//if the $iForm is not one of the defaults then search under Plugins for an extended property. By JHL Jan 18, 2011
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$activePluginsForTaskProperties=$oPluginRegistry->getTaskExtendedProperties();
$oPM->taskOptions = array();
foreach($activePluginsForTaskProperties as $key => $taskPropertiesInfo){
$id=$taskPropertiesInfo->sNamespace."--".$taskPropertiesInfo->sName;
if($id==$iForm){
$sFilename=$taskPropertiesInfo->sPage;
}
}
//$sFilename = 'tasks/tasks_Owner.xml';
break;
}
$oTask = new Task ( );
$aFields = $oTask->load($sTaskUID);

View File

@@ -1533,6 +1533,7 @@ var processmap=function(){
this.tmp.propertiesPanel = panel =new leimnud.module.panel();
var data = this.data.db.task[index];
panel.options={
limit:true,
size:{w:600,h:430},
@@ -1552,6 +1553,7 @@ var processmap=function(){
modal:true
}
};
panel.tab={
width :170,
optWidth:160,
@@ -1584,7 +1586,20 @@ var processmap=function(){
noClear : true
}]
};
var taskOptions = this.data.db.taskOptions;
this.loadExtendedProperties = function(){
for(i=0;i<taskOptions.length;i++){
anElement={
title : taskOptions[i].title,
content : this.parent.closure({instance:this,method:iForm,args:[panel,index,taskOptions[i].id]}),
noClear : true
};
panel.tab.options.push(anElement);
}
};
this.loadExtendedProperties();
panel.make();
},args:index})}
]:
[