r74005 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74004‎ | r74005 | r74006 >
Date:23:27, 29 September 2010
Author:platonides
Status:ok
Tags:
Comment:
Do not show math toolbar button if TeX is disabled.
Do not show image and media toolbar buttons if the wiki can't show images (either by local upload or via a foreign repo)
Modified paths:
  • /trunk/phase3/includes/EditPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/EditPage.php
@@ -2111,7 +2111,10 @@
21122112 */
21132113 static function getEditToolbar() {
21142114 global $wgStylePath, $wgContLang, $wgLang, $wgOut;
 2115+ global $wgUseTeX, $wgEnableUploads, $wgForeignFileRepos;
21152116
 2117+ $imagesAvailable = $wgEnableUploads || count( $wgForeignFileRepos );
 2118+
21162119 /**
21172120
21182121 * toolarray an array of arrays which each include the filename of
@@ -2170,7 +2173,7 @@
21712174 'tip' => wfMsg( 'headline_tip' ),
21722175 'key' => 'H'
21732176 ),
2174 - array(
 2177+ $imagesAvailable ? array(
21752178 'image' => $wgLang->getImageFile( 'button-image' ),
21762179 'id' => 'mw-editbutton-image',
21772180 'open' => '[[' . $wgContLang->getNsText( NS_FILE ) . ':',
@@ -2178,8 +2181,8 @@
21792182 'sample' => wfMsg( 'image_sample' ),
21802183 'tip' => wfMsg( 'image_tip' ),
21812184 'key' => 'D'
2182 - ),
2183 - array(
 2185+ ) : false,
 2186+ $imagesAvailable ? array(
21842187 'image' => $wgLang->getImageFile( 'button-media' ),
21852188 'id' => 'mw-editbutton-media',
21862189 'open' => '[[' . $wgContLang->getNsText( NS_MEDIA ) . ':',
@@ -2187,8 +2190,8 @@
21882191 'sample' => wfMsg( 'media_sample' ),
21892192 'tip' => wfMsg( 'media_tip' ),
21902193 'key' => 'M'
2191 - ),
2192 - array(
 2194+ ) : false,
 2195+ $wgUseTeX ? array(
21932196 'image' => $wgLang->getImageFile( 'button-math' ),
21942197 'id' => 'mw-editbutton-math',
21952198 'open' => "<math>",
@@ -2196,7 +2199,7 @@
21972200 'sample' => wfMsg( 'math_sample' ),
21982201 'tip' => wfMsg( 'math_tip' ),
21992202 'key' => 'C'
2200 - ),
 2203+ ) : false,
22012204 array(
22022205 'image' => $wgLang->getImageFile( 'button-nowiki' ),
22032206 'id' => 'mw-editbutton-nowiki',
@@ -2229,6 +2232,8 @@
22302233
22312234 $script = '';
22322235 foreach ( $toolarray as $tool ) {
 2236+ if ( !$tool ) continue;
 2237+
22332238 $params = array(
22342239 $image = $wgStylePath . '/common/images/' . $tool['image'],
22352240 // Note that we use the tip both for the ALT tag and the TITLE tag of the image.

Status & tagging log