Code

Updated the ItemSelector
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Apr 2011 13:02:51 +0000 (13:02 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 4 Apr 2011 13:02:51 +0000 (13:02 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@20646 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_ItemSelector.inc

index 0cc79551487c4dad457e52ce235e378a369404b3..3d7bdbf2179092979d311497fbbb5c0a800b1048 100644 (file)
@@ -138,13 +138,14 @@ class ItemSelector {
         if(isset($_REQUEST["BPID_{$this->pid}"]) && $_REQUEST["BPID_{$this->pid}"] == $this->pid) {
             if (isset($_POST['bs_rebase_'.$this->pid])) {
                 $new_base= base64_decode(get_post('bs_rebase_'.$this->pid));
-
-                if (isset($this->pathMapping[$new_base])) {
-                    $this->base= $new_base;
-                    $this->action= 'rebase';
-                } else {
-                    $this->lastState= false;
-                    return false;
+                if($new_base){
+                    if (isset($this->pathMapping[$new_base])) {
+                        $this->base= $new_base;
+                        $this->action= 'rebase';
+                    } else {
+                        $this->lastState= false;
+                        return false;
+                    }
                 }
             }else{
                 // Input field set?
@@ -234,6 +235,7 @@ class ItemSelector {
                     });";
         }
         $this->tree.= "</script>";
+        $selected= $this->base == $this->releaseBase?"Selected":"";
         $this->tree.= "<div class='treeList' 
                             style=' display:none;
                                     max-height:".$this->height."px' 
@@ -242,17 +244,25 @@ class ItemSelector {
                                     window.clearTimeout(rtimer);\" 
                             onmouseout=\"
                                     rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\">
+                        <a                     class='treeList$selected' $link>/&nbsp;["._("Root")."]</a>
                         <ul class='treeList'>\n";
 
         $first= true;
         $last_indent= 1;
 
+        $baseDepth = 0;
         foreach ($this->pathMapping as $base => $dummy) {
 
+            // Do not render the base element
+            if($base == $this->releaseBase){
+                $baseDepth = 1;
+                continue;
+            }
+
             // Build path style display
             $elements= explode('/', substr($base, strlen($this->releaseBase), strlen($base)));
-            $indent= count($elements) ;
-      
+            $indent= count($elements) - $baseDepth ;
+        
             if (!$first && ($indent == $last_indent)) {
                 $this->tree.= "</li>\n";
             }