diff --git a/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc b/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc
index e734199e45154cde4fe0e90007cd096b5a421d21..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, NULL);
-
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();
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("dns" , $this->dns);
+ $map = array("gotoWorkstation" => "W","gotoTerminal" => "T","goServer" => "S", "FAKE_OC_OpsiHost" => "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);
}