From 2103c45c23d6fda5cfd240fa33994dbeb70a7c5a Mon Sep 17 00:00:00 2001 From: Julio Cesar Laura Date: Mon, 31 Oct 2011 17:23:04 -0400 Subject: [PATCH] Progress 9 for the dashboards --- workflow/engine/classes/class.pmDashlet.php | 1 + workflow/engine/controllers/dashboard.php | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/workflow/engine/classes/class.pmDashlet.php b/workflow/engine/classes/class.pmDashlet.php index 32be422f2..90a235279 100644 --- a/workflow/engine/classes/class.pmDashlet.php +++ b/workflow/engine/classes/class.pmDashlet.php @@ -14,6 +14,7 @@ class PMDashlet extends DashletInstance implements DashletInterface { public function setup($dasInsUid) { try { $dashletInstance = $this->getDashletInstance($dasInsUid); + G::LoadClass($dashletInstance['DAS_CLASS']); $this->dashletObject = new $dashletInstance['DAS_CLASS'](); $this->dashletObject->setup($dashletInstance); } diff --git a/workflow/engine/controllers/dashboard.php b/workflow/engine/controllers/dashboard.php index 09c3b342b..a26c9ccd0 100644 --- a/workflow/engine/controllers/dashboard.php +++ b/workflow/engine/controllers/dashboard.php @@ -114,7 +114,7 @@ class Dashboard extends Controller { $result = new stdclass(); $result->status = 'OK'; try { - $this->pmDashlet->saveDashletInstance($data); + $this->pmDashlet->saveDashletInstance(get_object_vars($data)); } catch (Exception $error) { $result->status = 'ERROR'; @@ -123,12 +123,18 @@ class Dashboard extends Controller { return $result; } - public function deleteDashletInstance($dasInsUid) { + public function deleteDashletInstance($data) { $this->setResponseType('json'); $result = new stdclass(); $result->status = 'OK'; try { - $this->pmDashlet->deleteDashletInstance($dasInsUid); + if (!isset($data->DAS_INS_UID)) { + $data->DAS_INS_UID = ''; + } + if ($data->DAS_INS_UID == '') { + throw new Exception('Parameter "DAS_INS_UID" is empty.'); + } + $this->pmDashlet->deleteDashletInstance($data->DAS_INS_UID); } catch (Exception $error) { $result->status = 'ERROR';