r102451 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102450‎ | r102451 | r102452 >
Date:21:38, 8 November 2011
Author:neilk
Status:ok
Tags:
Comment:
preview parsed custom wikitext
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizardHooks.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardHooks.php
@@ -52,6 +52,7 @@
5353 'resources/mw.Api.js',
5454 'resources/mw.Api.edit.js',
5555 'resources/mw.Api.category.js',
 56+ 'resources/mw.Api.parse.js',
5657 'resources/mw.Api.titleblacklist.js',
5758 'resources/mw.Title.js',
5859 'resources/mw.Feedback.js',
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -52,6 +52,20 @@
5353 _this.setValues( values );
5454 }
5555
 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+
5670 return _this;
5771 };
5872
@@ -524,11 +538,30 @@
525539 },
526540
527541 /**
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
530544 */
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 );
533566 }
534567
535568

Status & tagging log