Code

Fixed partitioning scheme
[gosa.git] / plugins / admin / departments / class_departmentManagement.inc
index 38753f4b171a9a38fd8b77c4e86453203709576f..0265935dc6a8768c4d81df12504d895653787149 100644 (file)
@@ -76,10 +76,14 @@ class departmentManagement extends plugin
                        if(preg_match("/dep_del.*/",$key)){
                                $s_action = "del";
                                $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
+                               $s_entry  = preg_replace("/_.*$/","",$s_entry);
+                               $s_entry  = base64_decode($s_entry);
                        // Post for edit
                        }elseif(preg_match("/dep_edit_.*/",$key)){
                                $s_action="edit";
                                $s_entry  = preg_replace("/dep_".$s_action."_/i","",$key);
+                               $s_entry  = preg_replace("/_.*$/","",$s_entry);
+                               $s_entry  = base64_decode($s_entry);
                                // Post for new
                        }elseif(preg_match("/dep_new.*/",$key)){
                                $s_action="new";
@@ -90,22 +94,20 @@ class departmentManagement extends plugin
                        }elseif(preg_match("/dep_root.*/i",$key)){
                                $s_action="root";
                        }
+               
                }
 
                if(isset($_POST['depselect']) && $_POST['depselect']){
                        $depfilter['depselect']= $_POST['depselect'];
-            $this->reload();
                }
                
                if($s_action=="root"){
                        $depfilter['depselect']=($this->config->current['BASE']);
-                       $this->reload();
                }
 
                if($s_action=="home"){
                        $depfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn));
                        $depfilter['depselect']=(preg_replace("/^[^,]+,/","",$depfilter['depselect']));
-                       $this->reload();
                }
 
                if($s_action=="back"){
@@ -117,19 +119,14 @@ class departmentManagement extends plugin
                        }else{
                                $depfilter['depselect']= $this->config->departments["/"];
                        }
-            $this->reload();
                }
 
                if(isset($_GET['act'])&&($_GET['act']=="dep_open")){
                        $s_action="open";
                        $s_entry = base64_decode($_GET['dep_id']);
                        $depfilter['depselect']= $this->config->departments[trim($s_entry)];
-                       $this->reload();
                }
 
-
-               $s_entry  = preg_replace("/_.*/","",$s_entry);
-
                if (isset($_GET['search'])){
                        $s= mb_substr($_GET['search'], 0, 1, "UTF8")."*";
                        if ($s == "**"){
@@ -288,7 +285,7 @@ class departmentManagement extends plugin
                                                "</div>";
 
                        /* Show main page */
-                       $divlist = new divlist();
+                       $divlist = new divlist("departmenttabs");
                        $divlist->SetSummary(_("This table displays all departments, in the selected tree."));
                        $divlist->SetEntriesPerPage(20);
                        $actions= "<input type='image' src='images/edit.png'             alt='"._("edit")."'    name='dep_edit_%KEY%' title='"._("Edit this entry")."'>";
@@ -300,13 +297,25 @@ class departmentManagement extends plugin
                                                                          array("string"=>_("Department name")),
                                       array("string" =>_("Actions"), "attach" => "style='text-align:  right;border:none'")));
 
+
                        foreach($this->departments as $key => $val) {
                                if(!isset($this->config->departments[trim($key)])){
                                        $this->config->departments[trim($key)]="";
                                }
-                               $field0 = array("string" => "<img src='images/folder.png' alt='department'>","attach"=>"style='width:20px;'");
-                               $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "width='100%'");
-                               $field2 = array("string" => preg_replace("/%KEY%/", $key, $actions),"attach"=>"style='text-align:right;border:none'");
+                               
+                               $non_empty="";  
+                               $keys= str_replace("/","\/",$key);
+                               foreach($this->config->departments as $keyd=>$vald ){
+                                       if(preg_match("/".$keys."\/.*/",$keyd)){
+                                               $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'");
 
                                $divlist->AddEntry( array($field0,$field1,$field2));