Code

Replaced headers, added tags
[gosa.git] / gosa-core / plugins / admin / departments / class_departmentManagement.inc
index e2db188d1d4ad28d260a66edc56c446634a3340e..effbb5717833f3438d52f657c8ab2d2972b6e439 100644 (file)
@@ -1,33 +1,30 @@
 <?php
 /*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 class departmentManagement extends plugin
 {
   /* Definitions */
   var $plHeadline= "Departments";
-  var $plDescription= "This does something";
-
-  /* CLI vars */
-  var $cli_summary= "Handling of LDAP subtrees";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+  var $plDescription= "Manage Departments";
 
   /* Headpage attributes */
   var $last_dep_sorting= "invalid";
@@ -63,7 +60,7 @@ class departmentManagement extends plugin
       Var init 
      ***************/
 
-    $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/","/^item_selected/","/^remove_multiple_departments/");
+    session::set('LOCK_VARS_TO_USE',array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/","/^item_selected/","/^remove_multiple_departments/"));
 
     /* Reload departments */
     $smarty                                            = get_smarty();
@@ -143,7 +140,7 @@ class departmentManagement extends plugin
       $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn,"department");
       $this->deptabs->set_acl_base($this->dn);
 
-      $_SESSION['objectinfo']= $this->dn;
+      session::set('objectinfo',$this->dn);
     }
 
 
@@ -203,7 +200,7 @@ class departmentManagement extends plugin
           $this->deptabs->delete ();
           $this->deptabs = NULL;
         } else {
-          print_red (_("You have no permission to remove this department."));
+          msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), WARNING_DIALOG);
         }
         /* Remove lock file after successfull deletion */
         del_lock ($dn);
@@ -241,7 +238,7 @@ class departmentManagement extends plugin
 
         /* Check locking */
         if (($user= get_lock($this->dn)) != ""){
-          $_SESSION['dn']= $this->dn;
+          session::set('dn',$this->dn);
           return(gen_locked_message($user, $this->dn));
         } else {
           add_lock ($this->dn, $this->ui->dn);
@@ -251,7 +248,7 @@ class departmentManagement extends plugin
           return ($display);
         }
       }else{
-        print_red (_("You have no permission to remove this department."));
+        msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), WARNING_DIALOG);
       }
     }
 
@@ -270,7 +267,7 @@ class departmentManagement extends plugin
       if(preg_match("/d/",$acl)){
         $this->remove_from_parent();
       } else {
-        print_red (_("You have no permission to remove this department."));
+        msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), WARNING_DIALOG);
       }
     }
 
@@ -379,7 +376,7 @@ class departmentManagement extends plugin
       }
       unset ($this->deptabs);
       $this->deptabs= NULL;
-      unset ($_SESSION['objectinfo']);
+      session::un_set('objectinfo');
     }
 
 
@@ -394,7 +391,7 @@ class departmentManagement extends plugin
       del_lock ($this->dn);
       unset($this->depdabs);
       $this->deptabs= NULL;
-      unset ($_SESSION['objectinfo']);
+      session::un_set('objectinfo');
     }
 
     /* Headpage or normal plugin screen? */
@@ -430,7 +427,8 @@ class departmentManagement extends plugin
     $Regex        = $this->DivListDepartment->Regex;
   
     // Create Array to Test if we have a valid back button
-    $tmp = $_SESSION['config']->idepartments;
+    $config = session::get('config');
+    $tmp = $config->idepartments;
 
     // In case of a valid back button create entry
     if(isset($tmp[$base_back])){
@@ -490,7 +488,7 @@ class departmentManagement extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);