From 9005d8924c9133289758f3460f7ae4d501d4f229 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 12 Apr 2010 09:55:39 +0000 Subject: [PATCH] Updated gotoEvent dialog -Removed old style lists git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17585 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/goto/events/class_DaemonEvent.inc | 56 ++++++++++--------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc index d107c6e15..1095b9f1d 100644 --- a/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc @@ -118,6 +118,18 @@ class DaemonEvent $this->periodType = $tmp[1]; } } + + // Prepare lists + $this->targetList = new sortableListing(); + $this->targetList->setDeleteable(true); + $this->targetList->setInstantDelete(false); + $this->targetList->setEditable(false); + $this->targetList->setWidth("100%"); + $this->targetList->setHeight("200px"); + $this->targetList->setColspecs(array('*')); + $this->targetList->setHeader(array(_("Mac"))); + $this->targetList->setDefaultSortColumn(0); + $this->targetList->setAcl('rwcdm'); } @@ -131,9 +143,8 @@ class DaemonEvent $str = "

"._("This job has no template!")."

"; $str.= "
"; - $str.= "
- -
"; + $str.= "
+
"; return($str); } @@ -159,9 +170,9 @@ class DaemonEvent return(""); } $str = "
"; - $str.= "
-   - + $str.= "
+   +
"; return($str); } @@ -243,22 +254,22 @@ class DaemonEvent } - /*! \brief HTML representation of all currently assigned targets using (divSelectBox). + /*! \brief HTML representation of all currently assigned targets. @return String Returns a listbox with all used targets. */ public function get_target_list() { + $data = $lData = array(); + $this->target_list_used = TRUE; - $divlist = new divSelectBox("EventTargets"); foreach($this->a_targets as $key => $target){ - $divlist->AddEntry(array( - array("string" => $target), - array("string" => "", - "attach" => "style='width:20px; border-right:0px;'") - )); + $data[$key] = $target; + $lData[$key] = array('data' => array($target)); } - $list_footer = ""; - return($divlist->DrawList().$list_footer); + $this->targetList->setListData($data, $lData); + $this->targetList->update(); + $list_footer = ""; + return($this->targetList->render().$list_footer); } @@ -326,16 +337,11 @@ class DaemonEvent } } - if($this->target_list_used){ - foreach($_POST as $name => $value){ - if(preg_match("/^del_target_/",$name)){ - $id = preg_replace("/^del_target_([0-9]*)_.*/","\\1",$name); - if(isset($this->a_targets[$id])){ - unset($this->a_targets[$id]); - } - break; - } - } + $this->targetList->save_object(); + $action = $this->targetList->getAction(); + if($action['action'] == 'delete'){ + $id = $this->targetList->getKey($action['targets'][0]); + unset($this->a_targets[$id]); } } -- 2.30.2