[Fusionforge-commits] r8941 - branches/Branch_5_0/gforge/www/themes/gforge

Roland Mas lolando at libremir.placard.fr.eu.org
Thu Mar 4 11:11:18 CET 2010


Author: lolando
Date: 2010-03-04 11:11:17 +0100 (Thu, 04 Mar 2010)
New Revision: 8941

Modified:
   branches/Branch_5_0/gforge/www/themes/gforge/Theme.class.php
Log:
Spread the rounding of tab widths evenly across tabs rather than adding an empty tab to catch the whole error

Modified: branches/Branch_5_0/gforge/www/themes/gforge/Theme.class.php
===================================================================
--- branches/Branch_5_0/gforge/www/themes/gforge/Theme.class.php	2010-03-04 08:57:53 UTC (rev 8940)
+++ branches/Branch_5_0/gforge/www/themes/gforge/Theme.class.php	2010-03-04 10:11:17 UTC (rev 8941)
@@ -268,13 +268,6 @@
 		if ($count < 1) {
 			return;
 		}
-		// The width for each tab is given in percent. Note
-		// that an integer value is used as Opera doesn't seem
-		// to interpret fractional percentage values:
-		// http://www.christianmontoya.com/2007/06/26/fluid-widths-and-point-nine-nine-percent/
-		$width=intval((100/$count));
-		$rest_width=100-$count*$width;
-
         $return = '
 		<!-- start tabs -->
 		<table class="tabGenerator width-100p100" summary="" ';
@@ -287,7 +280,11 @@
  
         $folder = $this->imgroot.($nested ? 'bottomtab-new/' : 'toptab-new/');
 
+	$accumulated_width = 0;
         for ($i=0; $i<$count; $i++) {
+		$tabwidth = intval(ceil(($i+1)*100/$count)) - $accumulated_width ;
+		$accumulated_width += $tabwidth ;
+
             if ($selected == $i) {
                 $left_img   = $folder.'selected-left.gif';
                 $middle_img = $folder.'selected-middle.gif';
@@ -324,7 +321,7 @@
             $return .= '</td>' . "\n";
 
             // middle part
-            $return .= '<td class="tg-middle" style="width:'.$width.'%;">' . "\n";
+            $return .= '<td class="tg-middle" style="width:'.$tabwidth.'%;">' . "\n";
             $return .= '<div';
             if ($selected == $i) {
 		    $return .= ' class="selected"';
@@ -360,20 +357,6 @@
 	    }
 	}
 
-	// create a partial tab if there is any rest-width
-	if ($rest_width > 0) {
-		// left part
-		$return .= '<td class="tg-left">' . "\n";
-		$return .= '<div><div' . ($nested ? ' class="nested"' : '') . ">\n";
-		$return .= '</div></div>' . "\n";
-		$return .= '</td>' . "\n";
-		
-		$return .= '<td class="tg-middle" style="width:'.$rest_width.'%;">' . "\n";
-		$return .= '<div><div' . ($nested ? ' class="nested"' : '') . ">\n";
-		$return .= '</div></div>' . "\n";
-		$return .= '</td>' . "\n";
-	}
-
         $return .= '</tr>
         </table>
         <!-- end tabs -->';




More information about the Fusionforge-commits mailing list