Code

Updated Template widgets to support readable acls
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 19 May 2011 09:24:58 +0000 (09:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 19 May 2011 09:24:58 +0000 (09:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20882 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_checkbox.inc
gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_combobox.inc
gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_fixedList.inc
gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_string.inc
gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_stringLong.inc
gosa-plugins/goto-ng/admin/newConfigManagement/TemplateEngine/class_TemplateWidget_textarea.inc

index acb7958404c5c41b2fcc0fe2393235db000d10dc..a999ac3138e4c93e53e7bfc2a20b38eab8b1b629 100644 (file)
@@ -9,7 +9,7 @@ class TemplateWidget_checkbox extends TemplateWidget
 
         $str = "";
         $str .= "<input type='checkbox' value='1' name='{$name}' {$disabled}";
-        if($this->value) $str .= " checked ";
+        if($this->value && $this->readable) $str .= " checked ";
         $str .= ">";
 
         $str .= "<input type='hidden' name='{$name}_posted' value='1'>";
index 7be45f158d0ea9ddb27953fbc252c5662fa82151..f90b6967a0d3025604165a375ebb1702d9431b51 100644 (file)
@@ -11,11 +11,13 @@ class TemplateWidget_combobox extends TemplateWidget
         $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName;
 
         $str .= "<select size='1' name='{$name}' {$disabled}>";
-        foreach($this->values as $option => $value){
-            if($option == $this->value){
-                $str .= "<option selected value=\"{$option}\">{$value}</option>\n";
-            }else{
-                $str .= "<option value=\"{$option}\">{$value}</option>\n";
+        if($this->readable){
+            foreach($this->values as $option => $value){
+                if($option == $this->value){
+                    $str .= "<option selected value=\"{$option}\">{$value}</option>\n";
+                }else{
+                    $str .= "<option value=\"{$option}\">{$value}</option>\n";
+                }
             }
         }
         $str .= "</select>";
index 892d4ba3555d7f2d8788c85498cd38dc5bd6f5c1..bfbd02dd9d68ca47e9c26001c8bc227eed9e8b59 100644 (file)
@@ -45,8 +45,10 @@ class TemplateWidget_fixedList extends TemplateWidget
         $this->listWidget->update();
         $str .= $this->listWidget->render();
         $str .= "<select size='1' name='{$name}_Input' {$disabled}>";
-        foreach($this->getAvailableOptions() as $name => $value){
-            $str .= "<option value=\"{$name}\">{$value}</option>\n";
+        if($this->readable){
+            foreach($this->getAvailableOptions() as $name => $value){
+                $str .= "<option value=\"{$name}\">{$value}</option>\n";
+            }
         }
         $str .= "</select>";
         $str .= "<button name='{$name}_Add' {$disabled}>".msgPool::addButton()."</button>";
index 546517aa5262d6fb2f269f67b66acf43e6af5d9e..795c44376e70a3731afdbad07b5b8585bd648489 100644 (file)
@@ -5,7 +5,7 @@ class TemplateWidget_string extends TemplateWidget
     function render()
     {
         $desc = set_post($this->description);
-        $value = set_post($this->value);
+        $value = ($this->readable) ? set_post($this->value) : '';
 
         $name = " name=\"{$this->postName}\" ";
         $value = " value=\"{$value}\" ";
index 02d2ad0db4e0a6134ab61cf3c982a3944afea430..967195a6ee1857abba4d12c1234021ea3e471ec2 100644 (file)
@@ -5,7 +5,7 @@ class TemplateWidget_stringLong extends TemplateWidget
     function render()
     {
         $desc = set_post($this->description);
-        $value = set_post($this->value);
+        $value = ($this->readable) ? set_post($this->value) : "";
         
         $name = " name=\"{$this->postName}\" ";
         $value = " value=\"{$value}\" ";
index 0cbd34246bff3a00cb634a3adb8ec7bbdac68b51..f6fb1862c0ddaeb7bd264fdd2e0bd995dc33a7b8 100644 (file)
@@ -8,11 +8,13 @@ class TemplateWidget_textarea extends TemplateWidget
 
         $disabled = (!$this->enabled || !$this->writeable)? "disabled" : "";
         $name = (!$this->enabled || !$this->writeable)? "dummy".rand(0,10000) : $this->postName;
+    
+        $value = ($this->readable) ? $this->value : "";
         return("<textarea   title=\"{$title}\"
                             style='width:100%'
                             {$disabled} 
                             rows=4 type='text' 
-                            name=\"{$name}\">".set_post($this->value)."</textarea>");
+                            name=\"{$name}\">".set_post($value)."</textarea>");
     }
 
 }