[Mediawiki-l] Force (edit-)toolbar icons to spread over 2 lines?

Birger bweynants at gmail.com
Wed Feb 14 15:24:42 UTC 2007


Hello,

The toolbar (above the editbox) in my wiki contains 18 icons. The
length of the icon row as it is shown now, DEPENDS on the screen
resolution:
=> 800x600 shows one line with the first 9 icons and below that line
another line with the rest (other 9 icons).
=> 1024x768 shows one line with the first 13 icons and below that line
another line with the last 5 icons.
=> 1152x864 shows one line with the first 16 icons and below that line
another line with the last 2 icons.

I would like to split the row of icons in the toolbar into 2 FIXED
lines, having 9 icons each. Does anyone know how this is possible?
After looking at the functions addButton() (in /common/wikibits.js)
and getEditToolbar() (in /includes/editpage.php), I thought putting a
counter into the getEditToolbar-function, so that as soon as the
counter hits 9 (the ninth icon), a break is put in the icon line and
the other nine icons are put on the next line. The getEditToolbar
function looks like this:

function getEditToolbar() {
		global $wgStylePath, $wgContLang, $wgJsMimeType;
                $toolarray=array( *snipped*array of icons*snipped*)
                $toolbar ="<script type='$wgJsMimeType'>\n/*<![CDATA[*/\n";

		$toolbar.="document.writeln(\"<div id='toolbar'>\");\n";
		foreach($toolarray as $tool) {

			$image=$wgStylePath.'/common/images/'.$tool['image'];
			$open=$tool['open'];
			$close=$tool['close'];
			$sample = wfEscapeJsString( $tool['sample'] );
                   $tip = wfEscapeJsString( $tool['tip'] );

$toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
		}

		$toolbar.="document.writeln(\"</div>\");\n";
		$toolbar.="/*]]>*/\n</script>";
		return $toolbar;
	}

Unfortunately i do not seem to be able to make such a construction
with counter working: i wanted to replace the "foreach ($toolarray as
$tool)"-construction with a sort of
"for($counter=0;$counter<10;$counter++){
$toolbar.="addButton('$image','$tip','$open','$close','$sample');\n";
			}
			$counter+=1;"-construction but without any satisfying result.

Has anyone an idea how i can make such a counter construction working
or whether i should try something else in order to spread the toolbar
icons over 2 lines with fixed length (=9 icons each)?

Thanks in advance!
B.



More information about the MediaWiki-l mailing list