diff --git a/workflow/engine/classes/class.dashletOpenVSCompleted.php b/workflow/engine/classes/class.dashletOpenVSCompleted.php
index 6c4b1fa87..5a24ee9a3 100644
--- a/workflow/engine/classes/class.dashletOpenVSCompleted.php
+++ b/workflow/engine/classes/class.dashletOpenVSCompleted.php
@@ -1,6 +1,6 @@
name = 'DAS_INS_CONTEXT_TIME';
$contextTime->fieldLabel = 'Period';
$contextTime->editable = false;
- $contextTime->width = 325;
+ $contextTime->width = 320;
$contextTime->store = $contextTimeStore;
$contextTime->mode = 'local';
$contextTime->triggerAction = 'all';
@@ -119,6 +119,10 @@ class dashletOpenVSCompleted implements DashletInterface {
return $additionalFields;
}
+ public static function getXTemplate($className) {
+ return "
";
+ }
+
public function setup($config) {
$this->redFrom = isset($config['DAS_RED_FROM']) ? (int) $config['DAS_RED_FROM'] : 0;
$this->redTo = isset($config['DAS_RED_TO']) ? (int) $config['DAS_RED_TO'] : 30;
diff --git a/workflow/engine/classes/class.dashletProcessMakerCommunity.php b/workflow/engine/classes/class.dashletProcessMakerCommunity.php
index ea095b52f..b8dc5d355 100644
--- a/workflow/engine/classes/class.dashletProcessMakerCommunity.php
+++ b/workflow/engine/classes/class.dashletProcessMakerCommunity.php
@@ -1,6 +1,6 @@
";
+ }
+
public function setup($config) {
return true;
}
diff --git a/workflow/engine/classes/class.dashletProcessMakerEnterprise.php b/workflow/engine/classes/class.dashletProcessMakerEnterprise.php
index b00249f11..53008d63f 100644
--- a/workflow/engine/classes/class.dashletProcessMakerEnterprise.php
+++ b/workflow/engine/classes/class.dashletProcessMakerEnterprise.php
@@ -1,6 +1,6 @@
";
+ }
+
public function setup($config) {
return true;
}
diff --git a/workflow/engine/classes/class.plugin.php b/workflow/engine/classes/class.plugin.php
index 11322cfae..2097e28da 100755
--- a/workflow/engine/classes/class.plugin.php
+++ b/workflow/engine/classes/class.plugin.php
@@ -22,24 +22,24 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
-
-require_once ( 'class.pluginRegistry.php');
-define ( 'G_PLUGIN_CLASS', 1 );
+require_once 'class.pluginRegistry.php';
-define ( 'PM_CREATE_CASE', 1001 );
-define ( 'PM_UPLOAD_DOCUMENT', 1002 );
-define ( 'PM_CASE_DOCUMENT_LIST',1003 );
-define ( 'PM_BROWSE_CASE', 1004 );
-define ( 'PM_NEW_PROCESS_LIST', 1005 );
-define ( 'PM_NEW_PROCESS_SAVE', 1006 );
-define ( 'PM_NEW_DYNAFORM_LIST', 1007 );
-define ( 'PM_NEW_DYNAFORM_SAVE', 1008 );
-define ( 'PM_EXTERNAL_STEP', 1009 );
-define ( 'PM_CASE_DOCUMENT_LIST_ARR', 1010 );
-define ( 'PM_LOGIN', 1011 );
-define ( 'PM_UPLOAD_DOCUMENT_BEFORE', 1012 );
+define('G_PLUGIN_CLASS', 1);
+
+define('PM_CREATE_CASE', 1001);
+define('PM_UPLOAD_DOCUMENT', 1002);
+define('PM_CASE_DOCUMENT_LIST', 1003);
+define('PM_BROWSE_CASE', 1004);
+define('PM_NEW_PROCESS_LIST', 1005);
+define('PM_NEW_PROCESS_SAVE', 1006);
+define('PM_NEW_DYNAFORM_LIST', 1007);
+define('PM_NEW_DYNAFORM_SAVE', 1008);
+define('PM_EXTERNAL_STEP', 1009);
+define('PM_CASE_DOCUMENT_LIST_ARR', 1010);
+define('PM_LOGIN', 1011);
+define('PM_UPLOAD_DOCUMENT_BEFORE', 1012);
/**
* @package workflow.engine.classes
@@ -82,28 +82,7 @@ class toolbarDetail {
$this->sToolbarId = $sToolbarId;
$this->sFilename = $sFilename;
}
- }
- /**
- * @package workflow.engine.classes
- */
- class dashboardPage {
- var $sNamespace;
- var $sPage;
- var $sName;
- var $sIcon;
- /**
- * This function is the constructor of the dashboardPage class
- * param string $sNamespace
- * param string $sPage
- * @return void
- */
- function __construct( $sNamespace, $sPage, $sName, $sIcon ) {
- $this->sNamespace = $sNamespace;
- $this->sPage = $sPage;
- $this->sName = $sName;
- $this->sIcon = $sIcon;
- }
- }
+}
/**
* @package workflow.engine.classes
@@ -112,14 +91,14 @@ class cssFile {
var $sNamespace;
var $sCssFile;
/**
- * This function is the constructor of the dashboardPage class
+ * This function is the constructor of the cssFile class
* param string $sNamespace
- * param string $sPage
+ * param string $sPage
* @return void
*/
function __construct( $sNamespace, $sCssFile) {
$this->sNamespace = $sNamespace;
- $this->sCssFile = $sCssFile;
+ $this->sCssFile = $sCssFile;
}
}
/**
@@ -334,19 +313,19 @@ class caseSchedulerPlugin {
class taskExtendedProperty {
var $sNamespace;
var $sPage;
- var $sName;
- var $sIcon;
+ var $sName;
+ var $sIcon;
/**
* This function is the constructor of the taskExtendedProperty class
* param string $sNamespace
- * param string $sPage
+ * param string $sPage
* param string $sName
* param string $sIcon
* @return void
*/
function __construct( $sNamespace, $sPage, $sName, $sIcon ) {
$this->sNamespace = $sNamespace;
- $this->sPage = $sPage;
+ $this->sPage = $sPage;
$this->sName = $sName;
$this->sIcon = $sIcon;
}
@@ -390,15 +369,15 @@ class PMPlugin {
}
/**
- * With this function we can register the dashboard
+ * With this function we can register a dashlet class
* param
* @return void
*/
- function registerDashboard( ) {
+ function registerDashlets() {
$oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerDashboard ( $this->sNamespace);
+ $oPluginRegistry->registerDashlets($this->sNamespace);
}
-
+
/**
* With this function we can register the report
@@ -534,17 +513,8 @@ class PMPlugin {
$sPageFilename = PATH_PLUGINS . $this->sPluginFolder . PATH_SEP . $templateFilename;
$oPluginRegistry->registerBreakPageTemplate ( $this->sNamespace, $pageId, $sPageFilename);
}
-/**
- * With this function we can register a Dashboard Page for Cases Dashboard
- * @param string $sPage
- * @return void
- */
- function registerDashboardPage( $sPage, $sName, $sIcon="") {
- $oPluginRegistry =& PMPluginRegistry::getSingleton();
- $oPluginRegistry->registerDashboardPage ( $this->sNamespace, $sPage, $sName, $sIcon );
- }
/**
- * With this function we can register a Dashboard Page for Cases Dashboard
+ * With this function we can register a CSS
* @param string $sPage
* @return void
*/
@@ -573,7 +543,7 @@ class PMPlugin {
$oPluginRegistry->registerCaseSchedulerPlugin( $this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields );
}
/**
- * With this function we can register a Dashboard Page for Cases Dashboard
+ * With this function we can register a task extended property
* @param string $sPage
* @return void
*/
diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php
index 558224b35..9601439fe 100755
--- a/workflow/engine/classes/class.pluginRegistry.php
+++ b/workflow/engine/classes/class.pluginRegistry.php
@@ -79,12 +79,11 @@ class PMPluginRegistry {
private $_aMenus = array();
private $_aFolders = array();
private $_aTriggers = array();
- private $_aDashboards = array();
+ private $_aDashlets = array();
private $_aReports = array();
private $_aPmFunctions = array();
private $_aRedirectLogin = array();
private $_aSteps = array();
- private $_aDashboardPages = array();
private $_aCSSStyleSheets = array();
private $_aToolbarFiles = array();
private $_aCaseSchedulerPlugin = array();
@@ -147,20 +146,6 @@ class PMPluginRegistry {
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $this->serializeInstance() );
}
- //delete this function, it was here, only for test and debug purposes
- function showArrays () {
- krumo ( $this->_aPluginDetails);
- krumo ( $this->_aPlugins);
- krumo ( $this->_aMenus);
- krumo ( $this->_aFolders);
- krumo ( $this->_aTriggers);
- krumo ( $this->_aDashboards);
- krumo ( $this->_aReports);
- krumo ( $this->_aPmFunctions);
- krumo ( $this->_aRedirectLogin);
- krumo ( $this->_aSteps);
- }
-
/**
* Register the plugin in the singleton
*
@@ -265,9 +250,10 @@ class PMPluginRegistry {
unset ( $this->_aTriggers[ $key ] );
}
- foreach ( $this->_aDashboards as $key=>$detail ) {
- if ( $detail == $sNamespace )
- unset ( $this->_aDashboards[ $key ] );
+ foreach ($this->_aDashlets as $key => $detail) {
+ if ($detail == $sNamespace) {
+ unset($this->_aDashlets[$key]);
+ }
}
foreach ( $this->_aReports as $key=>$detail ) {
@@ -293,10 +279,6 @@ class PMPluginRegistry {
if ( $detail->sNamespace == $sNamespace )
unset ( $this->_aToolbarFiles[ $key ] );
}
- foreach ( $this->_aDashboardPages as $key=>$detail ) {
- if ( $detail->sNamespace == $sNamespace )
- unset ( $this->_aDashboardPages[ $key ] );
- }
foreach ( $this->_aCSSStyleSheets as $key=>$detail ) {
if ( $detail->sNamespace == $sNamespace )
unset ( $this->_aCSSStyleSheets[ $key ] );
@@ -357,12 +339,12 @@ class PMPluginRegistry {
if (count($plugins) > 1) {
throw new Exception("Multiple plugins in one archive are not supported currently");
}
-
+
//if (isset($pluginName) && !in_array($pluginName, $plugins)) {
if (isset($pluginName) && !in_array($pluginName, $namePlugin)) {
throw new Exception("Plugin '$pluginName' not found in archive");
}
-
+
//$pluginName = $plugins[0];
$pluginFile = "$pluginName.php";
@@ -400,42 +382,42 @@ class PMPluginRegistry {
throw new Exception('A recent version of this plugin was already installed.');
}
*/
-
+
$res = $tar->extract(PATH_PLUGINS);
if (!file_exists(PATH_PLUGINS . $pluginFile)) {
throw (new Exception("File \"$pluginFile\" doesn't exist"));
}
-
+
require_once (PATH_PLUGINS . $pluginFile);
$details = $this->getPluginDetails($pluginFile);
-
+
$this->installPlugin($details->sNamespace);
$this->setupPlugins();
-
+
$this->enablePlugin($details->sNamespace);
$this->save();
}
function uninstallPlugin($sNamespace) {
$pluginFile = "$sNamespace.php";
-
+
if (!file_exists(PATH_PLUGINS . $pluginFile)) {
throw (new Exception("File \"$pluginFile\" doesn't exist"));
}
-
+
require_once (PATH_PLUGINS . $pluginFile);
$details = $this->getPluginDetails($pluginFile);
-
+
$this->enablePlugin($details->sNamespace);
$this->disablePlugin($details->sNamespace);
$this->save();
-
+
$pluginDir = PATH_PLUGINS . $details->sPluginFolder;
-
+
if (isset($details->sPluginFolder) && !empty($details->sPluginFolder) && file_exists($pluginDir))
G::rm_dir($pluginDir);
-
+
if (isset($details->sFilename) && !empty($details->sFilename) && file_exists($details->sFilename))
unlink($details->sFilename);
}
@@ -486,53 +468,22 @@ class PMPluginRegistry {
}
/**
- * Register a dashboard class in the singleton
+ * Register a dashlet class in the singleton
*
- * @param unknown_type $sNamespace
- * @param unknown_type $sMenuId
- * @param unknown_type $sFilename
+ * @param unknown_type $className
*/
- function registerDashboard($sNamespace ) {
+ function registerDashlets($namespace) {
$found = false;
- foreach ( $this->_aDashboards as $row=>$detail ) {
- if ( $sNamespace == $detail )
- $found = true;
- }
- if ( !$found ) {
- $this->_aDashboards[] = $sNamespace;
- }
- }
-
- /**
- * Register a dashboard page for cases in the singleton
- *
- * @param unknown_type $sNamespace
- * @param unknown_type $sPage
- */
- function registerDashboardPage($sNamespace, $sPage, $sName, $sIcon ) {
- $found = false;
- foreach ( $this->_aDashboardPages as $row=>$detail ) {
- if ( $sPage == $detail->sPage && $sNamespace == $detail->sNamespace ){
- $detail->sName=$sName;
- $detail->sIcon=$sIcon;
+ foreach ($this->_aDashlets as $row => $detail) {
+ if ($namespace == $detail) {
$found = true;
}
}
- if ( !$found ) {
- $dashboardPage = new dashboardPage ($sNamespace, $sPage, $sName, $sIcon);
- $this->_aDashboardPages[] = $dashboardPage;
+ if (!$found) {
+ $this->_aDashlets[] = $namespace;
}
}
- /**
- * return all dashboard pages
- *
- * @return array
- */
- function getDashboardPages() {
- return $this->_aDashboardPages;
- }
-
/**
* Register a stylesheet in the singleton
*
@@ -554,7 +505,7 @@ class PMPluginRegistry {
}
/**
- * return all dashboard pages
+ * return all css
*
* @return array
*/
@@ -781,17 +732,11 @@ class PMPluginRegistry {
}
/**
- * return all dashboards registered
+ * return all dashlets classes registered
* @return array
*/
- function getDashboards( ) {
- return $this->_aDashboards;
- $dash = array ();
- foreach ( $this->_aDashboards as $row=>$detail ) {
- $sClassName = str_replace ( 'plugin', 'class', $this->_aPluginDetails[ $detail ]->sClassName);
- $dash[] = $sClassName;
- }
- return $dash;
+ function getDashlets() {
+ return $this->_aDashlets;
}
/**
@@ -809,17 +754,17 @@ class PMPluginRegistry {
}
/**
- * This function returns all dashboards registered
+ * This function returns all pmFunctions registered
* @ array
*/
function getPmFunctions( ) {
return $this->_aPmFunctions;
- $dash = array ();
+ $pmf = array ();
foreach ( $this->_aPmFunctions as $row=>$detail ) {
$sClassName = str_replace ( 'plugin', 'class', $this->_aPluginDetails[ $detail ]->sClassName);
- $dash[] = $sClassName;
+ $pmf[] = $sClassName;
}
- return $dash;
+ return $pmf;
}
/**
@@ -1197,7 +1142,7 @@ class PMPluginRegistry {
}
/**
- * return all dashboard pages
+ * return all tasl extended properties
*
* @return array
*/
diff --git a/workflow/engine/classes/class.pmDashlet.php b/workflow/engine/classes/class.pmDashlet.php
index 2cec9e3d5..df79f5b84 100644
--- a/workflow/engine/classes/class.pmDashlet.php
+++ b/workflow/engine/classes/class.pmDashlet.php
@@ -1,8 +1,8 @@
getDashlets();
+ foreach ($pluginsDashlets as $pluginDashlet) {
+ set_include_path(get_include_path() . PATH_SEPARATOR . PATH_PLUGINS . $pluginDashlet . PATH_SEP);
+ require_once 'classes/class.' . $className . '.php';
+ }
+ }
G::LoadClass($className);
eval("\$additionalFields = $className::getAdditionalFields(\$className);");
return $additionalFields;
@@ -24,11 +31,22 @@ class PMDashlet extends DashletInstance implements DashletInterface {
}
}
+
+
public function setup($dasInsUid) {
try {
$this->dashletInstance = $this->loadDashletInstance($dasInsUid);
- G::LoadClass($this->dashletInstance['DAS_CLASS']);
- $this->dashletObject = new $this->dashletInstance['DAS_CLASS']();
+ $className = $this->dashletInstance['DAS_CLASS'];
+ G::LoadClass($className);
+ if (!class_exists($className)) {
+ $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginsDashlets = $oPluginRegistry->getDashlets();
+ foreach ($pluginsDashlets as $pluginDashlet) {
+ set_include_path(get_include_path() . PATH_SEPARATOR . PATH_PLUGINS . $pluginDashlet . PATH_SEP);
+ require_once 'classes/class.' . $className . '.php';
+ }
+ }
+ $this->dashletObject = new $className();
$this->dashletObject->setup($this->dashletInstance);
}
catch (Exception $error) {
@@ -174,6 +192,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
$dataset->next();
while ($row = $dataset->getRow()) {
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
+ $row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
$dashletsInstances[$row['DAS_INS_UID']] = $row;
}
$dataset->next();
@@ -192,6 +211,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
$dataset->next();
while ($row = $dataset->getRow()) {
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
+ $row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
$dashletsInstances[$row['DAS_INS_UID']] = $row;
}
$dataset->next();
@@ -212,6 +232,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
$dataset->next();
while ($row = $dataset->getRow()) {
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
+ $row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
$dashletsInstances[$row['DAS_INS_UID']] = $row;
}
$dataset->next();
@@ -234,6 +255,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
$dataset->next();
while ($row = $dataset->getRow()) {
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
+ $row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
$dashletsInstances[$row['DAS_INS_UID']] = $row;
}
$dataset->next();
@@ -250,4 +272,23 @@ class PMDashlet extends DashletInstance implements DashletInterface {
}
}
+ public static function getXTemplate($className) {
+ try {
+ if (!class_exists($className)) {
+ $oPluginRegistry = &PMPluginRegistry::getSingleton();
+ $pluginsDashlets = $oPluginRegistry->getDashlets();
+ foreach ($pluginsDashlets as $pluginDashlet) {
+ set_include_path(get_include_path() . PATH_SEPARATOR . PATH_PLUGINS . $pluginDashlet . PATH_SEP);
+ require_once 'classes/class.' . $className . '.php';
+ }
+ }
+ G::LoadClass($className);
+ eval("\$additionalFields = $className::getXTemplate(\$className);");
+ return $additionalFields;
+ }
+ catch (Exception $error) {
+ throw $error;
+ }
+ }
+
}
\ No newline at end of file
diff --git a/workflow/engine/classes/interfaces/dashletInterface.php b/workflow/engine/classes/interfaces/dashletInterface.php
index bd2f34609..98723865d 100644
--- a/workflow/engine/classes/interfaces/dashletInterface.php
+++ b/workflow/engine/classes/interfaces/dashletInterface.php
@@ -3,6 +3,7 @@
interface DashletInterface {
public static function getAdditionalFields($className);
+ public static function getXTemplate($className);
public function setup($dasInsUid);
public function render();
diff --git a/workflow/engine/classes/model/Dashlet.php b/workflow/engine/classes/model/Dashlet.php
index 626ef8c8c..87a8f6e14 100644
--- a/workflow/engine/classes/model/Dashlet.php
+++ b/workflow/engine/classes/model/Dashlet.php
@@ -19,7 +19,12 @@ class Dashlet extends BaseDashlet {
public function load($dasUid) {
try {
$dashlet = DashletPeer::retrieveByPK($dasUid);
- return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
+ if (!is_null($dashlet)) {
+ return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
+ }
+ else {
+ return null;
+ }
}
catch (Exception $error) {
throw $error;
diff --git a/workflow/engine/controllers/dashboard.php b/workflow/engine/controllers/dashboard.php
index a7ce29805..d4a7d3428 100644
--- a/workflow/engine/controllers/dashboard.php
+++ b/workflow/engine/controllers/dashboard.php
@@ -49,7 +49,8 @@ class Dashboard extends Controller {
$this->pmDashlet->render($width);
}
catch (Exception $error) {
- //ToDo: Render a image with the error message
+ //ToDo: Show the error message
+ echo $error->getMessage();
}
}
@@ -173,9 +174,14 @@ class Dashboard extends Controller {
try {
$dashlet = new Dashlet();
$dashletFields = $dashlet->load($data->DAS_UID);
- $result->additionaFields = PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']);
+ if (!is_null($dashletFields)) {
+ $result->additionaFields = PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']);
+ }
+ else {
+ throw new Exception('Dashlet "' . $data->DAS_UID . '" not exists.');
+ }
}
- catch(Exception $error) {
+ catch (Exception $error) {
$result->status = 'ERROR';
$result->message = $error->getMessage();
}
@@ -299,6 +305,7 @@ class Dashboard extends Controller {
$dashlets[] = array($row['DAS_UID'], $row['DAS_TITLE']);
$dataset->next();
}
+
}
catch (Exception $error) {
throw $error;
diff --git a/workflow/engine/templates/dashboard/dashletInstanceForm.js b/workflow/engine/templates/dashboard/dashletInstanceForm.js
index 772c88ab0..ad5311fef 100644
--- a/workflow/engine/templates/dashboard/dashletInstanceForm.js
+++ b/workflow/engine/templates/dashboard/dashletInstanceForm.js
@@ -66,7 +66,7 @@ Ext.onReady(function() {
name: 'DAS_UID',
fieldLabel: 'Dashboard',
editable: false,
- width: 325,
+ width: 320,
store: storeDasUID,
triggerAction: 'all',
mode: 'local',
@@ -105,7 +105,7 @@ Ext.onReady(function() {
name: 'DAS_INS_OWNER_TYPE',
fieldLabel: 'Assign To',
editable: false,
- width: 325,
+ width: 320,
store: storeDasInsOwnerType,
triggerAction: 'all',
mode: 'local',
@@ -128,7 +128,7 @@ Ext.onReady(function() {
name: 'DAS_INS_OWNER_UID',
fieldLabel: 'Name',
editable: false,
- width: 325,
+ width: 320,
store: storeDasInsOwnerUID,
triggerAction: 'all',
mode: 'local',
diff --git a/workflow/engine/templates/dashboard/index.js b/workflow/engine/templates/dashboard/index.js
index b9c71383a..43b3b3e62 100644
--- a/workflow/engine/templates/dashboard/index.js
+++ b/workflow/engine/templates/dashboard/index.js
@@ -20,7 +20,7 @@ Ext.onReady(function(){
items: [
{
xtype: 'tbbutton',
- text : 'three columns',
+ text : 'Three Columns',
handler : function(a) {
var vp = Ext.getCmp('viewportDashboard');
var pd = Ext.getCmp('portalDashboard');
@@ -35,7 +35,7 @@ Ext.onReady(function(){
},
{
xtype: 'tbbutton',
- text : 'two columns',
+ text : 'Two Columns',
handler : function(a) {
var vp = Ext.getCmp('viewportDashboard');
var pd = Ext.getCmp('portalDashboard');
@@ -47,53 +47,7 @@ Ext.onReady(function(){
pd.items.items[2].columnWidth = 0.01;
pd.doLayout();
}
- },
- {
- xtype: 'tbbutton',
- text : 'blog',
- handler : function(a) {
- var vp = Ext.getCmp('viewportDashboard');
- var pd = Ext.getCmp('portalDashboard');
- pd.items.items[0].columnWidth = 0.40;
- pd.items.items[1].columnWidth = 0.40;
- pd.items.items[2].columnWidth = 0.20;
- pd.doLayout();
- //vp.doLayout();
- }
- } /* ,
- {
- xtype: 'tbbutton',
- text : 'new gauge',
- handler : function(a) {
- var np = new Ext.ux.Portlet ( {
- //title: 'Panel nuevo',
- //tools: tools,
- html: 'gauge placeholder',
- listeners: {
- 'render': function(p){
- p.html = 'hello ' + p.getWidth();
- },
- 'move' : function(p){
- Ext.Msg.alert('Portlet ', 'move ' + p.getWidth() );
- p.html = 'show ' + p.getWidth();
- },
- 'resize' : function(p,w,h){
- var randomnumber=Math.floor(Math.random()*1000000)
- var img = new Ext.XTemplate("
").apply({
- page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id:'00000000000000000000000000000001' })
-
- p.update(img );
- }
- }
- });
-
- var vp = Ext.getCmp('viewportDashboard');
- var pd = Ext.getCmp('portalDashboard');
- pd.items.items[0].add( np );
- pd.doLayout();
- //vp.doLayout();
- }
- } */
+ }
]
});
@@ -136,92 +90,26 @@ Ext.onReady(function(){
}]
});
-//var dashletsInstances = [{"DAS_INS_UID":"00000000000000000000000000000001","DAS_TITLE":"Open Cases VS Complete Cases"}];
-
var pd = Ext.getCmp('portalDashboard');
- var dashletClass = "";
-
- for ( var i = 0; i < dashletsInstances.length; i++ ) {
- dashletClass = dashletsInstances[i].DAS_CLASS;
-
- switch (dashletClass) {
- case "dashletOpenVSCompleted":
- var np = new Ext.ux.Portlet({
- title: dashletsInstances[i].DAS_TITLE,
- dasInsUid : dashletsInstances[i].DAS_INS_UID,
- html: 'gauge placeholder',
- listeners: {
- 'render': function(p){
- p.html = 'hello ' + p.getWidth();
- },
- 'move' : function(p){
- Ext.Msg.alert('Portlet ', 'move ' + p.getWidth() );
- p.html = 'show ' + p.getWidth();
- },
- 'resize' : function(p,w,h){
- var randomnumber = Math.floor(Math.random() * 1000000)
- var img = new Ext.XTemplate("
").apply({
- page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id: p.dasInsUid })
- p.update(img);
- }
- }
- });
- break;
-
- case "dashletProcessMakerCommunity":
- var np = new Ext.ux.Portlet({
- title: dashletsInstances[i].DAS_TITLE,
- dasInsUid : dashletsInstances[i].DAS_INS_UID,
- html: 'gauge placeholder',
- listeners: {
- 'render': function(p){
- p.html = 'hello ' + p.getWidth();
- },
- 'move' : function(p){
- Ext.Msg.alert('Portlet ', 'move ' + p.getWidth() );
- p.html = 'show ' + p.getWidth();
- },
- 'resize' : function(p, w, h){
- var img = new Ext.XTemplate("").apply({
- page: "dashboard/renderDashletInstance",
- id: p.dasInsUid
- })
-
- p.update(img);
- }
- }
- });
- break;
-
- case "dashletProcessMakerEnterprise":
- var np = new Ext.ux.Portlet({
- title: dashletsInstances[i].DAS_TITLE,
- dasInsUid : dashletsInstances[i].DAS_INS_UID,
- html: 'gauge placeholder',
- listeners: {
- 'render': function(p){
- p.html = 'hello ' + p.getWidth();
- },
- 'move' : function(p){
- Ext.Msg.alert('Portlet ', 'move ' + p.getWidth() );
- p.html = 'show ' + p.getWidth();
- },
- 'resize' : function(p, w, h){
- var img = new Ext.XTemplate("").apply({
- page: "dashboard/renderDashletInstance",
- id: p.dasInsUid
- })
-
- p.update(img);
- }
- }
- });
- break;
- }
-
- pd.items.items[i % 3].add( np );
- } //for
-
+ for (var i = 0; i < dashletsInstances.length; i++) {
+ var np = new Ext.ux.Portlet({
+ title: dashletsInstances[i].DAS_TITLE,
+ index: i,
+ dasInsUid : dashletsInstances[i].DAS_INS_UID,
+ html: 'Gauge Placeholder',
+ listeners: {
+ 'resize': function(p, w, h) {
+ var template = new Ext.XTemplate(dashletsInstances[p.index].DAS_XTEMPLATE).apply({
+ id: p.dasInsUid,
+ page: 'dashboard/renderDashletInstance',
+ width: w - 12,
+ random: Math.floor(Math.random() * 1000000)
+ })
+ p.update(template);
+ }
+ }
+ });
+ pd.items.items[i % 3].add(np);
+ }
pd.doLayout();
});
-