From 0da15006c0376c245dc2be80c9e0964b2db2419c Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 19 May 2011 12:50:25 +0000 Subject: [PATCH] Fixed Listing temlate git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20888 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_TemplateWidget_list.inc | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_list.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_list.inc index de77b6eb1..a73f4ed09 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_list.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_list.inc @@ -10,28 +10,27 @@ class TemplateWidget_list extends TemplateWidget $this->listWidget= new sortableListing($this->value); $this->listWidget->setEditable(false); $this->listWidget->setDeleteable(true); + $this->listWidget->setInstantDelete(true); $this->listWidget->setColspecs(array('*')); $this->listWidget->setWidth("100%"); $this->listWidget->setHeight("70px"); $this->listWidget->setAcl(""); + + $acls = ""; + $acls.= ($this->writeable && $this->enabled) ? 'wdmc' : ''; + $acls.= ($this->readable) ? 'r' : ''; + $this->listWidget->setAcl($acls); + $this->listWidget->setListData($this->value); + $this->listWidget->update(); } function render() { - $str = ""; - $this->listWidget->setDeleteable($this->enabled); - $this->listWidget->setListData($this->value); - $this->listWidget->update(); - $str .= $this->listWidget->render(); + $str = $this->listWidget->render(); $disabled = (!$this->enabled || !$this->writeable)? "disabled" : ""; $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName; - $acls = ""; - $acls.= ($this->writeable && $this->enabled) ? 'w' : ''; - $acls.= ($this->readable) ? 'r' : ''; - $this->listWidget->setAcl($acls); - $str .= ""; $str .= ""; return($str); @@ -40,22 +39,16 @@ class TemplateWidget_list extends TemplateWidget function save_object() { $this->listWidget->save_object(); - $action = $this->listWidget->getAction(); - if($action['action'] == 'delete'){ - $id = $this->listWidget->getKey($action['targets'][0]); - unset($this->value[$id]); - $this->value = array_values($this->value); - } - if(isset($_POST["{$this->postName}_Add"]) && isset($_POST["{$this->postName}_Input"])){ $input = get_post("{$this->postName}_Input"); - if(!empty($input) && !empty($this->syntax) && !preg_match("/".$this->syntax."/", $input)){ msg_dialog::displayChecks(array(msgPool::invalid($this->display, $input, "/".$this->syntax."/"))); }elseif(!empty($input)){ - $this->value[] = $input; + $this->listWidget->addEntry($input); } } + + $this->value = $this->listWidget->getMaintainedData(); } /*! \brief Check the value entry using the provieded syntax. -- 2.30.2