Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -1170,31 +1170,44 @@ |
1171 | 1171 | |
1172 | 1172 | }, |
1173 | 1173 | |
1174 | | - |
1175 | | - // do some last minute prep before advancing to the DEEDS page |
1176 | | - prepareAndMoveToDeeds: function() { |
1177 | | - var _this = this; |
| 1174 | + |
| 1175 | + /** |
| 1176 | + * Get the own work and third party licensing deeds if they are needed. |
| 1177 | + * |
| 1178 | + * @since 1.2 |
| 1179 | + * @param {int|false} uploadsLength |
| 1180 | + * @return {Array} |
| 1181 | + */ |
| 1182 | + getLicensingDeeds: function( uploadsLength ) { |
1178 | 1183 | var deeds = []; |
1179 | | - var hasChoice = mw.UploadWizard.config.ownWorkOption == 'choice'; |
1180 | 1184 | |
1181 | | - if ( hasChoice ) { |
| 1185 | + if ( mw.UploadWizard.config.ownWorkOption == 'choice' ) { |
1182 | 1186 | // these deeds are standard |
1183 | | - deeds.push( new mw.UploadWizardDeedOwnWork( _this.uploads.length ) ); |
1184 | | - deeds.push( new mw.UploadWizardDeedThirdParty( _this.uploads.length ) ); |
| 1187 | + deeds.push( new mw.UploadWizardDeedOwnWork( uploadsLength ) ); |
| 1188 | + deeds.push( new mw.UploadWizardDeedThirdParty( uploadsLength ) ); |
1185 | 1189 | } |
1186 | 1190 | else { |
1187 | 1191 | if ( mw.UploadWizard.config.ownWorkOption == 'own' ) { |
1188 | | - deeds.push( new mw.UploadWizardDeedOwnWork( _this.uploads.length ) ); |
| 1192 | + deeds.push( new mw.UploadWizardDeedOwnWork( uploadsLength ) ); |
1189 | 1193 | } |
1190 | 1194 | else { |
1191 | | - deeds.push( new mw.UploadWizardDeedThirdParty( _this.uploads.length ) ); |
| 1195 | + deeds.push( new mw.UploadWizardDeedThirdParty( uploadsLength ) ); |
1192 | 1196 | } |
1193 | 1197 | } |
| 1198 | + |
| 1199 | + return deeds; |
| 1200 | + }, |
1194 | 1201 | |
| 1202 | + // do some last minute prep before advancing to the DEEDS page |
| 1203 | + prepareAndMoveToDeeds: function() { |
| 1204 | + var _this = this; |
| 1205 | + var deeds = _this.getLicensingDeeds( _this.uploads.length ); |
| 1206 | + |
1195 | 1207 | this.shouldShowIndividualDeed = function() { |
1196 | | - if ( hasChoice ) return true; |
1197 | | - |
1198 | | - if ( mw.UploadWizard.config.ownWorkOption == 'own' ) { |
| 1208 | + if ( mw.UploadWizard.config.ownWorkOption == 'choice' ) { |
| 1209 | + return true; |
| 1210 | + } |
| 1211 | + else if ( mw.UploadWizard.config.ownWorkOption == 'own' ) { |
1199 | 1212 | var ownWork = mw.UploadWizard.config.licensesOwnWork; |
1200 | 1213 | var licenseIsNotDefault = ( ownWork.licenses.length === 1 && ownWork.licenses[0] !== ownWork.defaults[0] ); |
1201 | 1214 | return ownWork.licenses.length > 1 || licenseIsNotDefault; |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDetails.js |
— | — | @@ -350,12 +350,14 @@ |
351 | 351 | var _this = this; |
352 | 352 | _this.copyrightInfoFieldset.show(); |
353 | 353 | _this.upload.wizardDeedChooser = _this.upload.deedChooser; |
| 354 | + |
354 | 355 | _this.upload.deedChooser = new mw.UploadWizardDeedChooser( |
355 | 356 | _this.deedDiv, |
356 | | - [ new mw.UploadWizardDeedOwnWork(), |
357 | | - new mw.UploadWizardDeedThirdParty() ], |
| 357 | + mw.UploadWizard.prototype.getLicensingDeeds(), |
358 | 358 | [ _this.upload ] |
359 | 359 | ); |
| 360 | + |
| 361 | + _this.upload.deedChooser.onLayoutReady(); |
360 | 362 | }, |
361 | 363 | |
362 | 364 | /** |