Code

Prepared ogroup fot terminal service.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Jan 2008 14:26:00 +0000 (14:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Jan 2008 14:26:00 +0000 (14:26 +0000)
-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

gosa-core/plugins/admin/ogroups/class_ogroup.inc
gosa-core/plugins/admin/ogroups/tabs_ogroups.inc

index ef6388f32550e37b33025b504bf4c60c351fbfce..5e1dec7ae4113b6f7d64c8df6c33587f1cb3a738 100644 (file)
@@ -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();
       }
index 3cbeccd92639f7a3222adbc534e5b9e0e2c57cf3..adcc709f596173e9fb467ad8a2b1594dd30d87bb 100644 (file)
@@ -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":