Code

Added ability to add members
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 17 Sep 2010 13:28:36 +0000 (13:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 17 Sep 2010 13:28:36 +0000 (13:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19756 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/Device/InstallRecipe.tpl
gosa-plugins/goto/admin/systems/goto/Device/class_InstallRecipe.inc

index b59988f3c53ae456b12b272f33498fc86151e508..efee6ed4b4f83f1ae909c459a0d3b234c29187cb 100644 (file)
@@ -1,8 +1,26 @@
 <table>
+    <tr>
+        <td><LABEL for="kickstartRootEnabled">{t}Root enabled{/t}</LABEL></td>
+        <td>
+            <input type='checkbox' value='1' {if $kickstartRootEnabled} checked {/if}
+                onClick="changeState('kickstartRootPasswordHash');"
+                name="kickstartRootEnabled" id="kickstartRootEnabled" 
+               >
+        </td>
+    </tr>
+    <tr>
+        <td><LABEL for="kickstartRootPasswordHash">{t}Root password hash{/t}</LABEL></td>
+        <td>
+            <input type='text' name="kickstartRootPasswordHash" id="kickstartRootPasswordHash"
+                {if !$kickstartRootEnabled} disabled {/if} value="{$kickstartRootPasswordHash}">
+        </td>
+    </tr>
     <tr>
         <td><LABEL for="member">{t}Member{/t}</LABEL></td>
         <td>
-            <input type='text' name="member" id="member" value="{$member}">
+            {$memberList}
+            <input type='text' name="member" id="member" value="">
+            <button name='addMember' type='submit'>{msgPool type='addButton'}</button>
         </td>
     </tr>
     <tr>
@@ -13,7 +31,6 @@
     </tr>
     <tr>
         <td><LABEL for="kickstartKeyboardlayout">{t}Keyboard layout{/t}</LABEL></td>
-
         <td>
             <input type='text' name="kickstartKeyboardlayout" id="kickstartKeyboardlayout" value="{$kickstartKeyboardlayout}">
         </td>
@@ -32,7 +49,6 @@
             </select>
         </td>
     </tr>
-
     <tr>
         <td><LABEL for="kickstartTimeUTC">{t}UTC Time{/t}</LABEL></td>
         <td>
             <input type='text' name="kickstartMirrorDN" id="kickstartMirrorDN" value="{$kickstartMirrorDN}">
         </td>
     </tr>
-    <tr>
-        <td><LABEL for="kickstartRootEnabled">{t}Root enabled{/t}</LABEL></td>
-        <td>
-            <input type='text' name="kickstartRootEnabled" id="kickstartRootEnabled" value="{$kickstartRootEnabled}">
-        </td>
-    </tr>
-
-    <tr>
-        <td><LABEL for="kickstartRootPasswordHash">{t}Root password hash{/t}</LABEL></td>
-        <td>
-            <input type='text' name="kickstartRootPasswordHash" id="kickstartRootPasswordHash" value="{$kickstartRootPasswordHash}">
-        </td>
-    </tr>
     <tr>
         <td><LABEL for="kickstartKernelPackage">{t}Kernel package{/t}</LABEL></td>
         <td>
@@ -77,3 +80,4 @@
         </td>
     </tr>
 </table>
+
index 55037749e8bd3a2d3d8c37dc741ce4c427c329d9..b0c3fb068483f447ee6d6e89fa978442a52613b1 100644 (file)
@@ -45,6 +45,15 @@ class InstallRecipe extends plugin
         }  
         uksort($list, 'strnatcasecmp'); 
         $this->timezones = $list;
+
+        // Prepare member list 
+        $this->memberList= new sortableListing($this->member);
+        $this->memberList->setDeleteable(true);
+        $this->memberList->setColspecs(array('*'));
+        $this->memberList->setWidth("100%");
+        $this->memberList->setHeight("70px");
+    
     }
 
     function execute()
@@ -55,18 +64,36 @@ class InstallRecipe extends plugin
         foreach($this->attributes as $attr){
             $smarty->assign($attr, $this->$attr);
         }
+
+        // Fill and render the member list widget
+        $this->memberList->setListData($this->member);
+        $this->memberList->update();
+        $this->memberList->setAcl($this->getacl('member'));
+        $smarty->assign('memberList', $this->memberList->render());
         return($smarty->fetch(get_template_path('goto/Device/InstallRecipe.tpl', TRUE)));
     }
 
+    
+    function save_object()
+    {
+        plugin::save_object();
+        $this->kickstartRootEnabled = isset($_POST['kickstartRootEnabled']);
+
+        // Update the member list widget. 
+        $this->memberList->save_object();
+        $this->member = $this->memberList->getMaintainedData();
+        if(isset($_POST['member']) && isset($_POST['addMember'])){
+            $member= get_post('member');
+            $this->member[] = $member;
+        }
+    }
+
 
     function save()
     {
-        $this->member = array();
         plugin::save();
-        #$this->cleanup();
-
-        print_a($this->attrs);
 
+        $this->cleanup();
         $ldap=$this->config->get_ldap_link();
         $ldap->cd($this->config->current['BASE']);
         $ldap->cd($this->dn);