Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -68,13 +68,6 @@ |
69 | 69 | // The maximum length of the id field. |
70 | 70 | 'idFieldMaxLength' => 25, |
71 | 71 | |
72 | | - // Wikitext for a custom own-work license. |
73 | | - // Leave empty for no such license. |
74 | | - 'wikitextLicense' => '', |
75 | | - |
76 | | - // Templates to add when choosing the custom in wikitext defined license. |
77 | | - 'wikitextLicenseTemplates' => array(), |
78 | | - |
79 | 72 | // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in |
80 | 73 | // licensesOwnWork or licensesThirdParty. |
81 | 74 | // It just describes what licenses go with what wikitext, and how to display them in |
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadCampaign.php |
— | — | @@ -94,12 +94,7 @@ |
95 | 95 | |
96 | 96 | // show _ALL_ the licenses! |
97 | 97 | $standardConfig = UploadWizardConfig::getConfig(); |
98 | | - $licences = array_merge( |
99 | | - $standardConfig['licenses'], |
100 | | - array( 'wikitextLicense' => array( 'msg' => 'mwe-upwiz-campaign-customLicense' ) ) |
101 | | - ); |
102 | | - |
103 | | - foreach ( $licences as $key => $license ) { |
| 98 | + foreach ( $standardConfig['licenses'] as $key => $license ) { |
104 | 99 | $configFields['licensesOwnWork']['options'][ wfMsg( $license['msg'] ) ] = $key; |
105 | 100 | $configFields['defaultOwnWorkLicence']['options'][ wfMsg( $license['msg'] ) ] = $key; |
106 | 101 | } |
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php |
— | — | @@ -168,15 +168,6 @@ |
169 | 169 | |
170 | 170 | $config['thanksLabel'] = $this->getPageContent( $config['thanksLabelPage'], true ); |
171 | 171 | |
172 | | - if ( in_array( 'wikitextLicense', $config['licensesOwnWork']['licenses'] ) ) { |
173 | | - $config['wikitextLicense'] = str_replace( '$1', $this->getLang()->getCode(), $config['wikitextLicense'] ); |
174 | | - |
175 | | - $config['licenses']['wikitextLicense'] = array( |
176 | | - 'html' => $this->getOutput()->parse( $config['wikitextLicense'], false ), |
177 | | - 'templates' => $config['wikitextLicenseTemplates'], |
178 | | - ); |
179 | | - } |
180 | | - |
181 | 172 | $this->getOutput()->addScript( |
182 | 173 | Skin::makeVariablesScript( |
183 | 174 | array( |
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php |
— | — | @@ -198,12 +198,6 @@ |
199 | 199 | 'options' => array(), |
200 | 200 | 'default' => $globalConfig['licensesOwnWork']['defaults'][0] |
201 | 201 | ), |
202 | | - 'wikitextLicense' => array( |
203 | | - 'type' => 'text' |
204 | | - ), |
205 | | - 'wikitextLicenseTemplates' => array( |
206 | | - 'type' => 'text' |
207 | | - ), |
208 | 202 | 'defaultCategories' => array( |
209 | 203 | 'type' => 'text' |
210 | 204 | ), |
— | — | @@ -219,6 +213,13 @@ |
220 | 214 | ), |
221 | 215 | ); |
222 | 216 | |
| 217 | + foreach ( $globalConfig['licensesOwnWork']['licenses'] as $license ) { |
| 218 | + $licenceMsg = wfMsg( $globalConfig['licenses'][$license]['msg'] ); |
| 219 | + $config['licensesOwnWork']['options'][$licenceMsg] = $license; |
| 220 | + } |
| 221 | + |
| 222 | + $config['defaultOwnWorkLicence']['options'] = $config['licensesOwnWork']['options']; |
| 223 | + |
223 | 224 | return $config; |
224 | 225 | } |
225 | 226 | |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -322,7 +322,6 @@ |
323 | 323 | 'uploadcampaign-text' => 'You are modifying an Upload Wizard campaign.', |
324 | 324 | 'mwe-upwiz-campaign-name' => 'Campaign name:', |
325 | 325 | 'mwe-upwiz-campaign-enabled' => 'Campaign enabled', |
326 | | - 'mwe-upwiz-campaign-customLicense' => 'Custom license', |
327 | 326 | 'mwe-upwiz-campaign-conf-skipTutorial' => 'Skip the licensing tutorial', |
328 | 327 | 'mwe-upwiz-campaign-conf-autoCategories' => 'Categories to add the files to automatically and silently (pipe separated):', |
329 | 328 | 'mwe-upwiz-campaign-conf-defaultCategories' => 'Default categories to list in the describe tab (pipe separated):', |
— | — | @@ -342,8 +341,6 @@ |
343 | 342 | 'mwe-upwiz-campaign-conf-headerLabelPage' => 'Page containing text to display above the UploadWizard interface. $1 is replaced with the language code:', |
344 | 343 | 'mwe-upwiz-campaign-conf-thanksLabelPage' => 'Page containing text to display on top of the "Use" page. $1 is replaced with the language code:', |
345 | 344 | 'mwe-upwiz-campaign-conf-idFieldMaxLength' => 'Maximum length of the text in the ID field', |
346 | | - 'mwe-upwiz-campaign-conf-wikitextLicense' => 'Wikitext for a custom own-work license. Empty for no such custom license. $1 is replaced with the language code:', |
347 | | - 'mwe-upwiz-campaign-conf-wikitextLicenseTemplates' => 'Templates to add when the user chooses the custom license (pipe separated):', |
348 | 345 | |
349 | 346 | // Coolcats |
350 | 347 | 'mw-coolcats-confirm-new-title' => 'Confirm new category', |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js |
— | — | @@ -55,14 +55,16 @@ |
56 | 56 | .attr( { name: "author" } ) |
57 | 57 | .addClass( 'mwe-upwiz-sign' ); |
58 | 58 | |
59 | | - _this.showCustomDiv = mw.UploadWizard.config.licensesOwnWork.licenses.length > 1; |
| 59 | + var ownWork = mw.UploadWizard.config.licensesOwnWork; |
| 60 | + var licenseIsNotDefault = ( ownWork.licenses.length === 1 && ownWork.licenses[0] !== ownWork.defaults[0] ); |
| 61 | + _this.showCustomDiv = ownWork.licenses.length > 1 || licenseIsNotDefault; |
60 | 62 | |
61 | 63 | if ( _this.showCustomDiv ) { |
62 | 64 | var licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' ); |
63 | 65 | |
64 | 66 | _this.licenseInput = new mw.UploadWizardLicenseInput( |
65 | 67 | licenseInputDiv, |
66 | | - undefined, |
| 68 | + undefined, |
67 | 69 | mw.UploadWizard.config.licensesOwnWork, |
68 | 70 | _this.uploadCount |
69 | 71 | ); |
— | — | @@ -89,9 +91,8 @@ |
90 | 92 | return this.licenseInput.getWikiText(); |
91 | 93 | } |
92 | 94 | else { |
93 | | - var defLicensename = mw.UploadWizard.config.licensesOwnWork.defaults[0]; |
94 | 95 | return '{{' + mw.UploadWizard.config.licensesOwnWork.filterTemplate |
95 | | - + '|' + mw.UploadWizard.config.licenses[defLicensename]['templates'].join( '' ) + '}}'; |
| 96 | + + '|' + mw.UploadWizard.config.licensesOwnWork.defaults[0] + '}}'; |
96 | 97 | } |
97 | 98 | }, |
98 | 99 | |
— | — | @@ -118,29 +119,15 @@ |
119 | 120 | _this.$form = $j( '<form />' ); |
120 | 121 | |
121 | 122 | _this.$authorInput2 = $j( '<input type="text" />' ).attr( { name: "author2" } ).addClass( 'mwe-upwiz-sign' ); |
122 | | - |
123 | | - var $assertNote = $j( '<p class="mwe-small-print"></p>' ); |
124 | | - |
125 | | - var defLicense = mw.UploadWizard.config.licensesOwnWork.defaults[0]; |
126 | | - defLicense = mw.UploadWizard.config.licenses[defLicense]; |
127 | | - |
128 | | - if ( mw.isDefined( defLicense.html ) ) { |
129 | | - $assertNote.text( gM( 'mwe-upwiz-source-ownwork-assert-note', '' ) ) |
130 | | - .append( defLicense.html ) |
131 | | - } |
132 | | - else { |
133 | | - $assertNote.msg( |
134 | | - 'mwe-upwiz-source-ownwork-assert-note', |
135 | | - gM( defLicense.msg ) |
136 | | - ) |
137 | | - } |
138 | | - |
139 | 123 | var $standardDiv = $j( '<div />' ).append( |
140 | 124 | $j( '<label for="author2" generated="true" class="mwe-validator-error" style="display:block;" />' ), |
141 | 125 | $j( '<p></p>' ).msg( 'mwe-upwiz-source-ownwork-assert', |
142 | 126 | uploadCount, |
143 | 127 | _this.$authorInput2 ), |
144 | | - $assertNote |
| 128 | + $j( '<p class="mwe-small-print"></p>' ).msg( |
| 129 | + 'mwe-upwiz-source-ownwork-assert-note', |
| 130 | + gM( 'mwe-upwiz-license-' + mw.UploadWizard.config.licensesOwnWork.defaults[0] ) |
| 131 | + ) |
145 | 132 | ); |
146 | 133 | |
147 | 134 | var $crossfader = $j( '<div />' ).append( $standardDiv ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js |
— | — | @@ -83,28 +83,16 @@ |
84 | 84 | $input.data( 'licenseName', name ); |
85 | 85 | _this.inputs.push( $input ); |
86 | 86 | |
| 87 | + var messageKey = mw.isDefined( license.props['msg'] ) ? license.props.msg : '[missing msg for ' + license.name + ']'; |
87 | 88 | var $icons = $j( '<span></span>' ); |
88 | 89 | if ( mw.isDefined( license.props['icons'] ) ) { |
89 | 90 | $j.each( license.props.icons, function( i, icon ) { |
90 | 91 | $icons.append( $j( '<span></span>' ).addClass( 'mwe-upwiz-license-icon mwe-upwiz-' + icon + '-icon' ) ); |
91 | 92 | } ); |
92 | 93 | } |
93 | | - |
94 | | - var $label = $j( '<label />' ).attr( { 'for': id } ).append( $icons ); |
95 | | - |
96 | | - if ( mw.isDefined( license.props['html'] ) ) { |
97 | | - $label.html( license.props['html'] ); |
98 | | - } |
99 | | - else if ( mw.isDefined( license.props['msg'] ) ) { |
100 | | - $label.msg( license.props['msg'], _this.count ); |
101 | | - } |
102 | | - else { |
103 | | - $label.text( '[missing msg for ' + license.name + ']' ); |
104 | | - } |
105 | | - |
106 | 94 | $el.append( |
107 | 95 | $input, |
108 | | - $label, |
| 96 | + $j( '<label />' ).attr( { 'for': id } ).msg( messageKey, _this.count ).append( $icons ), |
109 | 97 | $j( '<br/>' ) |
110 | 98 | // XXX help? |
111 | 99 | ); |