summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1e2796a)
raw | patch | inline | side by side (parent: 1e2796a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Sep 2010 11:44:42 +0000 (11:44 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 27 Sep 2010 11:44:42 +0000 (11:44 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19797 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget.inc | patch | blob | history | |
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_list.inc | patch | blob | history |
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 0f92ffb185d59f0a531b8ef341c057cfc096a09b..15935ae9068b325dd8feebbb91b4ea54b8525149 100644 (file)
$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} <input type='text' name=\"{$class}_{$this->name}\" value=\"".set_post($this->value)."\">");
+ return("{$this->display} <input type='text' name=\"{$this->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 549b39cff564e7488d96b1c41d64c3eb0c29d446..a7072ac69eee9eff93fa9085260faf024840f4e3 100644 (file)
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 .= "<input type='text' name='{$this->postName}_Input'>";
+ $str .= "<button name='{$this->postName}_Add'>".msgPool::addButton()."</button>";
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;
+ }
+ }
}