Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -78,6 +78,18 @@ |
79 | 79 | // Initial value for the id field. |
80 | 80 | 'idFieldInitialValue' => '', |
81 | 81 | |
| 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 | + |
82 | 94 | // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in |
83 | 95 | // licensesOwnWork or licensesThirdParty. |
84 | 96 | // 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 @@ |
59 | 59 | UploadWizardConfig::setUrlSetting( 'skipTutorial', $skip ); |
60 | 60 | } |
61 | 61 | |
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' ) ) ); |
64 | 64 | } |
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 | + |
66 | 80 | $this->handleCampaign(); |
67 | 81 | |
68 | 82 | $out = $this->getOutput(); |
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php |
— | — | @@ -214,6 +214,18 @@ |
215 | 215 | 'thanksLabelPage' => array( |
216 | 216 | 'type' => 'text' |
217 | 217 | ), |
| 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 | + ), |
218 | 230 | ); |
219 | 231 | |
220 | 232 | foreach ( $globalConfig['licenses'] as $licenseName => $licenseDate ) { |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -327,6 +327,10 @@ |
328 | 328 | 'mwe-upwiz-campaign-conf-headerLabelPage' => 'Page containing text to display above the UploadWizard interface. $1 is replaced with the language code:', |
329 | 329 | 'mwe-upwiz-campaign-conf-thanksLabelPage' => 'Page containing text to display on top of the "Use" page. $1 is replaced with the language code:', |
330 | 330 | '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', |
331 | 335 | |
332 | 336 | // Coolcats |
333 | 337 | 'mw-coolcats-confirm-new-title' => 'Confirm new category', |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDescription.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * @param languageCode -- string |
6 | 6 | * @param firstRequired -- boolean -- the first description is required and should be validated and displayed a bit differently |
7 | 7 | */ |
8 | | -mw.UploadWizardDescription = function( languageCode, required ) { |
| 8 | +mw.UploadWizardDescription = function( languageCode, required, initialValue ) { |
9 | 9 | var _this = this; |
10 | 10 | mw.UploadWizardDescription.prototype.count++; |
11 | 11 | _this.id = 'description' + mw.UploadWizardDescription.prototype.count; |
— | — | @@ -37,6 +37,10 @@ |
38 | 38 | .attr( 'title', gM( 'mwe-upwiz-tooltip-description' ) ) |
39 | 39 | .growTextArea(); |
40 | 40 | |
| 41 | + if ( initialValue !== undefined ) { |
| 42 | + _this.input.val( initialValue ); |
| 43 | + } |
| 44 | + |
41 | 45 | // descriptions |
42 | 46 | _this.div = $j('<div class="mwe-upwiz-details-descriptions-container ui-helper-clearfix"></div>' ) |
43 | 47 | .append( errorLabelDiv, fieldnameDiv, _this.languageMenu, _this.input ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -170,7 +170,11 @@ |
171 | 171 | _this.latInput = $j( '<input type="text" id="' + latId + '" name="' + latId + '" class="mwe-loc-lat" size="10"/>' ); |
172 | 172 | _this.lonInput = $j( '<input type="text" id="' + lonId + '" name="' + lonId + '" class="mwe-loc-lon" size="10"/>' ); |
173 | 173 | _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 | + |
175 | 179 | var latDiv = $j( '<div class="mwe-location-lat"></div>' ) |
176 | 180 | .append( $j ( '<div class="mwe-location-lat-label"></div>' ).append( gM( 'mwe-upwiz-location-lat' ) ) ) |
177 | 181 | .append( _this.latInput ); |
— | — | @@ -331,7 +335,13 @@ |
332 | 336 | |
333 | 337 | mw.UploadWizardUtil.makeToggler( moreDetailsCtrlDiv, moreDetailsDiv ); |
334 | 338 | |
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 | + |
336 | 346 | $j( containerDiv ).append( _this.div ); |
337 | 347 | |
338 | 348 | if ( mw.config.get( 'UploadWizardConfig' ).useTitleBlacklistApi ) { |
— | — | @@ -544,7 +554,7 @@ |
545 | 555 | /** |
546 | 556 | * Add a new description |
547 | 557 | */ |
548 | | - addDescription: function( required, languageCode, allowRemove ) { |
| 558 | + addDescription: function( required, languageCode, allowRemove, initialValue ) { |
549 | 559 | var _this = this; |
550 | 560 | if ( required === undefined ) { |
551 | 561 | required = false; |
— | — | @@ -558,7 +568,7 @@ |
559 | 569 | allowRemove = true; |
560 | 570 | } |
561 | 571 | |
562 | | - var description = new mw.UploadWizardDescription( languageCode, required ); |
| 572 | + var description = new mw.UploadWizardDescription( languageCode, required, initialValue ); |
563 | 573 | |
564 | 574 | if ( !required && allowRemove ) { |
565 | 575 | $j( description.div ).append( |