r113591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113590‎ | r113591 | r113592 >
Date:21:40, 11 March 2012
Author:jeroendedauw
Status:reverted (Comments)
Tags:gerritmigration 
Comment:
adderss bug 33341
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.UploadWizardDescription.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.config.php
@@ -78,6 +78,18 @@
7979 // Initial value for the id field.
8080 'idFieldInitialValue' => '',
8181
 82+ // Initial value for the description field.
 83+ 'defaultDescription' => '',
 84+
 85+ // Initial value for the latitude field.
 86+ 'defaultLat' => '',
 87+
 88+ // Initial value for the longitude field.
 89+ 'defaultLon' => '',
 90+
 91+ // Initial value for the altitude field.
 92+ 'defaultAlt' => '',
 93+
8294 // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in
8395 // licensesOwnWork or licensesThirdParty.
8496 // It just describes what licenses go with what wikitext, and how to display them in
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php
@@ -58,10 +58,24 @@
5959 UploadWizardConfig::setUrlSetting( 'skipTutorial', $skip );
6060 }
6161
62 - if ( $wgRequest->getCheck( 'id' ) ) {
63 - UploadWizardConfig::setUrlSetting( 'idFieldInitialValue', $wgRequest->getText( 'id' ) );
 62+ if ( $wgRequest->getCheck( 'categories' ) ) {
 63+ UploadWizardConfig::setUrlSetting( 'defaultCategories', explode( '|', $wgRequest->getText( 'categories' ) ) );
6464 }
65 -
 65+
 66+ $ulrArgs = array(
 67+ 'id' => 'idFieldInitialValue',
 68+ 'description' => 'defaultDescription',
 69+ 'lat' => 'defaultLat',
 70+ 'lon' => 'defaultLon',
 71+ 'alt' => 'defaultAlt',
 72+ );
 73+
 74+ foreach ( $ulrArgs as $arg => $setting ) {
 75+ if ( $wgRequest->getCheck( $arg ) ) {
 76+ UploadWizardConfig::setUrlSetting( $setting, $wgRequest->getText( $arg ) );
 77+ }
 78+ }
 79+
6680 $this->handleCampaign();
6781
6882 $out = $this->getOutput();
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php
@@ -214,6 +214,18 @@
215215 'thanksLabelPage' => array(
216216 'type' => 'text'
217217 ),
 218+ 'defaultLat' => array(
 219+ 'type' => 'text'
 220+ ),
 221+ 'defaultLon' => array(
 222+ 'type' => 'text'
 223+ ),
 224+ 'defaultAlt' => array(
 225+ 'type' => 'text'
 226+ ),
 227+ 'defaultDescription' => array(
 228+ 'type' => 'text'
 229+ ),
218230 );
219231
220232 foreach ( $globalConfig['licenses'] as $licenseName => $licenseDate ) {
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -327,6 +327,10 @@
328328 'mwe-upwiz-campaign-conf-headerLabelPage' => 'Page containing text to display above the UploadWizard interface. $1 is replaced with the language code:',
329329 'mwe-upwiz-campaign-conf-thanksLabelPage' => 'Page containing text to display on top of the "Use" page. $1 is replaced with the language code:',
330330 'mwe-upwiz-campaign-conf-idFieldMaxLength' => 'Maximum length of the text in the ID field',
 331+ 'mwe-upwiz-campaign-conf-defaultLat' => 'Default latitude',
 332+ 'mwe-upwiz-campaign-conf-defaultLon' => 'Default longitude',
 333+ 'mwe-upwiz-campaign-conf-defaultAlt' => 'Default altitude',
 334+ 'mwe-upwiz-campaign-conf-defaultDescription' => 'Default description',
331335
332336 // Coolcats
333337 'mw-coolcats-confirm-new-title' => 'Confirm new category',
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDescription.js
@@ -4,7 +4,7 @@
55 * @param languageCode -- string
66 * @param firstRequired -- boolean -- the first description is required and should be validated and displayed a bit differently
77 */
8 -mw.UploadWizardDescription = function( languageCode, required ) {
 8+mw.UploadWizardDescription = function( languageCode, required, initialValue ) {
99 var _this = this;
1010 mw.UploadWizardDescription.prototype.count++;
1111 _this.id = 'description' + mw.UploadWizardDescription.prototype.count;
@@ -37,6 +37,10 @@
3838 .attr( 'title', gM( 'mwe-upwiz-tooltip-description' ) )
3939 .growTextArea();
4040
 41+ if ( initialValue !== undefined ) {
 42+ _this.input.val( initialValue );
 43+ }
 44+
4145 // descriptions
4246 _this.div = $j('<div class="mwe-upwiz-details-descriptions-container ui-helper-clearfix"></div>' )
4347 .append( errorLabelDiv, fieldnameDiv, _this.languageMenu, _this.input );
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js
@@ -170,7 +170,11 @@
171171 _this.latInput = $j( '<input type="text" id="' + latId + '" name="' + latId + '" class="mwe-loc-lat" size="10"/>' );
172172 _this.lonInput = $j( '<input type="text" id="' + lonId + '" name="' + lonId + '" class="mwe-loc-lon" size="10"/>' );
173173 _this.altInput = $j( '<input type="text" id="' + altId + '" name="' + altId + '" class="mwe-loc-alt" size="10"/>' );
174 -
 174+
 175+ _this.latInput.val( mw.UploadWizard.config.defaultLat );
 176+ _this.lonInput.val( mw.UploadWizard.config.defaultLon );
 177+ _this.altInput.val( mw.UploadWizard.config.defaultAlt );
 178+
175179 var latDiv = $j( '<div class="mwe-location-lat"></div>' )
176180 .append( $j ( '<div class="mwe-location-lat-label"></div>' ).append( gM( 'mwe-upwiz-location-lat' ) ) )
177181 .append( _this.latInput );
@@ -331,7 +335,13 @@
332336
333337 mw.UploadWizardUtil.makeToggler( moreDetailsCtrlDiv, moreDetailsDiv );
334338
335 - _this.addDescription( !mw.UploadWizard.config.idField, mw.config.get( 'wgUserLanguage' ), false );
 339+ _this.addDescription(
 340+ !mw.UploadWizard.config.idField,
 341+ mw.config.get( 'wgUserLanguage' ),
 342+ false,
 343+ mw.UploadWizard.config.defaultDescription
 344+ );
 345+
336346 $j( containerDiv ).append( _this.div );
337347
338348 if ( mw.config.get( 'UploadWizardConfig' ).useTitleBlacklistApi ) {
@@ -544,7 +554,7 @@
545555 /**
546556 * Add a new description
547557 */
548 - addDescription: function( required, languageCode, allowRemove ) {
 558+ addDescription: function( required, languageCode, allowRemove, initialValue ) {
549559 var _this = this;
550560 if ( required === undefined ) {
551561 required = false;
@@ -558,7 +568,7 @@
559569 allowRemove = true;
560570 }
561571
562 - var description = new mw.UploadWizardDescription( languageCode, required );
 572+ var description = new mw.UploadWizardDescription( languageCode, required, initialValue );
563573
564574 if ( !required && allowRemove ) {
565575 $j( description.div ).append(

Follow-up revisions

RevisionCommit summaryAuthorDate
r114400Revert r112166, r112229, r112248, r113584, r113591, r114349: unreviewed revis...catrope20:21, 21 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113584adressing (part of) bug 33341jeroendedauw20:06, 11 March 2012

Comments

#Comment by Platonides (talk | contribs)   22:41, 19 May 2012

Seems to have been merged in https://gerrit.wikimedia.org/r/3472

Status & tagging log