Code

Updated ogroups
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 May 2010 12:06:40 +0000 (12:06 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 3 May 2010 12:06:40 +0000 (12:06 +0000)
-The attribute 'gosaGroupObjects' wasn't updated if new members were added.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@18024 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 811096435d808a421d685db562aa8ce925c9376d..a51f0e630027f8049361bca7d86d7c5ec0a8edfe 100644 (file)
@@ -184,74 +184,63 @@ class ogroup extends plugin
     $this->reload();
   }
 
-  function AddDelMembership($NewMember = false){
-
-    if($NewMember){
-
-      /* Add member and force reload */
-      $this->member[$NewMember]= $NewMember;
-      $this->reload(); 
-
-      $this->memberList[$NewMember]= $this->objcache[$NewMember];
-      unset ($this->objects[$NewMember]);
-      uasort ($this->memberList, 'sort_list');
-      reset ($this->memberList);
-    }else{
+  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];
-          unset ($this->memberList["$value"]);
-          unset ($this->member["$value"]);
-          uasort ($this->objects, 'sort_list');
-          reset ($this->objects);
-        }
-        $this->reload();
+          foreach ($_POST['members'] as $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['objectSelect_save']) && $this->objectSelect instanceOf objectSelect){
-        $objects = $this->objectSelect->save();
-        $skipped = FALSE;
-        foreach($objects as $object){
-
-          $tmp = "";
-          foreach($this->memberList as $obj){
-            $tmp .= $obj['type'];
-          }
-
-          $type  = $this->getObjectType($object);
-          $name= $this->getObjectName($object);
-          $dn = $object['dn'];
-
-          /* Fill array */
-          if (isset($object["description"][0])){
-            $object= array("text" => "$name [".$object["description"][0]."]", "type" => "$type");
-          } elseif (isset($object["uid"][0])) {
-            $object= array("text" => "$name [".$object["uid"][0]."]", "type" => "$type");
-          } else {
-            $object= array("text" => "$name", "type" => "$type");
+          $objects = $this->objectSelect->save();
+          $skipped = FALSE;
+          foreach($objects as $object){
+
+              $tmp = "";
+              foreach($this->memberList as $obj){
+                  $tmp .= $obj['type'];
+              }
+
+              $type  = $this->getObjectType($object);
+              $name= $this->getObjectName($object);
+              $dn = $object['dn'];
+
+              /* Fill array */
+              if (isset($object["description"][0])){
+                  $object= array("text" => "$name [".$object["description"][0]."]", "type" => "$type");
+              } elseif (isset($object["uid"][0])) {
+                  $object= array("text" => "$name [".$object["uid"][0]."]", "type" => "$type");
+              } else {
+                  $object= array("text" => "$name", "type" => "$type");
+              }
+
+              if(preg_match("/T/",$tmp) && $type == "W"){
+                  $skipped =TRUE;
+              }elseif(preg_match("/W/",$tmp) && $type == "T"){
+                  $skipped =TRUE;
+              }else{
+
+                  $this->memberList["$dn"]= $object;
+                  $this->member["$dn"]= $dn;
+                  uasort ($this->memberList, 'sort_list');
+                  reset ($this->memberList);
+              }
           }
-
-          if(preg_match("/T/",$tmp) && $type == "W"){
-            $skipped =TRUE;
-          }elseif(preg_match("/W/",$tmp) && $type == "T"){
-            $skipped =TRUE;
-          }else{
-
-            $this->memberList["$dn"]= $object;
-            $this->member["$dn"]= $dn;
-            uasort ($this->memberList, 'sort_list');
-            reset ($this->memberList);
+          if($skipped){
+              msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG);
           }
-        }
-        if($skipped){
-          msg_dialog::display(_("Information"), _("You cannot combine terminals and workstations in one object group!"), INFO_DIALOG);
-        }
-        $this->objectSelect= FALSE;
-        $this->dialog= FALSE;
+          $this->objectSelect= FALSE;
+          $this->dialog= FALSE;
+          $this->reload();
       }
-    }
   }
 
   function execute()
@@ -337,26 +326,6 @@ class ogroup extends plugin
      ***********/
 
 
-    /* Dialog handling */
-    if(is_object($this->dialog) && $this->acl_is_moveable()){
-      /* Must be called before save_object */
-      $this->dialog->save_object();
-
-      if($this->dialog->isClosed()){
-        $this->dialog = false;
-      }elseif($this->dialog->isSelected()){
-
-        /* A new base was selected, check if it is a valid one */
-        $tmp = $this->get_allowed_bases();
-        if(isset($tmp[$this->dialog->isSelected()])){
-          $this->base = $this->dialog->isSelected();
-        }
-        $this->dialog= false;
-      }else{
-        return($this->dialog->execute());
-      }
-    }
-
     /* Add objects? */
     if (isset($_POST["edit_membership"])){
       $this->objectSelect= new objectSelect($this->config, get_userinfo());