From dfda6547c0ae81b34c058a5c2c582657adc074e3 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 19 May 2011 09:19:10 +0000 Subject: [PATCH] Updated Template Widgets to support ACls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20880 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../TemplateEngine/TemplateWidget_textEditor.tpl | 10 +++++----- .../class_TemplateWidget_checkbox.inc | 10 +++++----- .../class_TemplateWidget_combobox.inc | 14 ++++++++------ .../TemplateEngine/class_TemplateWidget_file.inc | 12 +++++++----- .../class_TemplateWidget_fixedList.inc | 8 +++++--- .../TemplateEngine/class_TemplateWidget_list.inc | 14 ++++++++++---- .../class_TemplateWidget_stringLong.inc | 3 ++- .../class_TemplateWidget_textEditor.inc | 2 ++ .../class_TemplateWidget_textarea.inc | 6 ++++-- 9 files changed, 48 insertions(+), 31 deletions(-) diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateWidget_textEditor.tpl b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateWidget_textEditor.tpl index 06d78b65c..011c2bbd5 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateWidget_textEditor.tpl +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/TemplateWidget_textEditor.tpl @@ -1,12 +1,12 @@ {if $write_protect} {t}The text is write protected due to its encoding. Editing may break it!{/t}
- + {/if} - + rows="20" cols="120">{if $readable}{$value}{/if}
-   - +   +
diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc index 27488cbef..acb795840 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc @@ -4,15 +4,15 @@ class TemplateWidget_checkbox extends TemplateWidget { function render() { - $str = ""; - $disabled = (!$this->enabled)? "disabled" : ""; - $str .= "enabled || !$this->writeable)? "disabled" : ""; + $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName; + $str = ""; + $str .= "value) $str .= " checked "; - $str .= ">"; - $str .= ""; + $str .= ""; return($str); } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc index e1b4ecdb4..7be45f158 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc @@ -7,13 +7,15 @@ class TemplateWidget_combobox extends TemplateWidget $str = ""; // Build up list data - $disabled = (!$this->enabled)? "disabled" : ""; - $str .= ""; + foreach($this->values as $option => $value){ + if($option == $this->value){ + $str .= "\n"; }else{ - $str .= "\n"; + $str .= "\n"; } } $str .= ""; diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_file.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_file.inc index 197d6453a..8598afff9 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_file.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_file.inc @@ -29,22 +29,24 @@ class TemplateWidget_file extends TemplateWidget function render() { + $disabled = (!$this->enabled || !$this->writeable)? "disabled" : ""; + $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName; + $title = set_post($this->description); - $disabled = (!$this->enabled) ? 'disalbed' : ''; if(mb_strlen($this->value) == 0){ $ret = ""._("No file uploaded yet").""; $ret.= "
- postName}\" - name=\"{$this->postName}\" +  "; - $ret.= ""; + $ret.= ""; }else{ $ret = ""._("File uploaded").": ".mb_strlen($this->value)." "._("Bytes"); - $ret.= " "; + $ret.= " "; } return($ret); } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc index 8e227e218..892d4ba35 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc @@ -34,7 +34,9 @@ class TemplateWidget_fixedList extends TemplateWidget // Build up list data $this->listWidget->setDeleteable($this->enabled); - $disabled = (!$this->enabled)? "disabled" : ""; + $disabled = (!$this->enabled || !$this->writeable)? "disabled" : ""; + $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName; + $data = $this->value; foreach($this->value as $key => $name){ $lData[$key] = array('data' => array($this->values[$name])); @@ -42,12 +44,12 @@ class TemplateWidget_fixedList extends TemplateWidget $this->listWidget->setListData($data, $lData); $this->listWidget->update(); $str .= $this->listWidget->render(); - $str .= ""; foreach($this->getAvailableOptions() as $name => $value){ $str .= "\n"; } $str .= ""; - $str .= ""; + $str .= ""; return($str); } 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 8bf17a07f..de77b6eb1 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 @@ -13,7 +13,7 @@ class TemplateWidget_list extends TemplateWidget $this->listWidget->setColspecs(array('*')); $this->listWidget->setWidth("100%"); $this->listWidget->setHeight("70px"); - $this->listWidget->setAcl("rwcdm"); + $this->listWidget->setAcl(""); } @@ -24,10 +24,16 @@ class TemplateWidget_list extends TemplateWidget $this->listWidget->setListData($this->value); $this->listWidget->update(); $str .= $this->listWidget->render(); - $disabled = (!$this->enabled)? "disabled" : ""; + $disabled = (!$this->enabled || !$this->writeable)? "disabled" : ""; + $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName; - $str .= ""; - $str .= ""; + $acls = ""; + $acls.= ($this->writeable && $this->enabled) ? 'w' : ''; + $acls.= ($this->readable) ? 'r' : ''; + $this->listWidget->setAcl($acls); + + $str .= ""; + $str .= ""; return($str); } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_stringLong.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_stringLong.inc index 671b4b134..02d2ad0db 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_stringLong.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_stringLong.inc @@ -11,7 +11,8 @@ class TemplateWidget_stringLong extends TemplateWidget $value = " value=\"{$value}\" "; $title = (empty($this->description))?"": " title=\"{$desc}\""; - $disabled = (!$this->enabled)? "disabled" : ""; + $disabled = (!$this->enabled || !$this->writeable)? "disabled" : ""; + $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $name; return(""); } } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc index ce85384bb..b052507e9 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textEditor.inc @@ -27,6 +27,8 @@ class TemplateWidget_textEditor extends TemplateWidget $smarty->assign("write_protect", set_post($this->write_protect)); $smarty->assign("value", set_post($this->value)); $smarty->assign("enabled", set_post($this->enabled)); + $smarty->assign("readable", set_post($this->readable)); + $smarty->assign("writeable", set_post($this->writeable)); return($smarty->fetch(get_template_path("TemplateWidget_textEditor.tpl", TRUE, dirname(__FILE__)))); } diff --git a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc index 8ca6ff838..0cbd34246 100644 --- a/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc +++ b/gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc @@ -5,12 +5,14 @@ class TemplateWidget_textarea extends TemplateWidget function render() { $title = set_post($this->description); - $disabled = (!$this->enabled)? "disabled" : ""; + + $disabled = (!$this->enabled || !$this->writeable)? "disabled" : ""; + $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName; return(""); + name=\"{$name}\">".set_post($this->value).""); } } -- 2.30.2