Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -216,6 +216,10 @@ |
217 | 217 | |
218 | 218 | // Custom wikitext must have at least one template that is a descendant of this category |
219 | 219 | 'licenseCategory' => 'License tags', |
| 220 | + |
| 221 | + // When checking custom wikitext licenses, parse these templates as "filters"; |
| 222 | + // their arguments look like strings but they are really templates |
| 223 | + 'licenseTagFilters' => array( 'self' ), |
220 | 224 | |
221 | 225 | // radio button selection of some licenses |
222 | 226 | 'licensesOwnWork' => array( |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | mw.UploadWizardLicenseInput = function( selector, values, config, count, api ) { |
21 | 21 | var _this = this; |
22 | 22 | _this.count = count; |
| 23 | + |
23 | 24 | _this.api = api; |
24 | 25 | |
25 | 26 | if ( ! ( mw.isDefined(config.type) |
— | — | @@ -57,14 +58,14 @@ |
58 | 59 | .css( 'padding', 10 ) |
59 | 60 | .dialog( { |
60 | 61 | autoOpen: false, |
61 | | - minWidth: 500, |
| 62 | + width: 800, |
62 | 63 | zIndex: 200000, |
63 | 64 | modal: true |
64 | 65 | } ); |
65 | 66 | |
66 | 67 | _this.$spinner = $j( '<div></div>' ) |
67 | 68 | .addClass( 'mwe-upwiz-status-progress mwe-upwiz-file-indicator' ) |
68 | | - .css( { width: 200, padding: 20 } ); |
| 69 | + .css( { 'width': 200, 'padding': 20, 'float': 'none', 'margin': '0 auto' } ); |
69 | 70 | |
70 | 71 | return _this; |
71 | 72 | }; |
— | — | @@ -488,9 +489,21 @@ |
489 | 490 | |
490 | 491 | function accumTemplates( node, templates ) { |
491 | 492 | if ( typeof node === 'object' ) { |
492 | | - var operation = node[0].toLowerCase(); |
493 | | - if ( typeof mw.language.htmlEmitter.prototype[operation] !== 'function' ) { |
494 | | - templates.push( operation ); |
| 493 | + var nodeName = node[0]; |
| 494 | + var lcNodeName = nodeName.toLowerCase(); |
| 495 | + // templates like Self are special cased, as it is not a license tag and also reparses its string arguments into templates |
| 496 | + // e.g. {{self|Cc-by-sa-3.0}} --> we should add 'Cc-by-sa-3.0' to the templates |
| 497 | + if ( mw.UploadWizard.config.licenseTagFilters |
| 498 | + && |
| 499 | + mw.UploadWizard.config.licenseTagFilters.indexOf( lcNodeName ) !== -1 ) { |
| 500 | + // upgrade all the arguments to be nodes in their own right (by making them the first element of an array) |
| 501 | + // so, [ "self", "Cc-by-sa-3.0", "GFDL" ] --> [ "self", [ "Cc-by-sa-3.0" ], [ "GFDL" ] ]; |
| 502 | + // $.map seems to strip away arrays of one element so have to use an array within an array. |
| 503 | + node = $j.map( node, function( n, i ) { |
| 504 | + return i == 0 ? n : [[n]]; |
| 505 | + } ); |
| 506 | + } else if ( typeof mw.language.htmlEmitter.prototype[lcNodeName] !== 'function' ) { |
| 507 | + templates.push( nodeName ); |
495 | 508 | } |
496 | 509 | $j.map( node.slice( 1 ), function( n ) { |
497 | 510 | accumTemplates( n, templates ); |
— | — | @@ -500,7 +513,6 @@ |
501 | 514 | var templates = []; |
502 | 515 | accumTemplates( ast, templates ); |
503 | 516 | |
504 | | - |
505 | 517 | // TODO caching |
506 | 518 | var found = false; |
507 | 519 | function recurseCategories( desiredCatTitle, title, depthToContinue ) { |
— | — | @@ -547,12 +559,8 @@ |
548 | 560 | |
549 | 561 | var _this = this; |
550 | 562 | function show( html ) { |
551 | | - // apparently it is necessary to reaffirm all this every time if you want auto-resizing in jQuery 1.6 |
552 | | - _this.$previewDialog.dialog( 'option', 'width', 'auto' ); |
553 | | - _this.$previewDialog.dialog( 'option', 'height', 'auto' ); |
554 | 563 | _this.$previewDialog.html( html ); |
555 | 564 | _this.$previewDialog.dialog( 'open' ); |
556 | | - _this.$previewDialog.dialog( 'option', 'position', { 'at': 'center' } ); |
557 | 565 | } |
558 | 566 | |
559 | 567 | var error = function( error ) { |
— | — | @@ -561,6 +569,7 @@ |
562 | 570 | $j( '<p></p>' ).append( error['info'] ) |
563 | 571 | ) ); |
564 | 572 | }; |
| 573 | + |
565 | 574 | this.api.parse( wikiText, show, error ); |
566 | 575 | } |
567 | 576 | |