Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -48,6 +48,10 @@ |
49 | 49 | // Label text to display with the id field. |
50 | 50 | 'idFieldLabel' => '', |
51 | 51 | |
| 52 | + // Page on which the text to display with the id field is stored. |
| 53 | + // Overrides idFieldLabel when set. $1 is replaced by the language code. |
| 54 | + 'idFieldLabelPage' => false, |
| 55 | + |
52 | 56 | // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in |
53 | 57 | // licensesOwnWork or licensesThirdParty. |
54 | 58 | // It just describes what licenses go with what wikitext, and how to display them in |
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php |
— | — | @@ -171,6 +171,9 @@ |
172 | 172 | 'idFieldLabel' => array( |
173 | 173 | 'type' => 'text', |
174 | 174 | ), |
| 175 | + 'idFieldLabelPage' => array( |
| 176 | + 'type' => 'text', |
| 177 | + ), |
175 | 178 | 'ownWorkOption' => array( |
176 | 179 | 'type' => 'radio', |
177 | 180 | 'options' => array( |
— | — | @@ -327,6 +330,14 @@ |
328 | 331 | return $this->config; |
329 | 332 | } |
330 | 333 | |
| 334 | + /** |
| 335 | + * Returns the configuration, ready for merging with the |
| 336 | + * global configuration. |
| 337 | + * |
| 338 | + * @since 1.2 |
| 339 | + * |
| 340 | + * @return arrayu |
| 341 | + */ |
331 | 342 | public function getConfigForGlobalMerge() { |
332 | 343 | $config = $this->getConfig(); |
333 | 344 | |
— | — | @@ -341,9 +352,28 @@ |
342 | 353 | } |
343 | 354 | } |
344 | 355 | |
| 356 | + foreach ( self::getDefaultConfig() as $name => $data ) { |
| 357 | + if ( !array_key_exists( $name, $config ) ) { |
| 358 | + $config[$name] = $data['default']; |
| 359 | + } |
| 360 | + } |
| 361 | + |
345 | 362 | $config['licensesOwnWork']['defaults'] = array( $config['defaultOwnWorkLicence'] ); |
346 | 363 | unset( $config['defaultOwnWorkLicence'] ); |
347 | 364 | |
| 365 | + $labelPage = $config['idFieldLabelPage']; |
| 366 | + $config['idFieldLabelPage'] = false; |
| 367 | + |
| 368 | + if ( trim( $labelPage ) != '' ) { |
| 369 | + global $wgLang; |
| 370 | + $labelPage = Title::newFromText( str_replace( '$1', $wgLang->getCode(), $labelPage ) ); |
| 371 | + |
| 372 | + if ( !is_null( $labelPage ) && $labelPage->exists() ) { |
| 373 | + $article = new Article( $labelPage ); |
| 374 | + $config['idFieldLabelPage'] = $article->getContent(); |
| 375 | + } |
| 376 | + } |
| 377 | + |
348 | 378 | return $config; |
349 | 379 | } |
350 | 380 | |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -322,6 +322,7 @@ |
323 | 323 | 'mwe-upwiz-campaign-conf-defaultOwnWorkLicence' => 'The default own work license', |
324 | 324 | 'mwe-upwiz-campaign-conf-idField' => 'Id field wikitext. Example: <nowiki>{{Rijksmonument|$1}}</nowiki>. Blank to not display field', |
325 | 325 | 'mwe-upwiz-campaign-conf-idFieldLabel' => 'Id field label text', |
| 326 | + 'mwe-upwiz-campaign-conf-idFieldLabelPage' => 'Page name with text for the id field label ($1 for lang code)', |
326 | 327 | |
327 | 328 | // Coolcats |
328 | 329 | 'mw-coolcats-confirm-new-title' => 'Confirm new category', |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -180,8 +180,15 @@ |
181 | 181 | var idFieldId = "idField" + ( _this.upload.index ).toString(); |
182 | 182 | _this.idFieldInput = $j( '<input type="text" id="' + idFieldId + '" name="' + idFieldId + '" class="mwe-idfield" maxlength="15"/>' ); |
183 | 183 | |
| 184 | + if ( mw.UploadWizard.config.idFieldLabelPage !== false ) { |
| 185 | + var label = mw.UploadWizard.config.idFieldLabelPage; |
| 186 | + } |
| 187 | + else { |
| 188 | + var label = mw.UploadWizard.config.idFieldLabel; |
| 189 | + } |
| 190 | + |
184 | 191 | _this.$form.append( |
185 | | - $j( '<div class="mwe-upwiz-details-fieldname"></div>' ).text( mw.UploadWizard.config.idFieldLabel ), |
| 192 | + $j( '<div class="mwe-upwiz-details-fieldname"></div>' ).text( label ), |
186 | 193 | $j( '<div class="mwe-id-field"></div>' ).append( _this.idFieldInput ) |
187 | 194 | ); |
188 | 195 | } |