Code

Updated device seletion.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 18 Dec 2008 09:23:35 +0000 (09:23 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 18 Dec 2008 09:23:35 +0000 (09:23 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13313 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl
gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc

index 87534b97f2f874d2c9eac4e9a68bc63d57ce2e5a..90ecc566858e71eb488c48e64e4c928104d752af 100644 (file)
@@ -21,7 +21,8 @@
     <tr>
      <td> 
       {t}System type{/t}&nbsp;
-         <select name="SystemType" title="{t}System type{/t}" style="width:120px;">
+         <select name="SystemType" title="{t}System type{/t}" style="width:120px;"
+                       onChange="document.mainform.submit();">
        {html_options values=$SystemTypeKeys output=$SystemTypes selected=$SystemType}
       </select>
      </td>
      <td> 
       {t}Choose an object group as template{/t}&nbsp;
          <select name="ObjectGroup" title="{t}Object group{/t}" style="width:120px;">
-       {html_options values=$ObjectGroupKeys output=$ObjectGroups selected=$ObjectGroup}
+               {if $dns_cnt == 1}
+               <option value='none'>{t}none{/t}</option>       
+               {/if}
+       {html_options options=$ogroups selected=$ObjectGroup}
       </select>
      </td>
     </tr>
index d92bb51d1b79e4678682e783d9476c5ba1079e90..e988fcca32632a27d1f8eca17e16141e090198ec 100644 (file)
@@ -10,8 +10,8 @@ class SelectDeviceType extends plugin
   var $ObjectGroups   = array();
   var $SystemTypes       = array();
 
-  var $ObjectGroup    = "";
-  var $SystemType        = "";
+  var $ObjectGroup    = "none";
+  var $SystemType        = "workstation";
 
   var $dn;
 
@@ -47,30 +47,27 @@ class SelectDeviceType extends plugin
     /* Call parent execute */
     plugin::execute();
 
+
+    /* Get object groups */
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd ($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("gosaGroupObjects","cn"));
+    $tmp= array("W" => array(),"T" => array(), "S" => array(),"O" => array());
+    while($attrs = $ldap->fetch()){
+      $tmp[preg_replace("/[\[\] ]/","",$attrs['gosaGroupObjects'][0])][$attrs['dn']] = $attrs['cn'][0];
+    }
+
     /* Fill templating stuff */
     $smarty= get_smarty();
     $display= "";
 
+    $map = array("workstation" => "W","terminal" => "T","server" => "S", "opsi_client" => "O");
     $smarty->assign("dns_cnt" , count($this->dns));
-
-    /* Add none to the list of object groups, if there is only one 
-        object that currently edited. This will allow to modify attributes manually and 
-        skip object group inherit.
-     */
-    $ogs = $this->ObjectGroups;
-    if(count($this->dns) == 1){
-      $tmpa['none']=_("none");
-      $ogs = array_merge($tmpa,$ogs);
-    }
-
-    $smarty->assign("ObjectGroups"    ,$ogs);
-    $smarty->assign("ObjectGroupKeys" ,array_flip($ogs));
+    $smarty->assign("ogroups", $tmp[$map[$this->SystemType]]);
     $smarty->assign("SystemTypes"     ,$this->SystemTypes);
     $smarty->assign("SystemTypeKeys"  ,array_flip($this->SystemTypes)); 
-
     $smarty->assign("ObjectGroup",$this->ObjectGroup);
     $smarty->assign("SystemType",$this->SystemType);
-
     $display.= $smarty->fetch(get_template_path('SelectDeviceType.tpl', TRUE,dirname(__FILE__)));
     return($display);
   }
@@ -78,6 +75,8 @@ class SelectDeviceType extends plugin
   /* Save data to object */
   function save_object()
   {
+
+    echo "Calleed";
     plugin::save_object();
     foreach($this->attributes as $attr){
       if(isset($_POST[$attr])){