From: hickert Date: Mon, 27 Sep 2010 11:44:42 +0000 (+0000) Subject: Updated list widget X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2262b88ab64dddc51a3a707f45f04a6d00431a63;p=gosa.git Updated list widget git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19797 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc index 0f92ffb18..15935ae90 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc @@ -19,22 +19,20 @@ class TemplateWidget $this->required = $required; $this->type = $type; $this->display = $display; + $class = get_class(); + $this->postName = "{$class}_{$this->name}"; } function render() { - - $class = get_class(); - return("{$this->display} name}\" value=\"".set_post($this->value)."\">"); + return("{$this->display} postName}\" value=\"".set_post($this->value)."\">"); } function save_object() { - $class = get_class(); - $name = "{$class}_{$this->name}"; - if(isset($_POST[$name])){ - $this->value = get_post($name); + if(isset($_POST[$this->postName])){ + $this->value = get_post($this->postName); } } diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc index 549b39cff..a7072ac69 100644 --- a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc +++ b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc @@ -2,15 +2,46 @@ class TemplateWidget_list extends TemplateWidget { + function __construct(&$config, $name, $value, $description,$required,$type,$display) + { + parent:: __construct($config, $name, $value, $description,$required,$type,$display); + + $this->listWidget= new sortableListing($this->value); + $this->listWidget->setEditable(false); + $this->listWidget->setDeleteable(true); + $this->listWidget->setColspecs(array('*')); + $this->listWidget->setWidth("100%"); + $this->listWidget->setHeight("70px"); + $this->listWidget->setAcl("rwcdm"); + } + + function render() { - $str = ""; - foreach($this->value as $id => $val){ - $str.= "{$val}, "; - } + $str = $this->display." "; + $this->listWidget->setListData($this->value); + $this->listWidget->update(); + $str .= $this->listWidget->render(); + $str .= ""; + $str .= ""; return($str); } + 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"); + $this->value[] = $input; + } + } }