From 64ae174938ac6108302f0539f1377938592c649f Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 18 Dec 2008 09:23:35 +0000 Subject: [PATCH] Updated device seletion. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13313 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/goto/SelectDeviceType.tpl | 8 +++-- .../systems/goto/class_SelectDeviceType.inc | 33 +++++++++---------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl b/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl index 87534b97f..90ecc5668 100644 --- a/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl +++ b/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl @@ -21,7 +21,8 @@ {t}System type{/t}  - {html_options values=$SystemTypeKeys output=$SystemTypes selected=$SystemType} @@ -34,7 +35,10 @@ {t}Choose an object group as template{/t}  diff --git a/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc b/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc index d92bb51d1..e988fcca3 100644 --- a/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc +++ b/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc @@ -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])){ -- 2.30.2