Code

Updated filter automatic indent
[gosa.git] / gosa-core / include / class_baseSelector.inc
index 1d35ea4fba22616d1768b27c311c1dd0d58a6c39..2833ce5e36a00fd6df54c821e55528b139cb9da1 100644 (file)
@@ -31,14 +31,6 @@ class baseSelector {
   protected $pathMapping;
   protected $lastState;
 
-  // It would be better to get a dn -> [name, description, type] array
-  // to avoid these tasks be done several times. Skipping for the moment.
-  #'dc' => 'plugins/departments/images/domain.png',
-  #'dc' => 'plugins/departments/images/dc.png',
-  #'l' => 'plugins/departments/images/locality.png',
-  #'c' => 'plugins/departments/images/country.png',
-  #'o' => 'plugins/departments/images/organization.png',
-  #'ou' => 'plugins/departments/images/folder.png',
 
   function __construct($bases, $base= "")
   {
@@ -193,21 +185,25 @@ class baseSelector {
       }
       $selected= $this->base == $base?" class='treeListSelected'":"";
       $link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($base)."';$('submit_tree_base_".$this->pid."').click();\"";
-      $this->tree.= "<li><a$selected $link>".str_replace('-', '&#8209;', str_replace(' ', '&nbsp;', ldap::fix(preg_replace('/^[a-z0-9]+=([^,]+),.*$/i', '$1', $base))))."</a>";
+      $this->tree.= "<li>".
+                    image($config->department_info[$base]['img'])."&nbsp;<a$selected $link>".
+                    $this->gennonbreaks($config->department_info[$base]['name']).
+                    ($config->department_info[$base]['description']==''?'':'&nbsp;<span class="informal">['.$this->gennonbreaks($config->department_info[$base]['description']).']</span>').
+                    "</a>";
 
       $last_indent= $indent;
       $first= false;
     }
 
     // Close tree
-    for ($i= 0; $i<$last_indent; $i++) {
+    for ($i= 1; $i<$last_indent; $i++) {
       $this->tree.= "</li></ul>\n";
     }
     $this->tree.= "</div>\n";
 
     // Draw submitter if required
     if ($this->submitButton) {
-      $this->tree.= "&nbsp;<input class='center' type='image' src='images/lists/submit.png' align='middle' title='"._("Submit")."' name='submit_base_".$this->pid."' id='submit_base_".$this->pid."' alt='"._("Submit")."'>";
+      $this->tree.= image('images/lists/submit.png', "submit_base_".$this->pid, _("Submit"));
     }
     $this->tree.= "<input type='submit' style='display:none' name='submit_tree_base_".$this->pid."' id='submit_tree_base_".$this->pid."'>";
     $this->tree.= "<input type='hidden' name='bs_rebase_".$this->pid."' id='bs_rebase_".$this->pid."'>";
@@ -217,6 +213,13 @@ class baseSelector {
     return true;
   }
 
+
+  function gennonbreaks($string)
+  {
+    return str_replace('-', '&#8209;', str_replace(' ', '&nbsp;', $string));
+  }
+
+
   function render()
   {
     return $this->tree;