http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88506

Revision: 88506
Author:   erik
Date:     2011-05-21 01:09:07 +0000 (Sat, 21 May 2011)
Log Message:
-----------
Replace hardcoded URL to Wikimedia Commons Help Desk with interface message.

Modified Paths:
--------------
    trunk/extensions/UploadWizard/UploadWizard.i18n.php
    trunk/extensions/UploadWizard/UploadWizardTutorial.php

Modified: trunk/extensions/UploadWizard/UploadWizard.i18n.php
===================================================================
--- trunk/extensions/UploadWizard/UploadWizard.i18n.php 2011-05-21 00:28:53 UTC 
(rev 88505)
+++ trunk/extensions/UploadWizard/UploadWizard.i18n.php 2011-05-21 01:09:07 UTC 
(rev 88506)
@@ -64,6 +64,7 @@
        'mwe-upwiz-tutorial-error-file-missing' => 'Sorry, we could not find 
any files for the tutorial that is supposed to go here. Please contact the 
system administrators.',
        'mwe-upwiz-tutorial-error-cannot-transform' => 'Sorry, we could not get 
a scaled image of the tutorial to fit this screen. This may be a temporary 
problem with Wikimedia Commons; try again later.',
        'mwe-upwiz-help-desk' => 'Help Desk',
+       'mwe-upwiz-help-desk-url' => 'Help Desk',
        'mwe-upwiz-add-file-n' => 'Add another file',
        'mwe-upwiz-add-file-0-free' => 'Select a media file to donate',
        'mwe-upwiz-transport-started' => 'Starting...',

Modified: trunk/extensions/UploadWizard/UploadWizardTutorial.php
===================================================================
--- trunk/extensions/UploadWizard/UploadWizardTutorial.php      2011-05-21 
00:28:53 UTC (rev 88505)
+++ trunk/extensions/UploadWizard/UploadWizardTutorial.php      2011-05-21 
01:09:07 UTC (rev 88506)
@@ -16,9 +16,6 @@
        // imagemap coordinates of the "helpdesk" button at the bottom, which 
is supposed to be clickable.
        const HELPDESK_BUTTON_COORDS = "27, 1319, 691, 1384";
 
-       // link to help desk within commons tutorial
-       const HELPDESK_URL = 'http://commons.wikimedia.org/wiki/Help_desk';
-
        // id of imagemap used in tutorial
        const IMAGEMAP_ID = 'tutorialMap';
 
@@ -95,6 +92,17 @@
         * @return {String} HTML representing the image, with clickable 
helpdesk button
         */
        public static function getImageHtml( $thumb ) {
+               
+               $helpDeskUrl = wfMsg( 'mwe-upwiz-help-desk-url' );
+
+                // Per convention, we may be either using an absolute URL or a 
wiki page title in this UI message                              
+               if( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $helpDeskUrl 
)) {
+                       $helpDeskHref = $helpDeskUrl;                   
+                } else {
+                        $helpDeskTitle = Title::newFromText( $helpDeskUrl );
+                       $helpDeskHref = $helpDeskTitle ? 
$helpDeskTitle->getLocalURL() : '#';
+                }
+
                // here we use the not-yet-forgotten HTML imagemap to add a 
clickable area to the tutorial image.
                // we could do more special effects with hovers and images and 
such, not to mention SVG scripting,
                // but we aren't sure what we want yet...
@@ -108,7 +116,7 @@
                $area = Html::element( 'area', array(
                        'shape' => 'rect',
                        'coords' => self::HELPDESK_BUTTON_COORDS,
-                       'href' => self::HELPDESK_URL,
+                       'href' => $helpDeskHref,
                        'alt' => $areaAltText,
                        'title' => $areaAltText
                ) );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to