Code

Fixed partitioning scheme
[gosa.git] / plugins / admin / departments / class_departmentManagement.inc
index cbfef6f7d23e4f723026041912d01d687572e91c..0265935dc6a8768c4d81df12504d895653787149 100644 (file)
@@ -76,13 +76,13 @@ 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  = 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  = preg_replace("/_.*$/","",$s_entry);
                                $s_entry  = base64_decode($s_entry);
                                // Post for new
                        }elseif(preg_match("/dep_new.*/",$key)){
@@ -99,18 +99,15 @@ class departmentManagement extends plugin
 
                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"){
@@ -122,14 +119,12 @@ 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();
                }
 
                if (isset($_GET['search'])){
@@ -290,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")."'>";
@@ -302,12 +297,24 @@ 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%'");
+                               
+                               $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));