Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | |
56 | 56 | // Page on which the text to display with the id field is stored. |
57 | 57 | // Overrides idFieldLabel when set. $1 is replaced by the language code. |
58 | | - 'idFieldLabelPage' => false, |
| 58 | + 'idFieldLabelPage' => '', |
59 | 59 | |
60 | 60 | // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in |
61 | 61 | // licensesOwnWork or licensesThirdParty. |
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php |
— | — | @@ -364,39 +364,10 @@ |
365 | 365 | $config['licensesOwnWork']['defaults'] = array( $config['defaultOwnWorkLicence'] ); |
366 | 366 | unset( $config['defaultOwnWorkLicence'] ); |
367 | 367 | |
368 | | - $config['idFieldLabelPage'] = $this->getPageContent( $config['idFieldLabelPage'] ); |
369 | | - $config['headerLabelPage'] = $this->getPageContent( $config['headerLabelPage'] ); |
370 | | - |
371 | 368 | return $config; |
372 | 369 | } |
373 | 370 | |
374 | 371 | /** |
375 | | - * Gets content of the specified page, or false if there is no such page. |
376 | | - * '$1' in $pageName is replaced by the code of the current language. |
377 | | - * |
378 | | - * @since 1.2 |
379 | | - * |
380 | | - * @param string $pageName |
381 | | - * |
382 | | - * @return string|false |
383 | | - */ |
384 | | - protected function getPageContent( $pageName ) { |
385 | | - $content = false; |
386 | | - |
387 | | - if ( trim( $pageName ) != '' ) { |
388 | | - global $wgLang; |
389 | | - $page = Title::newFromText( str_replace( '$1', $wgLang->getCode(), $pageName ) ); |
390 | | - |
391 | | - if ( !is_null( $page ) && $page->exists() ) { |
392 | | - $article = new Article( $page ); |
393 | | - $content = $article->getContent(); |
394 | | - } |
395 | | - } |
396 | | - |
397 | | - return $content; |
398 | | - } |
399 | | - |
400 | | - /** |
401 | 372 | * Returns all config properties by merging the set ones with a list of default ones. |
402 | 373 | * Property name => array( 'default' => $value, 'type' => HTMLForm input type ) |
403 | 374 | * |
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php |
— | — | @@ -132,10 +132,17 @@ |
133 | 133 | public function addJsVars( $subPage ) { |
134 | 134 | global $wgOut, $wgSitename; |
135 | 135 | |
| 136 | + $config = UploadWizardConfig::getConfig( $this->campaign ); |
| 137 | + |
| 138 | + $labelPageContent = $this->getPageContent( $config['idFieldLabelPage'] ); |
| 139 | + if ( $labelPageContent !== false ) { |
| 140 | + $config['idFieldLabel'] = $labelPageContent; |
| 141 | + } |
| 142 | + |
136 | 143 | $wgOut->addScript( |
137 | 144 | Skin::makeVariablesScript( |
138 | 145 | array( |
139 | | - 'UploadWizardConfig' => UploadWizardConfig::getConfig( $this->campaign ) |
| 146 | + 'UploadWizardConfig' => $config |
140 | 147 | ) + |
141 | 148 | // Site name is a true global not specific to Upload Wizard |
142 | 149 | array( |
— | — | @@ -143,8 +150,33 @@ |
144 | 151 | ) |
145 | 152 | ) |
146 | 153 | ); |
147 | | - |
148 | 154 | } |
| 155 | + |
| 156 | + /** |
| 157 | + * Gets content of the specified page, or false if there is no such page. |
| 158 | + * '$1' in $pageName is replaced by the code of the current language. |
| 159 | + * |
| 160 | + * @since 1.2 |
| 161 | + * |
| 162 | + * @param string $pageName |
| 163 | + * |
| 164 | + * @return string|false |
| 165 | + */ |
| 166 | + protected function getPageContent( $pageName ) { |
| 167 | + $content = false; |
| 168 | + |
| 169 | + if ( trim( $pageName ) != '' ) { |
| 170 | + global $wgLang; |
| 171 | + $page = Title::newFromText( str_replace( '$1', $wgLang->getCode(), $pageName ) ); |
| 172 | + |
| 173 | + if ( !is_null( $page ) && $page->exists() ) { |
| 174 | + $article = new Article( $page ); |
| 175 | + $content = $article->getContent(); |
| 176 | + } |
| 177 | + } |
| 178 | + |
| 179 | + return $content; |
| 180 | + } |
149 | 181 | |
150 | 182 | /** |
151 | 183 | * Check if anyone can upload (or if other sitewide config prevents this) |
— | — | @@ -212,9 +244,10 @@ |
213 | 245 | |
214 | 246 | $globalConf = UploadWizardConfig::getConfig( $this->campaign ); |
215 | 247 | |
216 | | - if ( $globalConf['headerLabelPage'] !== false ) { |
| 248 | + $headerContent = $this->getPageContent( $globalConf['headerLabelPage'] ); |
| 249 | + if ( $headerContent !== false ) { |
217 | 250 | global $wgOut; |
218 | | - $wgOut->addWikiText( $globalConf['headerLabelPage'] ); |
| 251 | + $wgOut->addWikiText( $headerContent ); |
219 | 252 | } |
220 | 253 | |
221 | 254 | if ( array_key_exists( 'fallbackToAltUploadForm', $globalConf ) |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -180,15 +180,8 @@ |
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 | | - |
191 | 184 | _this.$form.append( |
192 | | - $j( '<div class="mwe-upwiz-details-fieldname"></div>' ).text( label ), |
| 185 | + $j( '<div class="mwe-upwiz-details-fieldname"></div>' ).text( mw.UploadWizard.config.idFieldLabel ), |
193 | 186 | $j( '<div class="mwe-id-field"></div>' ).append( _this.idFieldInput ) |
194 | 187 | ); |
195 | 188 | } |