r95159 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95158‎ | r95159 | r95160 >
Date:17:40, 21 August 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
added setting to change the thanks message on use page
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.config.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php (modified) (history)
  • /trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.config.php
@@ -31,6 +31,11 @@
3232 // $1 is replaced by the language code.
3333 'headerLabelPage' => '',
3434
 35+ // Page containing the (wiki)text to display on top of the "use" page.
 36+ // $1 is replaced by the language code.
 37+ // When not provided, the message mwe-upwiz-thanks-intro will be used.
 38+ 'thanksLabelPage' => '',
 39+
3540 // Should the own work option be shown, and if not, what option should be set?
3641 // Possible values: choice, own, notown
3742 'ownWorkOption' => 'choice',
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php
@@ -139,6 +139,8 @@
140140 $config['idFieldLabel'] = $labelPageContent;
141141 }
142142
 143+ $config['thanksLabel'] = $this->getPageContent( $config['thanksLabelPage'], true );
 144+
143145 $wgOut->addScript(
144146 Skin::makeVariablesScript(
145147 array(
@@ -159,10 +161,11 @@
160162 * @since 1.2
161163 *
162164 * @param string $pageName
 165+ * @param boolean $parse
163166 *
164167 * @return string|false
165168 */
166 - protected function getPageContent( $pageName ) {
 169+ protected function getPageContent( $pageName, $parse = false ) {
167170 $content = false;
168171
169172 if ( trim( $pageName ) != '' ) {
@@ -172,6 +175,11 @@
173176 if ( !is_null( $page ) && $page->exists() ) {
174177 $article = new Article( $page, 0 );
175178 $content = $article->getContent();
 179+
 180+ if ( $parse ) {
 181+ global $wgOut;
 182+ $content = $wgOut->parse( $content );
 183+ }
176184 }
177185 }
178186
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php
@@ -199,12 +199,15 @@
200200 'type' => 'text'
201201 ),
202202 'autoCategories' => array(
203 - 'type' => 'text'
 203+ 'type' => 'text'
204204 ),
205205 'autoWikiText' => array(
206206 'type' => 'textarea',
207207 'rows' => 4
208208 ),
 209+ 'thanksLabelPage' => array(
 210+ 'type' => 'text'
 211+ ),
209212 );
210213
211214 foreach ( $globalConfig['licensesOwnWork']['licenses'] as $license ) {
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -327,6 +327,7 @@
328328 'mwe-upwiz-campaign-conf-idFieldLabel' => 'Id field label text',
329329 'mwe-upwiz-campaign-conf-idFieldLabelPage' => 'Page name with text for the id field label. $1 is replaced with the language code',
330330 'mwe-upwiz-campaign-conf-headerLabelPage' => 'Page containing text to display above the UploadWizard interface. $1 is replaced with the language code',
 331+ 'mwe-upwiz-campaign-conf-thanksLabelPage' => 'Page containing text to display on top of the "Use" page. $1 is replaced with the language code',
331332
332333 // Coolcats
333334 'mw-coolcats-confirm-new-title' => 'Confirm new category',
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -1721,10 +1721,21 @@
17221722 prefillThanksPage: function() {
17231723 var _this = this;
17241724
 1725+ var thnxHeader = $j( '<h3 style="text-align: center;"></h3>' );
 1726+
 1727+ if ( mw.UploadWizard.config.thanksLabel === false ) {
 1728+ thnxHeader.msg( 'mwe-upwiz-thanks-intro' );
 1729+ }
 1730+ else {
 1731+ thnxHeader.html( mw.UploadWizard.config.thanksLabel );
 1732+ }
 1733+
17251734 $j( '#mwe-upwiz-thanks' )
1726 - .append( $j( '<h3 style="text-align: center;"></h3>' ).msg( 'mwe-upwiz-thanks-intro' ),
1727 - $j( '<p style="margin-bottom: 2em; text-align: center;">' )
1728 - .msg( 'mwe-upwiz-thanks-explain', _this.uploads.length ) );
 1735+ .append(
 1736+ thnxHeader,
 1737+ $j( '<p style="margin-bottom: 2em; text-align: center;">' )
 1738+ .msg( 'mwe-upwiz-thanks-explain', _this.uploads.length )
 1739+ );
17291740
17301741 $j.each( _this.uploads, function(i, upload) {
17311742 var id = 'thanksDiv' + i;

Status & tagging log