]> git.mjollnir.org Git - moodle.git/commitdiff
merged tabs routine changes to resolve IE6 + 7 tabs issues
authorurs_hunkler <urs_hunkler>
Sun, 4 Mar 2007 17:16:00 +0000 (17:16 +0000)
committerurs_hunkler <urs_hunkler>
Sun, 4 Mar 2007 17:16:00 +0000 (17:16 +0000)
lib/weblib.php

index 77cd020183ad363ceff5403354c8b723a144440b..c9bc82a08b4c57b705e95fae66d2609e9d57fd46 100644 (file)
@@ -5576,36 +5576,42 @@ function convert_tree_to_html($tree, $row=0) {
     foreach ($tree as $tab) {
         $count--;   // countdown to zero
 
+        $liclass = '';
+
         if ($first && ($count == 0)) {   // Just one in the row
-            $str .= '<li class="first last">';
+            $liclass = 'first last';
             $first = false;
         } else if ($first) {
-            $str .= '<li class="first">';
+            $liclass = 'first';
             $first = false;
         } else if ($count == 0) {
-            $str .= '<li class="last">';
-        } else {   
-            $str .= '<li>';
+            $liclass = 'last';
         }
 
-        if ($tab->selected) { 
-            $linkclass = ' class="here selected"';
-        } else if ($tab->active) { 
-            $linkclass = ' class="here active"';
-        } else {
-            $linkclass = '';
+        if ((empty($tab->subtree)) && (!empty($tab->selected))) {
+            $liclass .= (empty($liclass)) ? 'onerow' : ' onerow';
         }
 
         if ($tab->inactive || $tab->active || ($tab->selected && !$tab->linkedwhenselected)) {
-            $str .= '<a href="#" title="'.$tab->title.'"'.$linkclass.'><span>'.$tab->text.'</span></a>';
+            if ($tab->selected) { 
+                $liclass .= (empty($liclass)) ? 'here selected' : ' here selected';
+            } else if ($tab->active) { 
+                $liclass .= (empty($liclass)) ? 'here active' : ' here active';
+            }
+        }
+
+        $str .= (!empty($liclass)) ? '<li class="'.$liclass.'">' : '<li>';
+
+        if ($tab->inactive || $tab->active || ($tab->selected && !$tab->linkedwhenselected)) {
+            $str .= '<a href="#" title="'.$tab->title.'"><span>'.$tab->text.'</span></a>';
         } else {
-            $str .= '<a href="'.$tab->link.'" title="'.$tab->title.'"'.$linkclass.'><span>'.$tab->text.'</span></a>';
+            $str .= '<a href="'.$tab->link.'" title="'.$tab->title.'"><span>'.$tab->text.'</span></a>';
         }
 
         if (!empty($tab->subtree)) { 
             $str .= convert_tree_to_html($tab->subtree, $row+1);
         } else if ($tab->selected) {
-            $str .= '<ul class="tabrow'.($row+1).' empty"> <li/> </ul>'."\n";
+            $str .= '<div class="tabrow'.($row+1).' empty">&nbsp;</div>'."\n";
         }
 
         $str .= '</li>'."\n";