Code

Added combobox and checkbox widget
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Oct 2010 07:33:04 +0000 (07:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Oct 2010 07:33:04 +0000 (07:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19896 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_checkbox.inc [new file with mode: 0644]
gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_comboBox.inc [new file with mode: 0644]
gosa-plugins/goto/admin/systems/goto/Config/puppet.tpl

diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_checkbox.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_checkbox.inc
new file mode 100644 (file)
index 0000000..cd6cb1b
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+
+class TemplateWidget_checkbox extends TemplateWidget
+{
+    function render()
+    {
+        $str = "";
+        $str .= "<input type='checkbox' value='1' name='{$this->postName}' ";
+            if($this->value) $str .= " checked ";
+        $str .= ">";
+        return($str);
+    }
+
+    function save_object()
+    {
+        $this->value = isset($_POST[$this->postName]);
+    }
+}
+?>
diff --git a/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_comboBox.inc b/gosa-plugins/goto/admin/systems/goto/Config/class_TemplateWidget_comboBox.inc
new file mode 100644 (file)
index 0000000..a1f0443
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+class TemplateWidget_comboBox extends TemplateWidget
+{
+    function render()
+    {
+        $str = "";
+
+        // Build up list data
+        $str .= "<select size='1' name='{$this->postName}'>";
+        foreach($this->values as $name => $value){
+            if($name == $this->value){
+                $str .= "<option selected value=\"{$name}\">{$value}</option>\n";
+            }else{
+                $str .= "<option value=\"{$name}\">{$value}</option>\n";
+            }
+        }
+        $str .= "</select>";
+        return($str);
+    }
+}
+?>
index aceefdb0cf818d9380bd42262248b46cfba55a01..c0359729aa2faed5b5f9e6558277fbfb1bf63781 100644 (file)
             </td>
         </tr>
     </table>
-    {$textEditorName}
+    <hr>
+    {$checkboxName}
+    {$checkbox}
+
+    <hr>
+    {$comboBoxName}
+    {$comboBox}
+
+    <hr>
+    {$textEditorName}<br>
     {$textEditor}
 
-    {$fixedListName}
+    <hr>
+    {$fixedListName}<br>
     {$fixedList}
 {/if}
 {if $type == 'PuppetTemplate'}