BUG 000 Add hook for dashlets
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once 'interfaces/dashletInterface.php';
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
|
||||
class dashletOpenVSCompleted implements DashletInterface {
|
||||
|
||||
@@ -35,7 +35,7 @@ class dashletOpenVSCompleted implements DashletInterface {
|
||||
$contextTime->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 "<img src='{page}?w={width}&r={random}&DAS_INS_UID={id}'>";
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once 'interfaces/dashletInterface.php';
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
|
||||
class dashletProcessMakerCommunity implements DashletInterface {
|
||||
|
||||
@@ -10,6 +10,10 @@ class dashletProcessMakerCommunity implements DashletInterface {
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
require_once 'interfaces/dashletInterface.php';
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
|
||||
class dashletProcessMakerEnterprise implements DashletInterface {
|
||||
|
||||
@@ -10,6 +10,10 @@ class dashletProcessMakerEnterprise implements DashletInterface {
|
||||
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) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
|
||||
require_once ( 'class.pluginRegistry.php');
|
||||
require_once 'class.pluginRegistry.php';
|
||||
|
||||
define('G_PLUGIN_CLASS', 1);
|
||||
|
||||
@@ -83,27 +83,6 @@ class toolbarDetail {
|
||||
$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,7 +91,7 @@ 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
|
||||
* @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
|
||||
* @return void
|
||||
*/
|
||||
function registerDashboard( ) {
|
||||
function registerDashlets() {
|
||||
$oPluginRegistry =& PMPluginRegistry::getSingleton();
|
||||
$oPluginRegistry->registerDashboard ( $this->sNamespace);
|
||||
$oPluginRegistry->registerDashlets($this->sNamespace);
|
||||
}
|
||||
|
||||
|
||||
@@ -535,16 +514,7 @@ class PMPlugin {
|
||||
$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
|
||||
*/
|
||||
|
||||
@@ -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 ] );
|
||||
@@ -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;
|
||||
$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
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once 'interfaces/dashletInterface.php';
|
||||
require_once 'model/Dashlet.php';
|
||||
require_once 'model/DashletInstance.php';
|
||||
require_once 'classes/interfaces/dashletInterface.php';
|
||||
require_once 'classes/model/Dashlet.php';
|
||||
require_once 'classes/model/DashletInstance.php';
|
||||
|
||||
class PMDashlet extends DashletInstance implements DashletInterface {
|
||||
|
||||
@@ -14,7 +14,14 @@ class PMDashlet extends DashletInstance implements DashletInterface {
|
||||
|
||||
public static function getAdditionalFields($className) {
|
||||
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);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
interface DashletInterface {
|
||||
|
||||
public static function getAdditionalFields($className);
|
||||
public static function getXTemplate($className);
|
||||
public function setup($dasInsUid);
|
||||
public function render();
|
||||
|
||||
|
||||
@@ -19,8 +19,13 @@ class Dashlet extends BaseDashlet {
|
||||
public function load($dasUid) {
|
||||
try {
|
||||
$dashlet = DashletPeer::retrieveByPK($dasUid);
|
||||
if (!is_null($dashlet)) {
|
||||
return $dashlet->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
|
||||
@@ -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,8 +174,13 @@ class Dashboard extends Controller {
|
||||
try {
|
||||
$dashlet = new Dashlet();
|
||||
$dashletFields = $dashlet->load($data->DAS_UID);
|
||||
if (!is_null($dashletFields)) {
|
||||
$result->additionaFields = PMDashlet::getAdditionalFields($dashletFields['DAS_CLASS']);
|
||||
}
|
||||
else {
|
||||
throw new Exception('Dashlet "' . $data->DAS_UID . '" not exists.');
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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("<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 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,
|
||||
index: i,
|
||||
dasInsUid : dashletsInstances[i].DAS_INS_UID,
|
||||
html: 'gauge placeholder',
|
||||
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: 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("<iframe src=\"{page}?DAS_INS_UID={id}\" width=\"" + (w - 12) + "\" height=\"216\" frameborder=\"0\"></iframe>").apply({
|
||||
page: "dashboard/renderDashletInstance",
|
||||
id: p.dasInsUid
|
||||
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(img);
|
||||
p.update(template);
|
||||
}
|
||||
}
|
||||
});
|
||||
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);
|
||||
} //for
|
||||
|
||||
}
|
||||
pd.doLayout();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user