From 2d7729ba4b1eef794a1c75837b6e803a9cf2e409 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Mon, 31 Oct 2011 17:27:26 -0400 Subject: [PATCH] adding width in the controller and pmDashlet class --- .../classes/class.dashletOpenVSCompleted.php | 74 ++++++++----------- workflow/engine/classes/class.pmDashlet.php | 4 +- workflow/engine/controllers/dashboard.php | 9 ++- workflow/engine/templates/dashboard/index.js | 2 +- 4 files changed, 41 insertions(+), 48 deletions(-) diff --git a/workflow/engine/classes/class.dashletOpenVSCompleted.php b/workflow/engine/classes/class.dashletOpenVSCompleted.php index d1c6ada37..4409724fd 100644 --- a/workflow/engine/classes/class.dashletOpenVSCompleted.php +++ b/workflow/engine/classes/class.dashletOpenVSCompleted.php @@ -4,56 +4,42 @@ require_once 'interfaces/dashletInterface.php'; class dashletOpenVSCompleted implements DashletInterface { - /** - width - */ - var $w = 610; - - /** - height - */ - var $h = 300; - - /** - value of gauge - */ - var $value = 50; - - /** - maxValue - */ - var $maxValue = 100; - - /** - redFrom - */ - var $redFrom = 80; - - /** - redTo - */ - var $redTo = 100; - - /** - yellowFrom - */ - var $yellowFrom = 60; - - /** - yellowTo - */ - var $yellowTo = 80; - function setup($config) { +/* +Array +( + [DAS_UID] => 00000000000000000000000000000001 + [DAS_CLASS] => dashletOpenVSCompleted + [DAS_TITLE] => Open Cases VS Complete Cases + [DAS_DESCRIPTION] => Open Cases VS Complete Cases + [DAS_VERSION] => 1.0 + [DAS_CREATE_DATE] => 2011-10-28 00:00:00 + [DAS_UPDATE_DATE] => 2011-10-28 00:00:00 + [DAS_STATUS] => 1 + [DAS_INS_UID] => 00000000000000000000000000000001 + [DAS_INS_TYPE] => OPEN_CASES + [DAS_INS_CONTEXT_TIME] => MONTH + [DAS_INS_START_DATE] => + [DAS_INS_END_DATE] => + [DAS_INS_OWNER_TYPE] => DEPARTMENT + [DAS_INS_OWNER_UID] => 2502663244e6f5e1e3c2254024148892 + [DAS_INS_PROCESSES] => + [DAS_INS_TASKS] => + [DAS_INS_ADDITIONAL_PROPERTIES] => + [DAS_INS_CREATE_DATE] => 2011-10-28 00:00:00 + [DAS_INS_UPDATE_DATE] => 2011-10-28 00:00:00 + [DAS_INS_STATUS] => 1 +) +*/ + //$this->w = $config['w']; //loadData } - function render () { - print "hola"; die; + function render ($width = 300) { G::LoadClass('gauge'); - $g = new Gauge(); - //$g->w = $w; + $g = new pmGauge(); + $g->w = $width; //others $g->render(); } diff --git a/workflow/engine/classes/class.pmDashlet.php b/workflow/engine/classes/class.pmDashlet.php index 90a235279..532049a7b 100644 --- a/workflow/engine/classes/class.pmDashlet.php +++ b/workflow/engine/classes/class.pmDashlet.php @@ -23,12 +23,12 @@ class PMDashlet extends DashletInstance implements DashletInterface { } } - public function render() { + public function render($width = 300) { try { if (is_null($this->dashletObject)) { throw new Exception('Please call to the function "setup" before call the function "render".'); } - $this->dashletObject->render(); + $this->dashletObject->render($width); } catch (Exception $error) { throw $error; diff --git a/workflow/engine/controllers/dashboard.php b/workflow/engine/controllers/dashboard.php index a26c9ccd0..622f01ec4 100644 --- a/workflow/engine/controllers/dashboard.php +++ b/workflow/engine/controllers/dashboard.php @@ -39,7 +39,14 @@ class Dashboard extends Controller { throw new Exception('Parameter "DAS_INS_UID" is empty.'); } $this->pmDashlet->setup($data->DAS_INS_UID); - $this->pmDashlet->render(); + + if (!isset($_REQUEST['w']) ) { + $width = 300; + } + else { + $width = $_REQUEST['w']; + } + $this->pmDashlet->render( $width); } catch (Exception $error) { //ToDo: Render a image with the error message diff --git a/workflow/engine/templates/dashboard/index.js b/workflow/engine/templates/dashboard/index.js index adf702fb1..500b48dac 100644 --- a/workflow/engine/templates/dashboard/index.js +++ b/workflow/engine/templates/dashboard/index.js @@ -77,7 +77,7 @@ Ext.onReady(function(){ '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:'123456ABCDEF' }) + page: 'dashboard/renderDashletInstance', width:w, random: randomnumber, id:'00000000000000000000000000000001' }) p.update(img ); }