Code

Updated trunk, introduced gosa-core
[gosa.git] / plugins / admin / departments / class_departmentManagement.inc
index 3524b15f436149ef3227832f29e8d77312255f9a..e2db188d1d4ad28d260a66edc56c446634a3340e 100644 (file)
@@ -17,7 +17,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-require "tabs_department.inc";
 
 class departmentManagement extends plugin
 {
@@ -45,11 +44,11 @@ class departmentManagement extends plugin
   var $ObjectTaggingRequested   = false;    // Object must be tagged, an iframe will be shown. 
   var $RecursiveRemoveRequested = false;    // Is true, if this object must be moved, an iframe will be displayed in this case
 
-  function departmentManagement ($config, $ui)
+  function departmentManagement (&$config, &$ui)
   {
-    $this->ui= $ui;
+    $this->ui= &$ui;
     $this->dn= "";
-    $this->config= $config;
+    $this->config= &$config;
     $this->DivListDepartment = new divListDepartment($this->config,$this);
   }
 
@@ -99,6 +98,16 @@ class departmentManagement extends plugin
       }
     }
 
+    /* Create options */
+    if(isset($_POST['menu_action']) && $_POST['menu_action'] == "dep_new"){
+      $s_action = "new";
+    }
+
+    /* handle remove from layers menu */
+    if(isset($_POST['menu_action']) && preg_match("/^remove_multiple/",$_POST['menu_action'])){
+      $s_action = "del_multiple";
+    }
+
 
     /***************
       Create a new department
@@ -193,7 +202,6 @@ class departmentManagement extends plugin
           $this->deptabs->set_acl_base();
           $this->deptabs->delete ();
           $this->deptabs = NULL;
-          gosa_log ("Department object'".$this->dn."' has been removed");
         } else {
           print_red (_("You have no permission to remove this department."));
         }
@@ -238,6 +246,7 @@ class departmentManagement extends plugin
         } else {
           add_lock ($this->dn, $this->ui->dn);
           $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), @LDAP::fix($this->dn)));
+          $smarty->assign("multiple", false);
           $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
           return ($display);
         }
@@ -260,7 +269,6 @@ class departmentManagement extends plugin
       $acl = $this->ui->get_permissions($this->dn,"department/department");
       if(preg_match("/d/",$acl)){
         $this->remove_from_parent();
-        gosa_log ("Department object'".$this->dn."' has been removed");
       } else {
         print_red (_("You have no permission to remove this department."));
       }
@@ -291,7 +299,10 @@ class departmentManagement extends plugin
       if (count($message) == 0){
 
         $this->deptabs->save(true);
-        $this->config->get_departments();
+        global $config;
+        $config->get_departments();
+        $config->make_idepartments();
+        $this->config = $config;
 
         /* This object must be tagged, so set ObjectTaggingRequested to true */
         if($this->deptabs->by_object['department']->must_be_tagged()){
@@ -366,7 +377,6 @@ class departmentManagement extends plugin
       if ($this->dn != "new"){
         del_lock ($this->dn);
       }
-      gosa_log ("Department object'".$this->dn."' has been saved");
       unset ($this->deptabs);
       $this->deptabs= NULL;
       unset ($_SESSION['objectinfo']);
@@ -388,7 +398,7 @@ class departmentManagement extends plugin
     }
 
     /* Headpage or normal plugin screen? */
-    if ($this->deptabs != NULL){
+    if ($this->deptabs !== NULL){
 
       /* Show main page (tabs) */
       $display= $this->deptabs->execute();
@@ -430,7 +440,7 @@ class departmentManagement extends plugin
       if(empty($tmp2['dn'])){
         $tmp2['dn']="/";
       }
-      $tmp2    ['description'][0] = _("..");
+      $tmp2    ['description'][0] = ".. "._("Back");
       $result[$tmp[$base_back]]=$tmp2;
     }
 
@@ -494,7 +504,7 @@ class departmentManagement extends plugin
   {
     $ids = array();
     foreach($_POST as $name => $value){
-      if(preg_match("/^item_selected_[a-z0-9\=]*$/i",$name)){
+      if(preg_match("/^item_selected_[a-z0-9\\/\=]*$/i",$name)){
         $id   = preg_replace("/^item_selected_/","",$name);
         $ids[$id] = $id;
       }