diff --git a/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc b/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc
index 5b9ebfb20c08bbcfabe35c5898f223bdd0a054fc..9e1c10975b0b2860c8b348cd9bb23f898e3279d8 100644 (file)
var $ObjectGroups = array();
var $SystemTypes = array();
- var $ObjectGroup = "";
- var $SystemType = "";
+ var $ObjectGroup = "none";
+ var $SystemType = "gotoWorkstation";
+
+ var $dn;
function SelectDeviceType (&$config, $dn= NULL)
{
- plugin::plugin ($config, $dn);
+ if(!is_array($dn)){
+ $this->dns = array($dn);
+ }else{
+ $this->dns = $dn;
+ }
+ plugin::plugin ($config, NULL);
/* Get object groups */
$ldap = $this->config->get_ldap_link();
$ldap->cd ($this->config->current['BASE']);
$ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
- $this->ObjectGroups['none']=_("none");
+ $tmp= array();
while($attrs = $ldap->fetch()){
- $this->ObjectGroups[$attrs['dn']]= $attrs['cn'][0];
+ $tmp[$attrs['dn']]= $attrs['cn'][0];
}
+ asort($tmp, SORT_LOCALE_STRING);
+ $this->ObjectGroups= $tmp;
- $this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server"));
+ $this->SystemTypes =array("gotoWorkstation"=>_("Workstation"), "gotoTerminal"=>_("Terminal"), "goServer"=>_("Server"));
+ if(class_available("opsi")){
+ $this->SystemTypes["FAKE_OC_OpsiHost"]= _("Windows workstation");
+ }
}
function execute()
/* 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= "";
- $smarty->assign("ObjectGroups" ,$this->ObjectGroups);
- $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
+ $map = array("gotoWorkstation" => "W","gotoTerminal" => "T","goServer" => "S", "FAKE_OC_OpsiHost" => "O");
+ $smarty->assign("dns_cnt" , count($this->dns));
+ $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);
}