From a2350ffc90c4e5f80fcdb77ef5677e26f65bd26d Mon Sep 17 00:00:00 2001
From: hickert
Date: Fri, 16 May 2008 13:33:13 +0000
Subject: [PATCH] Updated system activation
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10934 594d385d-05f5-0310-b6e9-bd551577e9d8
---
.../admin/systems/goto/SelectDeviceType.tpl | 9 ++++++
.../systems/goto/class_SelectDeviceType.inc | 30 +++++++++++++++----
2 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl b/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl
index 6e0e8bf9a..79bb51ae6 100644
--- a/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl
+++ b/gosa-plugins/goto/admin/systems/goto/SelectDeviceType.tpl
@@ -6,10 +6,19 @@
+{if $dns_cnt == 1}
{t}Please select a system type and an optional bundle of predefined settings to be inherited.{/t}
+{else}
+{t}Please select a system type and an bundle of predefined settings to be inherited.{/t}
+{/if}
+
+{foreach from=$dns item=item}
+ {$item}
+{/foreach}
+
diff --git a/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc b/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc
index 378d5beec..e734199e4 100644
--- a/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc
+++ b/gosa-plugins/goto/admin/systems/goto/class_SelectDeviceType.inc
@@ -13,9 +13,17 @@ class SelectDeviceType extends plugin
var $ObjectGroup = "";
var $SystemType = "";
+ var $dn;
+
function SelectDeviceType (&$config, $dn= NULL)
{
- plugin::plugin ($config, $dn);
+ plugin::plugin ($config, NULL);
+
+ if(!is_array($dn)){
+ $this->dns = array($dn);
+ }else{
+ $this->dns = $dn;
+ }
/* Get object groups */
$ldap = $this->config->get_ldap_link();
@@ -26,8 +34,7 @@ class SelectDeviceType extends plugin
$tmp[$attrs['dn']]= $attrs['cn'][0];
}
asort($tmp, SORT_LOCALE_STRING);
- $tmpa['none']=_("none");
- $this->ObjectGroups= array_merge($tmpa, $tmp);
+ $this->ObjectGroups= $tmp;
$this->SystemTypes =array("workstation"=>_("Workstation"), "terminal"=>_("Terminal"), "server"=>_("Server"));
}
@@ -41,8 +48,21 @@ class SelectDeviceType extends plugin
$smarty= get_smarty();
$display= "";
- $smarty->assign("ObjectGroups" ,$this->ObjectGroups);
- $smarty->assign("ObjectGroupKeys" ,array_flip($this->ObjectGroups));
+ $smarty->assign("dns" , $this->dns);
+ $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("SystemTypes" ,$this->SystemTypes);
$smarty->assign("SystemTypeKeys" ,array_flip($this->SystemTypes));
--
2.30.2