Code

Added release selector
[gosa.git] / gosa-core / plugins / admin / ogroups / class_ogroup.inc
index e98bc65c2b0c5175976ef1c6592dc51bb61f229a..40f8bc600eb55fca13fe736a481c38df301b5a01 100644 (file)
@@ -42,7 +42,6 @@ class ogroup extends plugin
   var $description= "";
   var $base= "";
   var $gosaGroupObjects= "";
-  var $department= "";
   var $objects= array();
   var $objcache= array();
   var $memberList= array();
@@ -86,44 +85,10 @@ class ogroup extends plugin
     }
     $this->is_account= TRUE;
 
-    /* Get global filter config */
-    if (!session::is_set("ogfilter")){
-      $ui= get_userinfo();
-      $base= get_base_from_people($ui->dn);
-      $ogfilter= array( "dselect"       => $base,
-          "regex"           => "*");
-      session::set("ogfilter", $ogfilter);
-    }
-    $ogfilter= session::get('ogfilter');
-
-    /* Adjust flags */
-    foreach( array(   "U" => "accounts",
-          "G" => "groups",
-          "A" => "applications",
-          "D" => "departments",
-          "S" => "servers",
-          "W" => "workstations",
-          "O" => "winstations",
-          "T" => "terminals",
-          "F" => "phones",
-          "_" => "subtrees",
-          "P" => "printers") as $key => $val){
-
-      if (preg_match("/$key/", $this->gosaGroupObjects)){
-        $ogfilter[$val]= "checked";
-      } else {
-        $ogfilter[$val]= "";
-      }
-    }
-    session::set("ogfilter", $ogfilter);
-  
-    if(session::is_set('CurrentMainBase')){
-     $this->base  = session::get('CurrentMainBase');
-    }
-
     /* Set base */
     if ($this->dn == "new"){
-      $this->base = session::get('CurrentMainBase');
+      $ui = get_userinfo();
+      $this->base= dn2base(session::global_is_set("CurrentMainBase")?"cn=dummy,".session::global_get("CurrentMainBase"):$ui->dn);
     } else {
       $this->base= preg_replace("/^[^,]+,".preg_quote(get_ou("ogroupRDN"), '/')."/i","",$this->dn);
 
@@ -194,12 +159,12 @@ class ogroup extends plugin
 
       /* 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);
+      $this->reload(); 
     }else{
       /* Delete objects from group */
       if (isset($_POST['delete_membership']) && isset($_POST['members'])){
@@ -254,6 +219,7 @@ class ogroup extends plugin
         }
         $this->objectSelect= FALSE;
         $this->dialog= FALSE;
+        $this->reload();
       }
     }
   }
@@ -415,7 +381,6 @@ class ogroup extends plugin
 
     /* Assign variables */
     $smarty->assign("base", $this->baseSelector->render());
-    $smarty->assign("department", $this->department);
     $smarty->assign("members", $this->convert_list($this->memberList));
 
     /* Objects have to be tuned... */
@@ -702,7 +667,7 @@ class ogroup extends plugin
     $conv= array(  
         "Y" => "plugins/users/images/select_template.png",
         "U" => "plugins/generic/images/head.png",
-        "G" => "plugins/groups/images/groups.png",
+        "G" => "plugins/groups/images/select_group.png",
         "A" => "plugins/ogroups/images/application.png",
         "D" => "plugins/departments/images/department.png",
         "S" => "plugins/ogroups/images/server.png",
@@ -804,6 +769,11 @@ class ogroup extends plugin
       $message[]= msgPool::duplicated(_("Name"));
     } 
 
+    // Check if a wrong base was supplied
+    if(!$this->baseSelector->checkLastBaseUpdate()){
+      $message[]= msgPool::check_base();;
+    } 
+
     /* Set new acl base */
     if($this->dn == "new") {
       $this->set_acl_base($this->base);
@@ -814,6 +784,10 @@ class ogroup extends plugin
       $message[]= msgPool::required(_("Name"));
     }
 
+    if (preg_match('/[=,+<>#;]/', $this->cn)) { 
+      $message[] = msgPool::invalid(_("Name"), $this->cn, "/[^=+,<>#;]/"); 
+    } 
+
     /* To many different object types? */
     if (strlen($this->gosaGroupObjects) > 4){
       $message[]= _("You can combine two different object types at maximum, only!");