http://www.mediawiki.org/wiki/Special:Code/MediaWiki/74005
Revision: 74005
Author: platonides
Date: 2010-09-29 23:27:26 +0000 (Wed, 29 Sep 2010)
Log Message:
-----------
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: trunk/phase3/includes/EditPage.php
===================================================================
--- trunk/phase3/includes/EditPage.php 2010-09-29 23:25:07 UTC (rev 74004)
+++ trunk/phase3/includes/EditPage.php 2010-09-29 23:27:26 UTC (rev 74005)
@@ -2111,7 +2111,10 @@
*/
static function getEditToolbar() {
global $wgStylePath, $wgContLang, $wgLang, $wgOut;
+ global $wgUseTeX, $wgEnableUploads, $wgForeignFileRepos;
+ $imagesAvailable = $wgEnableUploads || count(
$wgForeignFileRepos );
+
/**
* toolarray an array of arrays which each include the filename
of
@@ -2170,7 +2173,7 @@
'tip' => wfMsg( 'headline_tip' ),
'key' => 'H'
),
- array(
+ $imagesAvailable ? array(
'image' => $wgLang->getImageFile(
'button-image' ),
'id' => 'mw-editbutton-image',
'open' => '[[' . $wgContLang->getNsText(
NS_FILE ) . ':',
@@ -2178,8 +2181,8 @@
'sample' => wfMsg( 'image_sample' ),
'tip' => wfMsg( 'image_tip' ),
'key' => 'D'
- ),
- array(
+ ) : false,
+ $imagesAvailable ? array(
'image' => $wgLang->getImageFile(
'button-media' ),
'id' => 'mw-editbutton-media',
'open' => '[[' . $wgContLang->getNsText(
NS_MEDIA ) . ':',
@@ -2187,8 +2190,8 @@
'sample' => wfMsg( 'media_sample' ),
'tip' => wfMsg( 'media_tip' ),
'key' => 'M'
- ),
- array(
+ ) : false,
+ $wgUseTeX ? array(
'image' => $wgLang->getImageFile(
'button-math' ),
'id' => 'mw-editbutton-math',
'open' => "<math>",
@@ -2196,7 +2199,7 @@
'sample' => wfMsg( 'math_sample' ),
'tip' => wfMsg( 'math_tip' ),
'key' => 'C'
- ),
+ ) : false,
array(
'image' => $wgLang->getImageFile(
'button-nowiki' ),
'id' => 'mw-editbutton-nowiki',
@@ -2229,6 +2232,8 @@
$script = '';
foreach ( $toolarray as $tool ) {
+ if ( !$tool ) continue;
+
$params = array(
$image = $wgStylePath . '/common/images/' .
$tool['image'],
// Note that we use the tip both for the ALT
tag and the TITLE tag of the image.
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs