BUG 000 Add hook for dashlets
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
|
|
||||||
class dashletOpenVSCompleted implements DashletInterface {
|
class dashletOpenVSCompleted implements DashletInterface {
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ class dashletOpenVSCompleted implements DashletInterface {
|
|||||||
$contextTime->name = 'DAS_INS_CONTEXT_TIME';
|
$contextTime->name = 'DAS_INS_CONTEXT_TIME';
|
||||||
$contextTime->fieldLabel = 'Period';
|
$contextTime->fieldLabel = 'Period';
|
||||||
$contextTime->editable = false;
|
$contextTime->editable = false;
|
||||||
$contextTime->width = 325;
|
$contextTime->width = 320;
|
||||||
$contextTime->store = $contextTimeStore;
|
$contextTime->store = $contextTimeStore;
|
||||||
$contextTime->mode = 'local';
|
$contextTime->mode = 'local';
|
||||||
$contextTime->triggerAction = 'all';
|
$contextTime->triggerAction = 'all';
|
||||||
@@ -119,6 +119,10 @@ class dashletOpenVSCompleted implements DashletInterface {
|
|||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getXTemplate($className) {
|
||||||
|
return "<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>";
|
||||||
|
}
|
||||||
|
|
||||||
public function setup($config) {
|
public function setup($config) {
|
||||||
$this->redFrom = isset($config['DAS_RED_FROM']) ? (int) $config['DAS_RED_FROM'] : 0;
|
$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;
|
$this->redTo = isset($config['DAS_RED_TO']) ? (int) $config['DAS_RED_TO'] : 30;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
|
|
||||||
class dashletProcessMakerCommunity implements DashletInterface {
|
class dashletProcessMakerCommunity implements DashletInterface {
|
||||||
|
|
||||||
@@ -10,6 +10,10 @@ class dashletProcessMakerCommunity implements DashletInterface {
|
|||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getXTemplate($className) {
|
||||||
|
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
||||||
|
}
|
||||||
|
|
||||||
public function setup($config) {
|
public function setup($config) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
|
|
||||||
class dashletProcessMakerEnterprise implements DashletInterface {
|
class dashletProcessMakerEnterprise implements DashletInterface {
|
||||||
|
|
||||||
@@ -10,6 +10,10 @@ class dashletProcessMakerEnterprise implements DashletInterface {
|
|||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getXTemplate($className) {
|
||||||
|
return "<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"{width}\" height=\"207\" frameborder=\"0\"></iframe>";
|
||||||
|
}
|
||||||
|
|
||||||
public function setup($config) {
|
public function setup($config) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
require_once ( 'class.pluginRegistry.php');
|
require_once 'class.pluginRegistry.php';
|
||||||
|
|
||||||
define('G_PLUGIN_CLASS', 1);
|
define('G_PLUGIN_CLASS', 1);
|
||||||
|
|
||||||
@@ -83,27 +83,6 @@ class toolbarDetail {
|
|||||||
$this->sFilename = $sFilename;
|
$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
|
* @package workflow.engine.classes
|
||||||
@@ -112,7 +91,7 @@ class cssFile {
|
|||||||
var $sNamespace;
|
var $sNamespace;
|
||||||
var $sCssFile;
|
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 $sNamespace
|
||||||
* param string $sPage
|
* param string $sPage
|
||||||
* @return void
|
* @return void
|
||||||
@@ -390,13 +369,13 @@ class PMPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* With this function we can register the dashboard
|
* With this function we can register a dashlet class
|
||||||
* param
|
* param
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function registerDashboard( ) {
|
function registerDashlets() {
|
||||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||||
$oPluginRegistry->registerDashboard ( $this->sNamespace);
|
$oPluginRegistry->registerDashlets($this->sNamespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -535,16 +514,7 @@ class PMPlugin {
|
|||||||
$oPluginRegistry->registerBreakPageTemplate ( $this->sNamespace, $pageId, $sPageFilename);
|
$oPluginRegistry->registerBreakPageTemplate ( $this->sNamespace, $pageId, $sPageFilename);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
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
|
|
||||||
* @param string $sPage
|
* @param string $sPage
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
@@ -573,7 +543,7 @@ class PMPlugin {
|
|||||||
$oPluginRegistry->registerCaseSchedulerPlugin( $this->sNamespace, $sActionId, $sActionForm, $sActionSave, $sActionExecute, $sActionGetFields );
|
$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
|
* @param string $sPage
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -79,12 +79,11 @@ class PMPluginRegistry {
|
|||||||
private $_aMenus = array();
|
private $_aMenus = array();
|
||||||
private $_aFolders = array();
|
private $_aFolders = array();
|
||||||
private $_aTriggers = array();
|
private $_aTriggers = array();
|
||||||
private $_aDashboards = array();
|
private $_aDashlets = array();
|
||||||
private $_aReports = array();
|
private $_aReports = array();
|
||||||
private $_aPmFunctions = array();
|
private $_aPmFunctions = array();
|
||||||
private $_aRedirectLogin = array();
|
private $_aRedirectLogin = array();
|
||||||
private $_aSteps = array();
|
private $_aSteps = array();
|
||||||
private $_aDashboardPages = array();
|
|
||||||
private $_aCSSStyleSheets = array();
|
private $_aCSSStyleSheets = array();
|
||||||
private $_aToolbarFiles = array();
|
private $_aToolbarFiles = array();
|
||||||
private $_aCaseSchedulerPlugin = array();
|
private $_aCaseSchedulerPlugin = array();
|
||||||
@@ -147,20 +146,6 @@ class PMPluginRegistry {
|
|||||||
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $this->serializeInstance() );
|
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
|
* Register the plugin in the singleton
|
||||||
*
|
*
|
||||||
@@ -265,9 +250,10 @@ class PMPluginRegistry {
|
|||||||
unset ( $this->_aTriggers[ $key ] );
|
unset ( $this->_aTriggers[ $key ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $this->_aDashboards as $key=>$detail ) {
|
foreach ($this->_aDashlets as $key => $detail) {
|
||||||
if ( $detail == $sNamespace )
|
if ($detail == $sNamespace) {
|
||||||
unset ( $this->_aDashboards[ $key ] );
|
unset($this->_aDashlets[$key]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $this->_aReports as $key=>$detail ) {
|
foreach ( $this->_aReports as $key=>$detail ) {
|
||||||
@@ -293,10 +279,6 @@ class PMPluginRegistry {
|
|||||||
if ( $detail->sNamespace == $sNamespace )
|
if ( $detail->sNamespace == $sNamespace )
|
||||||
unset ( $this->_aToolbarFiles[ $key ] );
|
unset ( $this->_aToolbarFiles[ $key ] );
|
||||||
}
|
}
|
||||||
foreach ( $this->_aDashboardPages as $key=>$detail ) {
|
|
||||||
if ( $detail->sNamespace == $sNamespace )
|
|
||||||
unset ( $this->_aDashboardPages[ $key ] );
|
|
||||||
}
|
|
||||||
foreach ( $this->_aCSSStyleSheets as $key=>$detail ) {
|
foreach ( $this->_aCSSStyleSheets as $key=>$detail ) {
|
||||||
if ( $detail->sNamespace == $sNamespace )
|
if ( $detail->sNamespace == $sNamespace )
|
||||||
unset ( $this->_aCSSStyleSheets[ $key ] );
|
unset ( $this->_aCSSStyleSheets[ $key ] );
|
||||||
@@ -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 $className
|
||||||
* @param unknown_type $sMenuId
|
|
||||||
* @param unknown_type $sFilename
|
|
||||||
*/
|
*/
|
||||||
function registerDashboard($sNamespace ) {
|
function registerDashlets($namespace) {
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ( $this->_aDashboards as $row=>$detail ) {
|
foreach ($this->_aDashlets as $row => $detail) {
|
||||||
if ( $sNamespace == $detail )
|
if ($namespace == $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;
|
|
||||||
$found = true;
|
$found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
$dashboardPage = new dashboardPage ($sNamespace, $sPage, $sName, $sIcon);
|
$this->_aDashlets[] = $namespace;
|
||||||
$this->_aDashboardPages[] = $dashboardPage;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* return all dashboard pages
|
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
function getDashboardPages() {
|
|
||||||
return $this->_aDashboardPages;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a stylesheet in the singleton
|
* Register a stylesheet in the singleton
|
||||||
*
|
*
|
||||||
@@ -554,7 +505,7 @@ class PMPluginRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return all dashboard pages
|
* return all css
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
@@ -781,17 +732,11 @@ class PMPluginRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return all dashboards registered
|
* return all dashlets classes registered
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getDashboards( ) {
|
function getDashlets() {
|
||||||
return $this->_aDashboards;
|
return $this->_aDashlets;
|
||||||
$dash = array ();
|
|
||||||
foreach ( $this->_aDashboards as $row=>$detail ) {
|
|
||||||
$sClassName = str_replace ( 'plugin', 'class', $this->_aPluginDetails[ $detail ]->sClassName);
|
|
||||||
$dash[] = $sClassName;
|
|
||||||
}
|
|
||||||
return $dash;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -809,17 +754,17 @@ class PMPluginRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns all dashboards registered
|
* This function returns all pmFunctions registered
|
||||||
* @ array
|
* @ array
|
||||||
*/
|
*/
|
||||||
function getPmFunctions( ) {
|
function getPmFunctions( ) {
|
||||||
return $this->_aPmFunctions;
|
return $this->_aPmFunctions;
|
||||||
$dash = array ();
|
$pmf = array ();
|
||||||
foreach ( $this->_aPmFunctions as $row=>$detail ) {
|
foreach ( $this->_aPmFunctions as $row=>$detail ) {
|
||||||
$sClassName = str_replace ( 'plugin', 'class', $this->_aPluginDetails[ $detail ]->sClassName);
|
$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
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once 'interfaces/dashletInterface.php';
|
require_once 'classes/interfaces/dashletInterface.php';
|
||||||
require_once 'model/Dashlet.php';
|
require_once 'classes/model/Dashlet.php';
|
||||||
require_once 'model/DashletInstance.php';
|
require_once 'classes/model/DashletInstance.php';
|
||||||
|
|
||||||
class PMDashlet extends DashletInstance implements DashletInterface {
|
class PMDashlet extends DashletInstance implements DashletInterface {
|
||||||
|
|
||||||
@@ -14,7 +14,14 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
|||||||
|
|
||||||
public static function getAdditionalFields($className) {
|
public static function getAdditionalFields($className) {
|
||||||
try {
|
try {
|
||||||
//Change this in the next release
|
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);
|
G::LoadClass($className);
|
||||||
eval("\$additionalFields = $className::getAdditionalFields(\$className);");
|
eval("\$additionalFields = $className::getAdditionalFields(\$className);");
|
||||||
return $additionalFields;
|
return $additionalFields;
|
||||||
@@ -24,11 +31,22 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function setup($dasInsUid) {
|
public function setup($dasInsUid) {
|
||||||
try {
|
try {
|
||||||
$this->dashletInstance = $this->loadDashletInstance($dasInsUid);
|
$this->dashletInstance = $this->loadDashletInstance($dasInsUid);
|
||||||
G::LoadClass($this->dashletInstance['DAS_CLASS']);
|
$className = $this->dashletInstance['DAS_CLASS'];
|
||||||
$this->dashletObject = new $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);
|
$this->dashletObject->setup($this->dashletInstance);
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
catch (Exception $error) {
|
||||||
@@ -174,6 +192,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
|||||||
$dataset->next();
|
$dataset->next();
|
||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
||||||
|
$row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
|
||||||
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
||||||
}
|
}
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
@@ -192,6 +211,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
|||||||
$dataset->next();
|
$dataset->next();
|
||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
||||||
|
$row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
|
||||||
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
||||||
}
|
}
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
@@ -212,6 +232,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
|||||||
$dataset->next();
|
$dataset->next();
|
||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
||||||
|
$row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
|
||||||
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
||||||
}
|
}
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
@@ -234,6 +255,7 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
|||||||
$dataset->next();
|
$dataset->next();
|
||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
if (!isset($dashletsInstances[$row['DAS_INS_UID']])) {
|
||||||
|
$row['DAS_XTEMPLATE'] = $this->getXTemplate($row['DAS_CLASS']);
|
||||||
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
$dashletsInstances[$row['DAS_INS_UID']] = $row;
|
||||||
}
|
}
|
||||||
$dataset->next();
|
$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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
interface DashletInterface {
|
interface DashletInterface {
|
||||||
|
|
||||||
public static function getAdditionalFields($className);
|
public static function getAdditionalFields($className);
|
||||||
|
public static function getXTemplate($className);
|
||||||
public function setup($dasInsUid);
|
public function setup($dasInsUid);
|
||||||
public function render();
|
public function render();
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,13 @@ class Dashlet extends BaseDashlet {
|
|||||||
public function load($dasUid) {
|
public function load($dasUid) {
|
||||||
try {
|
try {
|
||||||
$dashlet = DashletPeer::retrieveByPK($dasUid);
|
$dashlet = DashletPeer::retrieveByPK($dasUid);
|
||||||
|
if (!is_null($dashlet)) {
|
||||||
return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
|
return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception $error) {
|
catch (Exception $error) {
|
||||||
throw $error;
|
throw $error;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ class Dashboard extends Controller {
|
|||||||
$this->pmDashlet->render($width);
|
$this->pmDashlet->render($width);
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
catch (Exception $error) {
|
||||||
//ToDo: Render a image with the error message
|
//ToDo: Show the error message
|
||||||
|
echo $error->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,8 +174,13 @@ class Dashboard extends Controller {
|
|||||||
try {
|
try {
|
||||||
$dashlet = new Dashlet();
|
$dashlet = new Dashlet();
|
||||||
$dashletFields = $dashlet->load($data->DAS_UID);
|
$dashletFields = $dashlet->load($data->DAS_UID);
|
||||||
|
if (!is_null($dashletFields)) {
|
||||||
$result->additionaFields = PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']);
|
$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->status = 'ERROR';
|
||||||
$result->message = $error->getMessage();
|
$result->message = $error->getMessage();
|
||||||
@@ -299,6 +305,7 @@ class Dashboard extends Controller {
|
|||||||
$dashlets[] = array($row['DAS_UID'], $row['DAS_TITLE']);
|
$dashlets[] = array($row['DAS_UID'], $row['DAS_TITLE']);
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception $error) {
|
catch (Exception $error) {
|
||||||
throw $error;
|
throw $error;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ Ext.onReady(function() {
|
|||||||
name: 'DAS_UID',
|
name: 'DAS_UID',
|
||||||
fieldLabel: 'Dashboard',
|
fieldLabel: 'Dashboard',
|
||||||
editable: false,
|
editable: false,
|
||||||
width: 325,
|
width: 320,
|
||||||
store: storeDasUID,
|
store: storeDasUID,
|
||||||
triggerAction: 'all',
|
triggerAction: 'all',
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
@@ -105,7 +105,7 @@ Ext.onReady(function() {
|
|||||||
name: 'DAS_INS_OWNER_TYPE',
|
name: 'DAS_INS_OWNER_TYPE',
|
||||||
fieldLabel: 'Assign To',
|
fieldLabel: 'Assign To',
|
||||||
editable: false,
|
editable: false,
|
||||||
width: 325,
|
width: 320,
|
||||||
store: storeDasInsOwnerType,
|
store: storeDasInsOwnerType,
|
||||||
triggerAction: 'all',
|
triggerAction: 'all',
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
@@ -128,7 +128,7 @@ Ext.onReady(function() {
|
|||||||
name: 'DAS_INS_OWNER_UID',
|
name: 'DAS_INS_OWNER_UID',
|
||||||
fieldLabel: 'Name',
|
fieldLabel: 'Name',
|
||||||
editable: false,
|
editable: false,
|
||||||
width: 325,
|
width: 320,
|
||||||
store: storeDasInsOwnerUID,
|
store: storeDasInsOwnerUID,
|
||||||
triggerAction: 'all',
|
triggerAction: 'all',
|
||||||
mode: 'local',
|
mode: 'local',
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Ext.onReady(function(){
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
xtype: 'tbbutton',
|
xtype: 'tbbutton',
|
||||||
text : 'three columns',
|
text : 'Three Columns',
|
||||||
handler : function(a) {
|
handler : function(a) {
|
||||||
var vp = Ext.getCmp('viewportDashboard');
|
var vp = Ext.getCmp('viewportDashboard');
|
||||||
var pd = Ext.getCmp('portalDashboard');
|
var pd = Ext.getCmp('portalDashboard');
|
||||||
@@ -35,7 +35,7 @@ Ext.onReady(function(){
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
xtype: 'tbbutton',
|
xtype: 'tbbutton',
|
||||||
text : 'two columns',
|
text : 'Two Columns',
|
||||||
handler : function(a) {
|
handler : function(a) {
|
||||||
var vp = Ext.getCmp('viewportDashboard');
|
var vp = Ext.getCmp('viewportDashboard');
|
||||||
var pd = Ext.getCmp('portalDashboard');
|
var pd = Ext.getCmp('portalDashboard');
|
||||||
@@ -47,53 +47,7 @@ Ext.onReady(function(){
|
|||||||
pd.items.items[2].columnWidth = 0.01;
|
pd.items.items[2].columnWidth = 0.01;
|
||||||
pd.doLayout();
|
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("<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>").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 pd = Ext.getCmp('portalDashboard');
|
||||||
var dashletClass = "";
|
|
||||||
|
|
||||||
for (var i = 0; i < dashletsInstances.length; i++) {
|
for (var i = 0; i < dashletsInstances.length; i++) {
|
||||||
dashletClass = dashletsInstances[i].DAS_CLASS;
|
|
||||||
|
|
||||||
switch (dashletClass) {
|
|
||||||
case "dashletOpenVSCompleted":
|
|
||||||
var np = new Ext.ux.Portlet({
|
var np = new Ext.ux.Portlet({
|
||||||
title: dashletsInstances[i].DAS_TITLE,
|
title: dashletsInstances[i].DAS_TITLE,
|
||||||
|
index: i,
|
||||||
dasInsUid : dashletsInstances[i].DAS_INS_UID,
|
dasInsUid : dashletsInstances[i].DAS_INS_UID,
|
||||||
html: 'gauge placeholder',
|
html: 'Gauge Placeholder',
|
||||||
listeners: {
|
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) {
|
'resize': function(p, w, h) {
|
||||||
var randomnumber = Math.floor(Math.random() * 1000000)
|
var template = new Ext.XTemplate(dashletsInstances[p.index].DAS_XTEMPLATE).apply({
|
||||||
var img = new Ext.XTemplate("<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>").apply({
|
id: p.dasInsUid,
|
||||||
page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id: p.dasInsUid })
|
page: 'dashboard/renderDashletInstance',
|
||||||
p.update(img);
|
width: w - 12,
|
||||||
}
|
random: Math.floor(Math.random() * 1000000)
|
||||||
}
|
|
||||||
});
|
|
||||||
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("<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"" + (w - 12) + "\" height=\"216\" frameborder=\"0\"></iframe>").apply({
|
|
||||||
page: "dashboard/renderDashletInstance",
|
|
||||||
id: p.dasInsUid
|
|
||||||
})
|
})
|
||||||
|
p.update(template);
|
||||||
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("<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"" + (w - 12) + "\" height=\"216\" frameborder=\"0\"></iframe>").apply({
|
|
||||||
page: "dashboard/renderDashletInstance",
|
|
||||||
id: p.dasInsUid
|
|
||||||
})
|
|
||||||
|
|
||||||
p.update(img);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
pd.items.items[i % 3].add(np);
|
pd.items.items[i % 3].add(np);
|
||||||
} //for
|
}
|
||||||
|
|
||||||
pd.doLayout();
|
pd.doLayout();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user