Code

Fixed User dialog, to detect changed attributes correctly
[gosa.git] / plugins / admin / departments / class_departmentManagement.inc
index 18e87123dc3ef96e6e5e549d18121db676b8b96f..2a1e2e523a85bdc5efbe9d061dff3a96d6cc2b7f 100644 (file)
@@ -56,6 +56,9 @@ class departmentManagement extends plugin
 
        function execute()
        {
+       /* Call parent execute */
+       plugin::execute();
+
                /* Reload departments */
                $this->config->departments      = get_departments();
                $smarty                                         = get_smarty();
@@ -139,12 +142,9 @@ class departmentManagement extends plugin
                /* New Entry if Posted action (s_action) == new
                 */
                if ($s_action=="new"){
-                       $this->acl= array(":all");
                        $this->dn= "new";
-
                        $this->deptabs= new deptabs($this->config,
                                        $this->config->data['TABS']['DEPTABS'], $this->dn);
-                       $this->deptabs->set_acl($this->acl);
                }
 
                /* Edit Entry if Posted action (s_action) == edit 
@@ -182,7 +182,7 @@ class departmentManagement extends plugin
                                return(gen_locked_message($user, $this->dn));
                        } else {
                                add_lock ($this->dn, $this->ui->dn);
-                               $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn));
+                               $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), LDAP::fix($this->dn)));
                                $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE));
                                return ($display);
                        }
@@ -194,7 +194,7 @@ class departmentManagement extends plugin
                if (isset($_POST['delete_department_confirm'])){
                        $acl= get_permissions ($this->dn, $this->ui->subtreeACL);
                        $acl= get_module_permission($acl, "department", $this->dn);
-                       if (chkacl($acl, "all") == ""){
+                       if (chkacl($acl, "delete") == ""){
                                $this->remove_from_parent();
                                gosa_log ("Department object'".$this->dn."' has been removed");
                                $this->reload ();
@@ -274,29 +274,29 @@ class departmentManagement extends plugin
 
                        /* Generate list head */
                        $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
-                                               " <input type='image' src='images/list_up.png' align='middle' title='"._("Go up one department")."' name='dep_back' alt='"._("Up")."'>&nbsp;".
-                                               " <input type='image' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
-                                               " <input type='image' src='images/list_home.png' align='middle' title='"._("Go to users home department")."' name='dep_home' alt='"._("Home")."'>&nbsp;".
-                                               " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-                                               " <input type='image' src='images/list_new_department.png' align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp;".
-                                               " <img src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-                                               _("Current base")."&nbsp;<select name='depselect' onChange='mainform.submit()'>$options</select>".
-                                               " <input type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+                                               " <input type='image' class='center' src='images/list_up.png' align='middle' title='"._("Go up one department")."' name='dep_back' alt='"._("Up")."'>&nbsp;".
+                                               " <input type='image' class='center' src='images/list_root.png' align='middle' title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
+                                               " <input type='image' class='center' src='images/list_home.png' align='middle' title='"._("Go to users home department")."' name='dep_home' alt='"._("Home")."'>&nbsp;".
+                                               " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+                                               " <input class='center' type='image' src='images/list_new_department.png' align='middle' alt='"._("Create new department")."' name='dep_new'>&nbsp;".
+                                               " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+                                               _("Base")."&nbsp;<select name='depselect' onChange='mainform.submit()' class='center'>$options</select>".
+                                               " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
                                                "</div>";
 
                        /* Show main page */
                        $divlist = new divlist("departmenttabs");
                        $divlist->SetSummary(_("This table displays all departments, in the selected tree."));
                        $divlist->SetEntriesPerPage(0);
-                       $actions= "<input type='image' src='images/edit.png'             alt='"._("edit")."'    name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
-                       $actions.= "<input type='image' src='images/edittrash.png' alt='"._("delete")."'        name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
+                       $actions= "<input class='center' type='image' src='images/edit.png'              alt='"._("edit")."'    name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
+                       $actions.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'         name='dep_del_%KEY%' title='"._("Delete this entry")."'>";
 
                        $linkopen = "<a href='?plug=".$_GET['plug']."&amp;act=dep_open&amp;dep_id=%s'>%s</a>";
 
-                       $divlist->SetHeader(array(array("string" => "&nbsp;"),
-                                                                         array("string"=>_("Department name")),
-                                      array("string" =>_("Actions"), "attach" => "style='text-align:  right;border:none'")));
-
+                       $divlist->SetHeader(array(
+                                               array("string" => "&nbsp;", "attach" => "style='text-align:center;width:20px;'"),
+                                               array("string"=>_("Department name"), "attach" => "style=''"),
+                                               array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'")));
 
                        foreach($this->departments as $key => $val) {
                                if(!isset($this->config->departments[trim($key)])){
@@ -310,12 +310,11 @@ class departmentManagement extends plugin
                                                $non_empty="full";
                                        }       
                                }
-                           
        
                                $title = $this->config->departments[$key];
-                               $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>","attach"=>"style='width:20px;'");
-                               $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='width:100%' title='".$title."'");
-                               $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions),"attach"=>"style='text-align:right;border:none'");
+                               $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+                               $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
+                               $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:right;'");
 
                                $divlist->AddEntry( array($field0,$field1,$field2));
 
@@ -407,14 +406,17 @@ class departmentManagement extends plugin
 
                $this->departments= array();
                foreach ($res as $value){
-                       if($value["description"][0]!=".."){
+                       if(isset($value["description"][0])){
                                $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
                        }else{
-                               $this->departments[$value['dn']]=$value["description"][0];
+                               $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0];
                        }
                }
                natcasesort ($this->departments);
                reset ($this->departments);
+
+               /* Unset global department list */
+               unset($_SESSION['cached_departments']);
        }
 
        function remove_from_parent()