Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -68,6 +68,13 @@ |
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 | + |
72 | 79 | // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in |
73 | 80 | // licensesOwnWork or licensesThirdParty. |
74 | 81 | // It just describes what licenses go with what wikitext, and how to display them in |
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadCampaign.php |
— | — | @@ -94,7 +94,12 @@ |
95 | 95 | |
96 | 96 | // show _ALL_ the licenses! |
97 | 97 | $standardConfig = UploadWizardConfig::getConfig(); |
98 | | - foreach ( $standardConfig['licenses'] as $key => $license ) { |
| 98 | + $licences = array_merge( |
| 99 | + $standardConfig['licenses'], |
| 100 | + array( 'wikitextLicense' => array( 'msg' => 'mwe-upwiz-campaign-customLicense' ) ) |
| 101 | + ); |
| 102 | + |
| 103 | + foreach ( $licences as $key => $license ) { |
99 | 104 | $configFields['licensesOwnWork']['options'][ wfMsg( $license['msg'] ) ] = $key; |
100 | 105 | $configFields['defaultOwnWorkLicence']['options'][ wfMsg( $license['msg'] ) ] = $key; |
101 | 106 | } |
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadWizard.php |
— | — | @@ -168,6 +168,15 @@ |
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 | + |
172 | 181 | $this->getOutput()->addScript( |
173 | 182 | Skin::makeVariablesScript( |
174 | 183 | array( |
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php |
— | — | @@ -198,6 +198,12 @@ |
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 | + ), |
202 | 208 | 'defaultCategories' => array( |
203 | 209 | 'type' => 'text' |
204 | 210 | ), |
— | — | @@ -213,13 +219,6 @@ |
214 | 220 | ), |
215 | 221 | ); |
216 | 222 | |
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 | | - |
224 | 223 | return $config; |
225 | 224 | } |
226 | 225 | |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -322,6 +322,7 @@ |
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', |
326 | 327 | 'mwe-upwiz-campaign-conf-skipTutorial' => 'Skip the licensing tutorial', |
327 | 328 | 'mwe-upwiz-campaign-conf-autoCategories' => 'Categories to add the files to automatically and silently (pipe separated):', |
328 | 329 | 'mwe-upwiz-campaign-conf-defaultCategories' => 'Default categories to list in the describe tab (pipe separated):', |
— | — | @@ -341,6 +342,8 @@ |
342 | 343 | 'mwe-upwiz-campaign-conf-headerLabelPage' => 'Page containing text to display above the UploadWizard interface. $1 is replaced with the language code:', |
343 | 344 | 'mwe-upwiz-campaign-conf-thanksLabelPage' => 'Page containing text to display on top of the "Use" page. $1 is replaced with the language code:', |
344 | 345 | '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):', |
345 | 348 | |
346 | 349 | // Coolcats |
347 | 350 | 'mw-coolcats-confirm-new-title' => 'Confirm new category', |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js |
— | — | @@ -55,16 +55,14 @@ |
56 | 56 | .attr( { name: "author" } ) |
57 | 57 | .addClass( 'mwe-upwiz-sign' ); |
58 | 58 | |
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; |
| 59 | + _this.showCustomDiv = mw.UploadWizard.config.licensesOwnWork.licenses.length > 1; |
62 | 60 | |
63 | 61 | if ( _this.showCustomDiv ) { |
64 | 62 | var licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' ); |
65 | 63 | |
66 | 64 | _this.licenseInput = new mw.UploadWizardLicenseInput( |
67 | 65 | licenseInputDiv, |
68 | | - undefined, |
| 66 | + undefined, |
69 | 67 | mw.UploadWizard.config.licensesOwnWork, |
70 | 68 | _this.uploadCount |
71 | 69 | ); |
— | — | @@ -91,8 +89,9 @@ |
92 | 90 | return this.licenseInput.getWikiText(); |
93 | 91 | } |
94 | 92 | else { |
| 93 | + var defLicensename = mw.UploadWizard.config.licensesOwnWork.defaults[0]; |
95 | 94 | return '{{' + mw.UploadWizard.config.licensesOwnWork.filterTemplate |
96 | | - + '|' + mw.UploadWizard.config.licensesOwnWork.defaults[0] + '}}'; |
| 95 | + + '|' + mw.UploadWizard.config.licenses[defLicensename]['templates'].join( '' ) + '}}'; |
97 | 96 | } |
98 | 97 | }, |
99 | 98 | |
— | — | @@ -119,15 +118,29 @@ |
120 | 119 | _this.$form = $j( '<form />' ); |
121 | 120 | |
122 | 121 | _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 | + |
123 | 139 | var $standardDiv = $j( '<div />' ).append( |
124 | 140 | $j( '<label for="author2" generated="true" class="mwe-validator-error" style="display:block;" />' ), |
125 | 141 | $j( '<p></p>' ).msg( 'mwe-upwiz-source-ownwork-assert', |
126 | 142 | uploadCount, |
127 | 143 | _this.$authorInput2 ), |
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 | | - ) |
| 144 | + $assertNote |
132 | 145 | ); |
133 | 146 | |
134 | 147 | var $crossfader = $j( '<div />' ).append( $standardDiv ); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js |
— | — | @@ -83,16 +83,28 @@ |
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 + ']'; |
88 | 87 | var $icons = $j( '<span></span>' ); |
89 | 88 | if ( mw.isDefined( license.props['icons'] ) ) { |
90 | 89 | $j.each( license.props.icons, function( i, icon ) { |
91 | 90 | $icons.append( $j( '<span></span>' ).addClass( 'mwe-upwiz-license-icon mwe-upwiz-' + icon + '-icon' ) ); |
92 | 91 | } ); |
93 | 92 | } |
| 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 | + |
94 | 106 | $el.append( |
95 | 107 | $input, |
96 | | - $j( '<label />' ).attr( { 'for': id } ).msg( messageKey, _this.count ).append( $icons ), |
| 108 | + $label, |
97 | 109 | $j( '<br/>' ) |
98 | 110 | // XXX help? |
99 | 111 | ); |