Code

Added priority to FAIclass selection
[gosa.git] / plugins / admin / ogroups / class_ogroup.inc
index 86c96ae95abf749cd163644350b7e4dee8b98b4a..b69b284ae968272e756dddf4a371c8f5d03be2c9 100644 (file)
@@ -87,18 +87,8 @@ class ogroup extends plugin
     $this->reload();
   }
 
-  function execute()
-  {
-    /* Do we represent a valid group? */
-    if (!$this->is_account){
-      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
-        _("This 'dn' is no object group.")."</b>";
-      return ($display);
-    }
-
-
-
-    /* Delete objects from group */
+  function AddDelMembership(){
+     /* Delete objects from group */
     if (isset($_POST['delete_membership']) && isset($_POST['members'])){
       foreach ($_POST['members'] as $value){
         $this->objects["$value"]= $this->memberList[$value];
@@ -121,6 +111,50 @@ class ogroup extends plugin
       }
       $this->reload();
     }
+  }
+
+  function execute()
+  {
+       /* Call parent execute */
+       plugin::execute();
+
+    
+    $this->reload();
+
+    /* Do we represent a valid group? */
+    if (!$this->is_account){
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
+        _("This 'dn' is no object group.")."</b>";
+      return ($display);
+    }
+
+    /* Delete objects from group */
+    if (isset($_POST['delete_membership']) && isset($_POST['members'])){
+      foreach ($_POST['members'] as $value){
+        if(isset($this->memberList[$value])){
+          $this->objects["$value"]= $this->memberList[$value];
+          unset ($this->memberList["$value"]);
+          unset ($this->member["$value"]);
+          uasort ($this->objects, 'sort_list');
+          reset ($this->objects);
+        }
+      }
+      $this->reload();
+    }
+
+    /* Add objects to group */
+    if (isset($_POST['add_object_finish']) && isset($_POST['objects'])){
+      foreach ($_POST['objects'] as $value){
+        if(isset($this->objects[$value])){
+          $this->memberList["$value"]= $this->objects[$value];
+          $this->member["$value"]= $value;
+          unset ($this->objects[$value]);
+          uasort ($this->memberList, 'sort_list');
+          reset ($this->memberList);
+        }
+      }
+      $this->reload();
+    }
 
     /* Load templating engine */
     $smarty= get_smarty();
@@ -497,11 +531,6 @@ class ogroup extends plugin
       $message[]= "The required field 'Name' is not set.";
     }
 
-    /* Need at least one member */
-    if (count($this->member) == 0){
-      $message[]= _("Object groups need at least one member!");
-    }
-
     /* To many different object types? */
     if (strlen($this->gosaGroupObjects) > 4){
       $message[]= _("You can combine two different object types at maximum only!");