From 691ee6d5bc28810c775aa396be6d103880a199e4 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 28 Jan 2008 14:26:00 +0000 Subject: [PATCH] Prepared ogroup fot terminal service. -If terminal is added, add the terminal service tab. -Only allow one system type at once, terminals or workstations. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8621 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../plugins/admin/ogroups/class_ogroup.inc | 25 +++++++++++++++---- .../plugins/admin/ogroups/tabs_ogroups.inc | 13 ++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/gosa-core/plugins/admin/ogroups/class_ogroup.inc b/gosa-core/plugins/admin/ogroups/class_ogroup.inc index ef6388f32..5e1dec7ae 100644 --- a/gosa-core/plugins/admin/ogroups/class_ogroup.inc +++ b/gosa-core/plugins/admin/ogroups/class_ogroup.inc @@ -127,12 +127,27 @@ class ogroup extends plugin /* Add objects to group */ if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){ + + $tmp = ""; + foreach($this->memberList as $obj){ + $tmp .= $obj['type']; + } + $skipped = FALSE; foreach ($_POST['objects'] as $value){ - $this->memberList["$value"]= $this->objects[$value]; - $this->member["$value"]= $value; - unset ($this->objects[$value]); - uasort ($this->memberList, 'sort_list'); - reset ($this->memberList); + if(preg_match("/T/",$tmp) && $this->objects[$value]['type'] == "W"){ + $skipped =TRUE; + }elseif(preg_match("/W/",$tmp) && $this->objects[$value]['type'] == "T"){ + $skipped =TRUE; + }else{ + $this->memberList["$value"]= $this->objects[$value]; + $this->member["$value"]= $value; + unset ($this->objects[$value]); + uasort ($this->memberList, 'sort_list'); + reset ($this->memberList); + } + } + if($skipped){ + print_red(_("You can only have terminals or workstations in one group, but not both.")); } $this->reload(); } diff --git a/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc b/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc index 3cbeccd92..adcc709f5 100644 --- a/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc +++ b/gosa-core/plugins/admin/ogroups/tabs_ogroups.inc @@ -41,6 +41,11 @@ class ogrouptabs extends tabs unset($this->by_object['termgroup']); unset($this->by_name['termgroup']); } + if(((!preg_match("/T/",$objects)) && (!preg_match("/W/",$objects)))&&(isset($this->by_object['termservice']))){ + $this->by_object['termservice']->remove_from_parent(); + unset($this->by_object['termservice']); + unset($this->by_name['termservice']); + } /* Remove ws tabs, if theres no ws left in the object list */ if((!preg_match("/W/",$objects))&&(isset($this->by_object['workservice']))){ @@ -97,6 +102,11 @@ class ogrouptabs extends tabs $this->by_object['termgroup']->inheritTimeServer = false; $this->by_object['termgroup']->parent= &$this; } + if(!isset($this->by_object['termservice'])){ + $this->by_name['termservice']= _("Service"); + $this->by_object['termservice']= new termservice($this->config, $this->dn); + $this->by_object['termservice']->parent= &$this; + } } /* Add Workstation tabs */ @@ -194,6 +204,9 @@ class ogrouptabs extends tabs $this->by_object['termgroup']= new termgroup($this->config, $this->dn); $this->by_object['termgroup']->parent= &$this; + $this->by_name['termservice']= _("Service"); + $this->by_object['termservice']= new termservice($this->config, $this->dn); + $this->by_object['termservice']->parent= &$this; break; case "U": -- 2.30.2