Code

fixed style
[gosa.git] / plugins / admin / groups / class_groupGeneric.inc
index f4fc95da9122c6d0c375abb1b6088e82662408ed..dbb3d78900cde347f81ee9f1d0ad610d192e4583 100644 (file)
@@ -32,6 +32,7 @@ class group extends plugin
   var $orig_dn= "";
   var $has_mailAccount= FALSE;
   var $group_dialog= FALSE;
+  var $nagios_group =FALSE;
 
   /* attribute list for save action */
   var $attributes= array("cn", "description", "gidNumber");
@@ -75,6 +76,11 @@ class group extends plugin
       } else {
         $this->fon_group= TRUE;
       }
+      if (array_search ('nagiosContactGroup', $this->attrs['objectClass']) == NULL ){
+        $this->nagios_group= FALSE;
+      } else {
+        $this->nagios_group= TRUE;
+      }
     }
 
     /* Set mail flag */
@@ -128,6 +134,20 @@ class group extends plugin
     }
     $gufilter= get_global('gufilter');
 
+      /* Bases / Departments */
+      
+    if(isset($_SESSION['groupfilter']['depselect'])){
+      $this->base = $_SESSION['groupfilter']['depselect'];
+    }else{
+      if ($this->dn == "new"){
+        $ui= get_userinfo();
+        $this->base= dn2base($ui->dn);
+      } else {
+        $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
+      }
+    }
+
+
     /* This is always an account */
     $this->is_account= TRUE;
     $this->reload();
@@ -135,9 +155,12 @@ class group extends plugin
 
   function execute()
   {
+       /* Call parent execute */
+       plugin::execute();
+
     /* Do we represent a valid group? */
     if (!$this->is_account && $this->parent == NULL){
-      $display= "<img src=\"images/stop.png\" align=center>&nbsp;<b>".
+      $display= "<img alt=\"\" src=\"images/stop.png\" align=\"middle\">&nbsp;<b>".
         _("This 'dn' is no group.")."</b>";
       return ($display);
     }
@@ -181,6 +204,18 @@ class group extends plugin
       $smarty->assign("samba3", "");
     }
 
+    if(search_config($this->config->data['MENU'], "nagiosaccount", "CLASS")){
+      $smarty->assign("nagios",true);
+    }else{
+      $smarty->assign("nagios",false);
+    }
+    
+    if(search_config($this->config->data['MENU'], "phoneAccount", "CLASS")){
+      $smarty->assign("pickupGroup",true);
+    }else{
+      $smarty->assign("pickupGroup",false);
+    }
+
     /* Manage object add dialog */
     if ($this->group_dialog){
 
@@ -222,20 +257,14 @@ class group extends plugin
         }
       }
       $smarty->assign("users", $users);
+      $smarty->assign("apply", apply_filter());
       $display= $smarty->fetch (get_template_path('group_objects.tpl', TRUE, dirname(__FILE__)));
       return ($display);
     }
 
     /* Bases / Departments */
-    if ($this->dn == "new"){
-      $ui= get_userinfo();
-      $this->base= dn2base($ui->dn);
-    } else {
-      if (isset($_POST['base'])){
-        $this->base= $_POST['base'];
-      } else {
-        $this->base= preg_replace ("/^[^,]+,[^,]+,/", "", $this->dn);
-      }
+    if (isset($_POST['base'])){
+      $this->base= $_POST['base'];
     }
 
     $smarty->assign("bases", $this->config->idepartments);
@@ -280,15 +309,29 @@ class group extends plugin
     $smarty->assign("sambaDomainNameACL", chkacl($this->acl, "sambaDomainName"));
     if ($this->fon_group){
       $smarty->assign("fon_group", "checked");
+    } else {
+      $smarty->assign("fon_group", "");
     }
     $smarty->assign("fon_groupACL", chkacl($this->acl, "fon_group"));
 
+    if ($this->nagios_group){
+      $smarty->assign("nagios_group", "checked");
+    } else {
+      $smarty->assign("nagios_group", "");
+    }
+    $smarty->assign("nagios_groupACL", chkacl($this->acl, "nagios_group"));
+
     /* Fields */
     foreach (array("cn", "description", "gidNumber") as $val){
       $smarty->assign("$val", $this->$val);
       $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
     }
 
+    /* Missing ACL's */
+    foreach (array("base", "smbgroup", "members") as $val){
+      $smarty->assign("$val"."ACL", chkacl($this->acl, "$val"));
+    }
+
     /* Show main page */
     $smarty->assign("alphabet", generate_alphabet(10));
     $smarty->assign("search_image", get_template_path('images/search.png'));
@@ -329,7 +372,7 @@ class group extends plugin
     natcasesort ($this->users);
     reset ($this->users);
 
-    $ldap->cd ($this->config->current['BASE']);
+    $ldap->cd ($gufilter['dselect']);
     $ldap->search ("(&(objectClass=gosaAccount)(!(objectClass=gosaUserTemplate))(!(uid=*$)))");
     $this->allusers= array();
     while ($attrs= $ldap->fetch()){
@@ -412,7 +455,13 @@ class group extends plugin
           $this->fon_group= FALSE;
         }
       }
-
+        if (chkacl ($this->acl, "nagios_group") == ""){
+        if (isset ($_POST['nagios_group'])){
+          $this->nagios_group= TRUE;
+        } else {
+          $this->nagios_group= FALSE;
+        }
+      }
     }
   }
 
@@ -447,7 +496,8 @@ class group extends plugin
     for ($i= 0; $i<count($this->attrs["objectClass"]); $i++){
       if ($this->attrs['objectClass'][$i] != 'sambaGroupMapping' &&
           $this->attrs['objectClass'][$i] != 'sambaIdmapEntry' &&
-          $this->attrs['objectClass'][$i] != 'goFonPickupGroup'){
+          $this->attrs['objectClass'][$i] != 'goFonPickupGroup' &&
+        $this->attrs['objectClass'][$i] != 'nagiosContactGroup'){
         $tmp[]= $this->attrs['objectClass'][$i];
       }
     }
@@ -499,6 +549,11 @@ class group extends plugin
       $this->attrs['objectClass'][]= "goFonPickupGroup";
     }
 
+    /* Add nagios functionality */
+    if ($this->nagios_group){
+       $this->attrs['objectClass'][]= "nagiosContactGroup";
+    }
+
     /* Take members array */
     if (count ($this->memberUid)){
       $this->attrs['memberUid']= array_unique($this->memberUid);