Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | 'resources/mw.Api.js', |
54 | 54 | 'resources/mw.Api.edit.js', |
55 | 55 | 'resources/mw.Api.category.js', |
| 56 | + 'resources/mw.Api.parse.js', |
56 | 57 | 'resources/mw.Api.titleblacklist.js', |
57 | 58 | 'resources/mw.Title.js', |
58 | 59 | 'resources/mw.Feedback.js', |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js |
— | — | @@ -52,6 +52,20 @@ |
53 | 53 | _this.setValues( values ); |
54 | 54 | } |
55 | 55 | |
| 56 | + // set up preview dialog |
| 57 | + _this.$previewDialog = $j( '<div></div> ') |
| 58 | + .css( 'padding', 10 ) |
| 59 | + .dialog( { |
| 60 | + autoOpen: false, |
| 61 | + minWidth: 500, |
| 62 | + zIndex: 200000, |
| 63 | + modal: true |
| 64 | + } ); |
| 65 | + |
| 66 | + _this.$spinner = $j( '<div></div>' ) |
| 67 | + .addClass( 'mwe-upwiz-status-progress mwe-upwiz-file-indicator' ) |
| 68 | + .css( { width: 200, padding: 20 } ); |
| 69 | + |
56 | 70 | return _this; |
57 | 71 | }; |
58 | 72 | |
— | — | @@ -524,11 +538,30 @@ |
525 | 539 | }, |
526 | 540 | |
527 | 541 | /** |
528 | | - * Preview license from a particular input, in a popup window |
529 | | - * @param {jQuery} an input |
| 542 | + * Preview wikitext in a popup window |
| 543 | + * @param {String} wikitext |
530 | 544 | */ |
531 | | - showPreview: function( $input ) { |
532 | | - // do stuff with this.api |
| 545 | + showPreview: function( wikiText ) { |
| 546 | + |
| 547 | + this.$previewDialog.html( this.$spinner ).dialog( 'open' ); |
| 548 | + |
| 549 | + var _this = this; |
| 550 | + 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 | + _this.$previewDialog.html( html ); |
| 555 | + _this.$previewDialog.dialog( 'open' ); |
| 556 | + _this.$previewDialog.dialog( 'option', 'position', { 'at': 'center' } ); |
| 557 | + } |
| 558 | + |
| 559 | + var error = function( error ) { |
| 560 | + show( $j( '<div></div>' ).append( |
| 561 | + $j( '<h3></h3>' ).append( error['code'] ), |
| 562 | + $j( '<p></p>' ).append( error['info'] ) |
| 563 | + ) ); |
| 564 | + }; |
| 565 | + this.api.parse( wikiText, show, error ); |
533 | 566 | } |
534 | 567 | |
535 | 568 | |