r65589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65588‎ | r65589 | r65590 >
Date:22:10, 27 April 2010
Author:neilk
Status:deferred
Tags:
Comment:
license selector as widget; mask-safe hiding/unhiding
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/css/uploadWizard.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js (modified) (history)
  • /branches/js2-work/phase3/js/specialUploadWizardPage.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/loader.js
@@ -80,7 +80,6 @@
8181
8282 //Add uploadwizard classes to a new "request" var:
8383 //request.push( libraries );
84 -
8584 mw.load( libraries, function() {
8685 callback( 'UploadWizard.UploadWizard' );
8786 } );
@@ -94,7 +93,6 @@
9594 //Add uploadwizard classes to a new "request" var:
9695 //request.push( testLibraries );
9796 //debugger;
98 -
9997 mw.load( testLibraries, function() {
10098 callback( 'UploadWizard.UploadWizardTest' );
10199 } );
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js
@@ -52,7 +52,7 @@
5353 "mwe-upwiz-other-prefill": "Free wikitext field",
5454 "mwe-upwiz-showall": "show all",
5555 "mwe-upwiz-source": "Source",
56 - "mwe-upwiz-macro-edit-intro": "Please add some descriptions and other information to your uploads.",
 56+ "mwe-upwiz-macro-edit-intro": "Choose a license first above, then you can add some descriptions and other information to your uploads.",
5757 "mwe-upwiz-macro-edit": "Update descriptions",
5858 "mwe-upwiz-thanks-intro": "Thanks for uploading your works! You can now use your files on a Wikipedia article or link to them from elsewhere on the web.",
5959 "mwe-upwiz-thanks-link": "This file is now available at <b><tt>$1</tt></b>.",
@@ -74,96 +74,42 @@
7575
7676 /**
7777 *
78 - * @param inputs - obj with one or more of three keys, 'source' and 'author' (html inputs) and 'license' (mw.UploadWizardLicense object)
7978 */
80 -mw.UploadWizardDeed = function ( inputs ) {
 79+mw.UploadWizardDeed = function() {
8180 var _this = this;
82 - _this.sourceInput = inputs['source'];
83 - _this.authorInput = inputs['author'];
84 - _this.licenseInput = inputs['license'];
85 - _this.customizable = { 'source': true, 'author': true, 'license': true };
86 - _this.readyCheck = undefined;
87 - _this.isOwn = false;
 81+ // prevent from instantiating directly?
8882 };
8983
 84+/* sort of an abstract class */
9085 mw.UploadWizardDeed.prototype = {
91 - setCustomizable: function( obj ) {
92 - var _this = this;
93 - $j.each( obj, function( key, val ) {
94 - if (_this.customizable.hasOwnProperty( key ) ) {
95 - _this.customizable[key] = !!val;
96 - }
97 - } );
 86+ isReady: function() {
 87+ return false;
9888 },
9989
100 - setReadyCheck: function( callback ) {
101 - var _this = this;
102 - _this.readyCheck = callback;
 90+ getSourceWikiText: function() {
 91+ return $j( _this.sourceInput ).val();
10392 },
10493
105 - isReady: function() {
106 - var _this = this;
107 - if ( _this.readyCheck === undefined ) {
108 - return true;
109 - } else {
110 - return _this.readyCheck();
111 - }
 94+ getAuthorWikiText: function() {
 95+ return $j( _this.authorInput ).val();
11296 },
11397
114 - applyDeed: function( uploads ) {
 98+ /**
 99+ * Get wikitext representing the licenses selected in the license object
 100+ * @return wikitext of all applicable license templates.
 101+ */
 102+ getLicenseWikiText: function() {
115103 var _this = this;
116 - if ( ! _this.isReady() ) {
117 - return;
118 - }
119 -
120 - var source;
121 - var author;
122 - if ( _this.isOwn ) {
123 - source = '{{own}}';
124 - author = "[[User:" + mw.getConfig('userName') + '|' + $j( _this.authorInput ).val() + ']]';
125 - } else {
126 - source = $j( _this.sourceInput ).val();
127 - author = $j( _this.authorInput ).val();
128 - }
129 - var licenses = _this.licenseInput.getValues();
130 -
131 - var licenseTxt = '';
132 - for (key in licenses) {
133 - licenseTxt += '[' + key + ']=' + licenses[key] + ' ';
134 - }
135 - mw.log( "source:" + source + " author:" + author + " licenses:" + licenseTxt );
136 -
137 -
138 - $j.each( uploads, function( i, upload ) {
139 -
140 - $j( upload.details.sourceInput ).val( source );
141 - if ( _this.customizable['source'] ) {
142 - upload.details.unlockSource();
143 - } else {
144 - upload.details.lockSource();
145 - }
146 -
147 - $j( upload.details.authorInput ).val( author );
148 - if ( _this.customizable['author'] ) {
149 - upload.details.unlockAuthor();
150 - } else {
151 - upload.details.lockAuthor();
152 - }
153 -
154 - upload.details.licenseInput.setValues( licenses );
155 - if ( _this.isOwn ) {
156 - upload.details.licenseInput.setOwn( true );
157 - }
158 - if ( _this.customizable['license'] ) {
159 - upload.details.unlockLicense();
160 - } else {
161 - upload.details.lockLicense();
162 - }
163 -
 104+ var wikiText = '';
 105+ $j.each ( _this.licenses, function( key, data ) {
 106+ if (data.input.checked) {
 107+ wikiText += "{{" + data.template + "}}\n";
 108+ }
164109 } );
 110+
 111+ return wikiText;
165112 }
166113
167 -
168114 };
169115
170116 mw.ProgressBar = function( selector, text ) {
@@ -286,7 +232,6 @@
287233 mw.UploadWizardLicenseInput = function( div, values ) {
288234 var _this = this;
289235
290 - _this.isOwn = false;
291236 _this.change = function() {};
292237
293238 var c = mw.UploadWizardLicenseInput.prototype.count++;
@@ -325,47 +270,6 @@
326271 count: 0,
327272
328273 /**
329 - * set callback for onchange of any value
330 - */
331 - setChange: function( callback ) {
332 - var _this = this;
333 - _this.change = callback;
334 - },
335 -
336 - /**
337 - * Get wikitext representing the licenses selected in the license object
338 - * @return wikitext of all applicable license templates.
339 - */
340 - getWikiText: function() {
341 - var _this = this;
342 - var wikiText = '';
343 - if ( _this.isOwn ) {
344 - wikiText = '{{self';
345 - $j.each ( _this.licenses, function( key, data ) {
346 - if ( data.input.checked ) {
347 - wikiText += '|' + data.template;
348 - }
349 - } );
350 - wikiText += '}}';
351 - } else {
352 - $j.each ( _this.licenses, function( key, data ) {
353 - if (data.input.checked) {
354 - wikiText += "{{" + data.template + "}}\n";
355 - }
356 - } );
357 - }
358 - return wikiText;
359 - },
360 -
361 - /**
362 - * Modifies how this license will output wikiText. The templates will tack on an "I, the copyright owner blah blah".
363 - */
364 - setOwn: function( bool ) {
365 - var _this = this;
366 - _this.isOwn = !!bool;
367 - },
368 -
369 - /**
370274 * Sets the value(s) of a license input.
371275 * @param object of license-key to boolean values, e.g. { cc_by_sa_30: true, gfdl: true }
372276 */
@@ -438,6 +342,11 @@
439343
440344 mw.UploadWizardUpload.prototype = {
441345
 346+ acceptDeed: function( deed ) {
 347+ var _this = this;
 348+ _this.deed.applyDeed( _this );
 349+ },
 350+
442351 /**
443352 * start
444353 */
@@ -778,10 +687,13 @@
779688 * @param selector jquery-compatible selector, for a single element
780689 */
781690 moveFileInputToCover: function( selector ) {
 691+ //mw.log( "moving to cover " + selector );
782692 var _this = this;
783 - //debugger;
784693 var $covered = $j( selector );
785694
 695+ //mw.log( "position: " );
 696+ //mw.log( $covered.position() );
 697+
786698 _this.fileCtrlContainer
787699 .css( $covered.position() )
788700 .width( $covered.outerWidth() )
@@ -1059,14 +971,14 @@
1060972
1061973 _this.titleErrorDiv = $j('<div></div>');
1062974
1063 - _this.titleContainerDiv = $j('<div class="mwe-details-label-input></div>')
 975+ _this.titleContainerDiv = $j('<div class="mwe-upwiz-details-label-input></div>')
1064976 .append( $j( '<div class="mwe-upwiz-details-label"></div>' ).append( gM( 'mwe-upwiz-title' ) ) )
1065977 .append( $j( '<div class="mwe-upwiz-details-input"></div>' ).append( _this.titleInput ) )
1066978 .append( _this.titleErrorDiv );
1067979
1068 - _this.moreDetailsDiv = $j('<div class="mwe-more-details"></div>').hide();
 980+ _this.moreDetailsDiv = $j('<div class="mwe-more-details"></div>').maskSafeHide();
1069981
1070 - _this.moreDetailsCtrlDiv = $j( '<div class="mwe-details-more-options"></div>' );
 982+ _this.moreDetailsCtrlDiv = $j( '<div class="mwe-upwiz-details-more-options"></div>' );
1071983
1072984
1073985
@@ -1081,56 +993,57 @@
1082994
1083995 _this.locationInput = $j( '<input type="text" class="mwe-location" size="20"/>' );
1084996
1085 - var aboutThisWorkDiv = $j('<fieldset class="mwe-fieldset"></div>')
 997+ var aboutThisWorkDiv = $j('<fieldset class="mwe-fieldset"></fieldset>')
1086998 .append( $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-about-this-work' ) ) )
1087 - .append( $j( '<div class="mwe-details-more-subdiv">' )
 999+ .append( $j( '<div class="mwe-upwiz-details-more-subdiv">' )
10881000 .append( $j( '<div class="mwe-upwiz-details-label-input"></div>' )
1089 - .append( $j( '<div class="mwe-details-more-label"></div>' ).append( gM( 'mwe-upwiz-date-created' ) ) )
1090 - .append( $j( '<div class="mwe-details-more-input"></div>' ).append( _this.dateInput ) )
 1001+ .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-date-created' ) ) )
 1002+ .append( $j( '<div class="mwe-upwiz-details-more-input"></div>' ).append( _this.dateInput ) )
10911003 )
10921004 .append( $j ( '<div style="display: none;"></div>' ) // see prefillLocation
1093 - .append( $j( '<div class="mwe-details-more-label"></div>' ).append( gM( 'mwe-upwiz-location' ) ) )
1094 - .append( $j( '<div class="mwe-details-more-input"></div>' ).append( _this.locationInput ) )
 1005+ .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-location' ) ) )
 1006+ .append( $j( '<div class="mwe-upwiz-details-more-input"></div>' ).append( _this.locationInput ) )
10951007 )
10961008 );
10971009
 1010+/*
10981011 // XXX why is rows=1 giving me two rows. Is this growTextArea's fault?
10991012 _this.sourceInput = $j('<textarea class="mwe-source" rows="1" cols="40"></textarea>' ).growTextArea();
11001013 _this.sourceDiv = $j( '<div></div>' )
1101 - .append( $j( '<div class="mwe-details-more-label"></div>' ).append( gM( 'mwe-upwiz-source' ) ) )
1102 - .append( $j( '<div class="mwe-details-more-input"></div>' ).append( _this.sourceInput ) );
 1014+ .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-source' ) ) )
 1015+ .append( $j( '<div class="mwe-upwiz-details-more-input"></div>' ).append( _this.sourceInput ) );
11031016
11041017
11051018 _this.authorInput = $j('<textarea class="mwe-author" rows="1" cols="40"></textarea>' ).growTextArea();
11061019 _this.authorDiv = $j( '<div></div>' )
1107 - .append( $j( '<div class="mwe-details-more-label"></div>' ).append( gM( 'mwe-upwiz-author' ) ) )
1108 - .append( $j( '<div class="mwe-details-more-input"></div>' ).append( _this.authorInput ) );
 1020+ .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-author' ) ) )
 1021+ .append( $j( '<div class="mwe-upwiz-details-more-input"></div>' ).append( _this.authorInput ) );
11091022
11101023
11111024 var licenseInputDiv = $j('<div></div>');
11121025 _this.licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv );
11131026 _this.licenseDiv = $j( '<div></div>' )
1114 - .append( $j( '<div class="mwe-details-more-label"></div>' ).append( gM( 'mwe-upwiz-license' ) ) )
1115 - .append( $j( '<div class="mwe-details-more-input"></div>' ).append( licenseInputDiv ) );
 1027+ .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-license' ) ) )
 1028+ .append( $j( '<div class="mwe-upwiz-details-more-input"></div>' ).append( licenseInputDiv ) );
 1029+*/
11161030
1117 - var copyrightInfoDiv = $j('<div></div>')
1118 - .append( $j( '<h5 class="mwe-details-more-subhead">' ).append( gM( 'mwe-upwiz-copyright-info' ) ) )
1119 - .append( $j( '<div class="mwe-details-more-subdiv">' )
1120 - .append( _this.sourceDiv,
1121 - _this.authorDiv,
1122 - _this.licenseDiv ) );
 1031+ // XXX create a toggler that will switch between a custom deed chooser and the upload's chooser
 1032+ var copyrightInfoDiv = $j('<fieldset class="mwe-fieldset"></fieldset>')
 1033+ .append( $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-copyright-info' ) ) )
 1034+ .append( $j( '<div class="mwe-upwiz-details-more-subdiv">' )
 1035+ .html( "As above" ) ); // XXX
11231036
11241037
1125 - var aboutTheFileDiv = $j('<div></div>')
1126 - .append( $j( '<h5 class="mwe-details-more-subhead">' ).append( gM( 'mwe-upwiz-about-format' ) ) )
1127 - .append( $j( '<div class="mwe-details-more-subdiv">' )
 1038+ var aboutTheFileDiv = $j('<fieldset class="mwe-fieldset"></fieldset>')
 1039+ .append( $j( '<legend class="mwe-legend">' ).append( gM( 'mwe-upwiz-about-format' ) ) )
 1040+ .append( $j( '<div class="mwe-upwiz-details-more-subdiv">' )
11281041 .append( $j( '<div></div>' )
1129 - .append( $j( '<div class="mwe-details-more-label"></div>' ).append( gM( 'mwe-upwiz-filename-tag' ) ) )
1130 - .append( $j( '<div id="mwe-upwiz-details-filename" class="mwe-details-more-input"></div>' ) ) ) );
 1042+ .append( $j( '<div class="mwe-upwiz-details-more-label"></div>' ).append( gM( 'mwe-upwiz-filename-tag' ) ) )
 1043+ .append( $j( '<div class="mwe-upwiz-details-filename mwe-upwiz-details-more-input"></div>' ) ) ) );
11311044
1132 - _this.otherInformationInput = $j( '<textarea class="mwe-upwiz-other-textarea" rows="3" cols="40"></textarea>' );
 1045+ _this.otherInformationInput = $j( '<textarea class="mwe-upwiz-other-textarea"></textarea>' );
11331046 var otherInformationDiv = $j('<div></div>')
1134 - .append( $j( '<h5 class="mwe-details-more-subhead">' ).append( gM( 'mwe-upwiz-other' ) ) )
 1047+ .append( $j( '<div class="mwe-upwiz-details-more-label">' ).append( gM( 'mwe-upwiz-other' ) ) )
11351048 .append( _this.otherInformationInput );
11361049
11371050
@@ -1566,6 +1479,15 @@
15671480 */
15681481 getWikiText: function() {
15691482 var _this = this;
 1483+
 1484+ // XXX validate!
 1485+ if ( ! _this.isReady() ) {
 1486+ alert( "ZOMG THIS DEED IS NOT READY" );
 1487+ return null;
 1488+ }
 1489+
 1490+
 1491+
15701492 wikiText = '';
15711493
15721494
@@ -1590,17 +1512,14 @@
15911513 }
15921514 $j.each( _this.descriptions, function( i, desc ) {
15931515 information['description'] += desc.getWikiText();
1594 - } );
1595 -
 1516+ } );
15961517
15971518 // XXX add a sanity check here for good date
15981519 information['date'] = $j( _this.dateInput ).val().trim();
15991520
1600 - // we must have all of: source, author, license
1601 - information['source'] = $j( _this.sourceInput ).val().trim();
 1521+ information['source'] = _this.deedChooser.deed.getSourceWikiText();
16021522
1603 - information['author'] = $j( _this.authorInput ).val().trim();
1604 - // we could try just auto looking up User and Creator, and asking them every time
 1523+ information['author'] = _this.deedChooser.deed.getAuthorWikiText();
16051524
16061525 var info = '';
16071526 for ( var key in information ) {
@@ -1614,7 +1533,7 @@
16151534
16161535 wikiText += "=={{int:license-header}}==\n";
16171536
1618 - wikiText += _this.licenseInput.getWikiText();
 1537+ wikiText += _this.deedChooser.deed.getLicenseWikiText();
16191538
16201539 // add a location template
16211540
@@ -1632,6 +1551,9 @@
16331552 * Check if we are ready to post wikitext
16341553 */
16351554 isReady: function() {
 1555+ var _this = this;
 1556+ return _this.deedChooser.deed.isReady();
 1557+
16361558 // somehow, all the various issues discovered with this upload should be present in a single place
16371559 // where we can then check on
16381560 // perhaps as simple as _this.issues or _this.agenda
@@ -1771,7 +1693,7 @@
17721694
17731695 showProgress: function() {
17741696 var _this = this;
1775 - _this.div.disableInputsFade();
 1697+ _this.div.mask();
17761698 // XXX spinnerize
17771699 _this.upload.detailsProgress = 1.0;
17781700 },
@@ -1780,58 +1702,8 @@
17811703 var _this = this;
17821704 _this.upload.state = 'complete';
17831705 // XXX de-spinnerize
1784 - _this.div.enableInputsFade();
1785 - },
1786 -
1787 - /**
1788 - * Sometimes we wish to lock certain copyright or license info from being changed
1789 - */
1790 - lockSource: function() {
1791 - var _this = this;
1792 - _this.sourceDiv.hide();
1793 - },
1794 -
1795 - /**
1796 - * If we hopped between deeds, and now this is visible again
1797 - */
1798 - unlockSource: function() {
1799 - var _this = this;
1800 - _this.sourceDiv.show();
1801 - },
1802 -
1803 - /**
1804 - * Sometimes we wish to lock certain copyright or license info from being changed
1805 - */
1806 - lockAuthor: function() {
1807 - var _this = this;
1808 - _this.authorDiv.hide();
1809 - },
1810 -
1811 - /**
1812 - * If we hopped between deeds, and now this is visible again
1813 - */
1814 - unlockAuthor: function() {
1815 - var _this = this;
1816 - _this.authorDiv.show();
1817 - },
1818 -
1819 -
1820 - /**
1821 - * Sometimes we wish to lock certain copyright or license info from being changed
1822 - */
1823 - lockLicense: function() {
1824 - var _this = this;
1825 - _this.licenseDiv.hide();
1826 - },
1827 -
1828 - /**
1829 - * Sometimes we wish to lock certain copyright or license info from being changed
1830 - */
1831 - unlockLicense: function() {
1832 - var _this = this;
1833 - _this.licenseDiv.show();
 1706+ _this.div.unmask();
18341707 }
1835 -
18361708
18371709 };
18381710
@@ -1907,7 +1779,7 @@
19081780
19091781
19101782 + '<div id="mwe-upwiz-content">'
1911 - + '<div id="mwe-upwiz-tabdiv-file">'
 1783+ + '<div class="mwe-upwiz-tabdiv" id="mwe-upwiz-tabdiv-file">'
19121784 + '<div id="mwe-upwiz-intro">' + gM('mwe-upwiz-intro') + '</div>'
19131785 + '<div id="mwe-upwiz-files">'
19141786 + '<div class="shim" style="height: 120px"></div>'
@@ -1924,44 +1796,22 @@
19251797 + '</div>'
19261798 + '<div style="clear: left;"></div>'
19271799 + '</div>'
1928 - + '<div id="mwe-upwiz-tabdiv-details">'
 1800+ + '<div class="mwe-upwiz-tabdiv" id="mwe-upwiz-tabdiv-details">'
19291801 + '<div id="mwe-upwiz-macro">'
19301802 + '<div id="mwe-upwiz-macro-choice">'
1931 - + '<div>' + gM( 'mwe-upwiz-intro-details' ) + '</div>'
1932 - + '<div id="mwe-upwiz-macro-deeds">'
1933 - + '<div id="mwe-upwiz-macro-deed-ownwork" class="mwe-upwiz-deed">'
1934 - + '<div class="mwe-upwiz-deed-option-title">'
1935 - + '<span class="mwe-upwiz-deed-header mwe-closed"><a class="mwe-upwiz-deed-header-link mwe-upwiz-deed-name">' + gM( 'mwe-upwiz-source-ownwork' ) + '</a></span>'
1936 - + '<span class="mwe-upwiz-deed-header mwe-open" style="display: none;">'
1937 - + '<span class="mwe-upwiz-deed-name">' + gM( 'mwe-upwiz-source-ownwork' ) + '</span>'
1938 - + ' <a class="mwe-upwiz-macro-deeds-return">' + gM( 'mwe-upwiz-change' ) + '</a>'
1939 - + '</span>'
1940 - + '</div>' // more deed stuff set up below
1941 - + '<div class="mwe-upwiz-deed-form" style="display: none"></div>'
1942 - + '</div>'
1943 - + '<div id="mwe-upwiz-macro-deed-thirdparty" class="mwe-upwiz-deed">'
1944 - + '<div class="mwe-upwiz-deed-option-title">'
1945 - + '<span class="mwe-upwiz-deed-header mwe-closed"><a class="mwe-upwiz-deed-header-link mwe-upwiz-deed-name">' + gM( 'mwe-upwiz-source-thirdparty' ) + '</a></span>'
1946 - + '<span class="mwe-upwiz-deed-header mwe-open" style="display: none;">'
1947 - + '<span class="mwe-upwiz-deed-name">' + gM( 'mwe-upwiz-source-thirdparty' ) + '</span>'
1948 - + ' <a class="mwe-upwiz-macro-deeds-return">' + gM( 'mwe-upwiz-change' ) + '</a>'
1949 - + '</span>'
1950 - + '</div>' // more deed stuff set up below
1951 - + '<div class="mwe-upwiz-deed-form" style="display: none"></div>'
1952 - + '</div>'
1953 - + '</div>'
 1803+ + '<div>' + gM( 'mwe-upwiz-intro-details' ) + '</div>'
 1804+ + '<div id="mwe-upwiz-macro-deeds" />'
19541805 + '</div>'
19551806 + '<div id="mwe-upwiz-macro-edit">'
1956 - + '<div>'
1957 - + '<p>' + gM( 'mwe-upwiz-macro-edit-intro' ) + '</p>'
1958 - + '</div>' // button added below
1959 - + '<div id="mwe-upwiz-macro-progress"></div>'
1960 - + '<div id="mwe-upwiz-macro-files"></div>'
1961 - + '<div class="mwe-upwiz-macro-edit-submit"></div>' // button added below
 1807+ + '<div>'
 1808+ //+ '<p>' + gM( 'mwe-upwiz-macro-edit-intro' ) + '</p>'
19621809 + '</div>'
 1810+ + '<div id="mwe-upwiz-macro-progress"></div>'
 1811+ + '<div id="mwe-upwiz-macro-files"></div>'
 1812+ + '<div class="mwe-upwiz-macro-edit-submit"></div>' // button added below
19631813 + '</div>'
19641814 + '</div>'
1965 - + '<div id="mwe-upwiz-tabdiv-thanks">'
 1815+ + '<div class="mwe-upwiz-tabdiv" id="mwe-upwiz-tabdiv-thanks">'
19661816 + '<div id="mwe-upwiz-thanks"></div>'
19671817 + '</div>'
19681818 + '</div>'
@@ -1971,20 +1821,14 @@
19721822 // within FILE tab div
19731823 $j('#mwe-upwiz-upload-ctrl').click( function() { _this.startUploads(); } );
19741824
1975 - _this.setupDeedOwnWork();
1976 - _this.setupDeedThirdParty();
1977 - _this.setupNullDeed();
 1825+ // DETAILS div
 1826+ $j( '.mwe-upwiz-deed-form' ).maskSafeHide();
19781827
1979 - // open and close the various deeds
1980 - //$j( '.mwe-upwiz-deed-header-link' ).click( function() {
1981 - // _this.showDeed( $j( this ).parents( '.mwe-upwiz-deed' ) );
1982 - //} );
1983 - $j( '.mwe-upwiz-macro-deeds-return' ).click( function() { _this.showDeedChoice(); } );
19841828
19851829 // buttons to submit all details and go on to the thanks page, at the top and bottom of the page.
19861830 $j( '.mwe-upwiz-macro-edit-submit' ).each( function() {
19871831 $j( this ).append( $j( '<input />' )
1988 - .addClass( 'mwe-details-submit' )
 1832+ .addClass( 'mwe-upwiz-details-submit' )
19891833 .attr( { type: 'submit', value: gM( 'mwe-upwiz-macro-edit' ) } )
19901834 .click( function() {
19911835 // move to the top of the page to see the progress bar
@@ -1996,20 +1840,32 @@
19971841 } ) );
19981842 } );
19991843
 1844+ _this.deedChooser = new mw.UploadWizardDeedChooser( '#mwe-upwiz-macro-deeds' );
20001845
20011846 // add one to start
2002 - _this.newUpload( '#mwe-upwiz-add-file' );
 1847+ var upload = _this.newUpload( '#mwe-upwiz-add-file' );
20031848
20041849 // "select" the first tab - highlight, make it visible, hide all others
2005 - _this.moveToTab('file');
 1850+ _this.moveToTab('file', function() {
 1851+ // XXX moving the file input doesn't seem to work at this point
 1852+ // we are catching up to the application of CSS or something
 1853+ // XXX using a timeout is lame, are there other options?
 1854+ setTimeout( function() {
 1855+ upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' );
 1856+ }, 300 );
 1857+ } );
 1858+
20061859 },
20071860
20081861 /**
20091862 * Advance one "step" in the wizard interface.
20101863 * It is assumed that the previous tab to the current one was selected.
 1864+ * We do not hide the tabs because this messes up certain calculations we'd like to make about dimensions, while elements are not
 1865+ * on screen. So instead we make the tabs zero height and, in CSS, they are already overflow hidden
20111866 * @param selectedTabName
 1867+ * @param callback to do after layout is ready?
20121868 */
2013 - moveToTab: function( selectedTabName ) {
 1869+ moveToTab: function( selectedTabName, callback ) {
20141870 var _this = this;
20151871 $j.each( _this.tabNames, function(i, tabName) {
20161872
@@ -2020,15 +1876,20 @@
20211877 var tabDiv = $j( '#mwe-upwiz-tabdiv-' + tabName );
20221878
20231879 if ( _this.currentTabName == tabName ) {
2024 - tabDiv.hide();
2025 - $j( tab ).hide( 1000 );
 1880+ // we hide the old tabDivs because we are afraid of some z-index elements that may interfere with later tabs
 1881+ // this will break if we ever allow people to page back and forth.
 1882+ tab.hide( 1000 );
 1883+ tabDiv.hide();
20261884 } else if ( selectedTabName == tabName ) {
2027 - tabDiv.show();
 1885+ tabDiv.maskSafeShow();
20281886 tab.addClass( 'mwe-upwiz-tab-highlight' );
 1887+ if ( callback ) {
 1888+ callback();
 1889+ }
20291890 } else {
2030 - // it's neither the formerly active nor the newly active one, so hide it.
2031 - // (all are visible at init..)
2032 - tabDiv.hide();
 1891+ // it's neither the formerly active nor the newly active one, so don't show it
 1892+ // we don't use hide() because we want to manipulate elements within future tabs, and calculate their dimensions.
 1893+ tabDiv.maskSafeHide();
20331894 }
20341895 } );
20351896
@@ -2064,7 +1925,7 @@
20651926 // XXX bind to some error state
20661927
20671928
2068 - return true;
 1929+ return upload;
20691930 },
20701931
20711932 /**
@@ -2079,6 +1940,22 @@
20801941 _this.updateFileCounts();
20811942 // maybe it would be better to defer details to later?
20821943 upload.details = new mw.UploadWizardDetails( upload, $j( '#mwe-upwiz-macro-files' ));
 1944+
 1945+ // by default, new uploads use the wizard's deed selector.
 1946+ upload.deedChooser = _this.deedChooser;
 1947+ $j( _this.deedChooser ).bind( 'chooseNullDeed', function(e) {
 1948+ mw.log("upload received chooseNullDeed");
 1949+ upload.details.div.mask();
 1950+ e.stopPropagation();
 1951+ } );
 1952+ $j( _this.deedChooser ).bind( 'chooseDeed', function(e) {
 1953+ mw.log("upload received choose");
 1954+ upload.details.div.unmask();
 1955+ e.stopPropagation();
 1956+ } );
 1957+
 1958+
 1959+ upload.details.div.mask();
20831960 },
20841961
20851962
@@ -2092,6 +1969,7 @@
20931970 */
20941971 removeUpload: function( upload ) {
20951972 var _this = this;
 1973+ upload.unbind(); // everything
20961974 mw.UploadWizardUtil.removeItem( _this.uploads, upload );
20971975 _this.updateFileCounts();
20981976 },
@@ -2220,7 +2098,7 @@
22212099 $j.each( _this.uploads, function(i, upload) {
22222100 upload.state = 'details';
22232101 } );
2224 - _this.moveToTab('details');
 2102+ _this.moveToTab( 'details' );
22252103 }
22262104 );
22272105 },
@@ -2375,87 +2253,163 @@
23762254 */
23772255 stop: function() {
23782256
2379 - },
 2257+ }
 2258+};
23802259
 2260+mw.UploadWizardNullDeed = $j.extend( new mw.UploadWizardDeed(), {
 2261+ isReady: function() {
 2262+ return false;
 2263+ }
 2264+} );
23812265
 2266+
 2267+
 2268+mw.UploadWizardDeedChooser = function( selector ) {
 2269+ var _this = this;
 2270+ _this.selector = selector;
 2271+ _this.deed = mw.UploadWizardNullDeed;
 2272+
 2273+ $j( selector ).html(
 2274+ '<div class="mwe-upwiz-macro-deed-ownwork mwe-upwiz-deed">'
 2275+ + '<div class="mwe-upwiz-deed-option-title">'
 2276+ + '<span class="mwe-upwiz-deed-header mwe-closed">'
 2277+ + '<a class="mwe-upwiz-deed-header-link mwe-upwiz-deed-name">'
 2278+ + gM( 'mwe-upwiz-source-ownwork' )
 2279+ + '</a>'
 2280+ + '</span>'
 2281+ + '<span class="mwe-upwiz-deed-header mwe-open" style="display: none;">'
 2282+ + '<span class="mwe-upwiz-deed-name">' + gM( 'mwe-upwiz-source-ownwork' ) + '</span>'
 2283+ + ' <a class="mwe-upwiz-macro-deeds-return">' + gM( 'mwe-upwiz-change' ) + '</a>'
 2284+ + '</span>'
 2285+ + '</div>' // more deed stuff set up below
 2286+ + '<div class="mwe-upwiz-deed-form"></div>'
 2287+ + '</div>'
 2288+
 2289+ + '<div class="mwe-upwiz-macro-deed-thirdparty mwe-upwiz-deed">'
 2290+ + '<div class="mwe-upwiz-deed-option-title">'
 2291+ + '<span class="mwe-upwiz-deed-header mwe-closed">'
 2292+ + '<a class="mwe-upwiz-deed-header-link mwe-upwiz-deed-name">'
 2293+ + gM( 'mwe-upwiz-source-thirdparty' )
 2294+ + '</a>'
 2295+ + '</span>'
 2296+ + '<span class="mwe-upwiz-deed-header mwe-open" style="display: none;">'
 2297+ + '<span class="mwe-upwiz-deed-name">' + gM( 'mwe-upwiz-source-thirdparty' ) + '</span>'
 2298+ + ' <a class="mwe-upwiz-macro-deeds-return">' + gM( 'mwe-upwiz-change' ) + '</a>'
 2299+ + '</span>'
 2300+ + '</div>' // more deed stuff set up below
 2301+ + '<div class="mwe-upwiz-deed-form"></div>'
 2302+ + '</div>'
 2303+ );
 2304+
 2305+ $j( '.mwe-upwiz-macro-deeds-return' ).click( function() { _this.showDeedChoice(); } );
 2306+
 2307+ _this.setupDeedOwnWork();
 2308+ _this.setupDeedThirdParty();
 2309+ _this.showDeedChoice();
 2310+};
 2311+
 2312+mw.UploadWizardDeedChooser.prototype = {
 2313+ choose: function( deed ) {
 2314+ var _this = this;
 2315+ _this.deed = deed;
 2316+ mw.log( "choosing deed!" );
 2317+ mw.log( deed );
 2318+ if ( deed === mw.UploadWizardNullDeed ) {
 2319+ $j( _this ).trigger( 'chooseNullDeed' );
 2320+ mw.log("choose null deed");
 2321+ } else {
 2322+ $j( _this ).trigger( 'chooseDeed' );
 2323+ }
 2324+ },
 2325+
23822326 /**
23832327 * Go back to original source choice.
23842328 * Assumed that we are in details mode.
23852329 */
23862330 showDeedChoice: function() {
23872331 var _this = this;
2388 - $j( '#mwe-upwiz-macro-deeds' ).find( '.mwe-upwiz-deed-header.mwe-open' ).hide();
2389 - $j( '#mwe-upwiz-macro-deeds' ).find( '.mwe-upwiz-deed-header.mwe-closed' ).show();
2390 - $j( '#mwe-upwiz-macro-deeds' ).find( '.mwe-upwiz-deed' ).fadeIn( 'fast' );
2391 - $j( '#mwe-upwiz-macro-deeds' ).find( '.mwe-upwiz-deed-form' ).fadeOut('fast');
 2332+ $j( _this.selector ).find( '.mwe-upwiz-deed-header.mwe-open' ).hide();
 2333+ $j( _this.selector ).find( '.mwe-upwiz-deed-header.mwe-closed' ).show();
 2334+ $j( _this.selector ).find( '.mwe-upwiz-deed' ).maskSafeShow();
 2335+ $j( _this.selector ).find( '.mwe-upwiz-deed-form' ).maskSafeHide();
23922336 // reset deed
2393 - _this.nullDeed.applyDeed( _this.uploads );
2394 - },
 2337+ _this.choose( mw.UploadWizardNullDeed );
 2338+ },
23952339
2396 -
23972340 /**
2398 - * From the deed choice page, show the 'own work' deed
 2341+ * From the deed choice page, show a deed
23992342 */
24002343 showDeed: function( selector ) {
24012344 $j( selector ).find( '.mwe-upwiz-deed-header.mwe-open' ).show();
24022345 $j( selector ).find( '.mwe-upwiz-deed-header.mwe-closed' ).hide();
2403 - $j( selector ).siblings().fadeOut( 'fast' );
2404 - $j( selector ).find( '.mwe-upwiz-deed-form' ).fadeIn( 'fast' );
 2346+ $j( selector ).siblings().maskSafeHide();
 2347+ $j( selector ).find( '.mwe-upwiz-deed-form' ).maskSafeShow();
24052348 },
2406 -
2407 - /**
2408 - * Deed to copy values from when no deed is selected
2409 - */
2410 - setupNullDeed: function() {
2411 - var _this = this;
2412 - var sourceInput = $j( '<input />').attr( { name: "source", value: "" } );
2413 - var authorInput = $j( '<input />').attr( { name: "author", value: "" } );
2414 - var licenseInput = new mw.UploadWizardLicenseInput( $j('<div/>'), [] );
2415 - _this.nullDeed = new mw.UploadWizardDeed( { 'source': sourceInput, 'author': authorInput, 'license': licenseInput } );
2416 - },
24172349
24182350 /**
2419 - * Set up the form for the deed option that says these uploads are all the user's own work.
 2351+ * Set up the form and deed object for the deed option that says these uploads are all the user's own work.
24202352 */
24212353 setupDeedOwnWork: function() {
24222354 mw.log("setupdeed own work");
24232355 var _this = this;
24242356
2425 - var authorInput = $j( '<input />').attr( { name: "author" } );
 2357+ var authorInput = $j( '<input />')
 2358+ .attr( { name: "author" } )
 2359+ .addClass( 'mwe-upwiz-sign' );
24262360
24272361 var licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' );
24282362 var licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv );
24292363 licenseInput.setDefaultValues();
24302364
2431 - ownWorkDeed = new mw.UploadWizardDeed( { 'author': authorInput, 'license': licenseInput } );
2432 - ownWorkDeed.isOwn = true;
2433 - ownWorkDeed.setCustomizable( { 'source': false, 'author': true, 'license' : true } );
 2365+ var ownWorkDeed = $j.extend( new mw.UploadWizardDeed(), {
 2366+
 2367+ licenseInput: licenseInput,
24342368
2435 - // one or the other of these inputs must be checked to apply the deed.
2436 - ownWorkDeed.setReadyCheck( function() {
2437 - return $j( '#mwe-upwiz-deed-accept-ownwork-default' ).is( ':checked' )
2438 - || $j( '#mwe-upwiz-deed-accept-ownwork-custom' ).is( ':checked' )
2439 - } );
 2369+ isReady: function() {
 2370+ $j( _this.selector ).find( '.mwe-upwiz-deed-accept-ownwork-default' ).is( ':checked' )
 2371+ || $j( _this.selector ).find( '.mwe-upwiz-deed-accept-ownwork-custom' ).is( ':checked' )
 2372+ },
24402373
2441 - licenseInput.setChange( function() { ownWorkDeed.applyDeed( _this.uploads ) } );
 2374+ getSourceWikiText: function() {
 2375+ return '{{own}}';
 2376+ },
24422377
 2378+ getAuthorWikiText: function() {
 2379+ return "[[User:" + mw.getConfig('userName') + '|' + $j( authorInput ).val() + ']]';
 2380+ },
24432381
 2382+
 2383+ getLicenseWikiText: function() {
 2384+ var wikiText = '{{self';
 2385+ $j.each ( _this.licenseInput.licenses, function( key, data ) {
 2386+ if ( data.input.checked ) {
 2387+ wikiText += '|' + data.template;
 2388+ }
 2389+ } );
 2390+ wikiText += '}}';
 2391+ return wikiText;
 2392+ }
 2393+ } );
 2394+
24442395 var standardDiv = $j( '<div />' )
24452396 .append(
24462397 $j( '<input />')
2447 - .attr( { id: 'mwe-upwiz-deed-accept-ownwork-default', type: 'checkbox' } )
 2398+ .attr( { type: 'checkbox' } )
24482399 .click( function() {
2449 - ownWorkDeed.licenseInput.setDefaultValues();
2450 - ownWorkDeed.applyDeed( _this.uploads );
 2400+ if ( $j( this ).is( ':checked' ) ) {
 2401+ ownWorkDeed.licenseInput.setDefaultValues();
 2402+ _this.choose( ownWorkDeed );
 2403+ } else {
 2404+ _this.choose( mw.UploadWizardNullDeed );
 2405+ }
24512406 } )
2452 - .addClass( 'mwe-checkbox-hang-indent' ),
 2407+ .addClass( 'mwe-upwiz-deed-accept-ownwork-default mwe-checkbox-hang-indent' ),
24532408 $j( '<p />' )
24542409 .addClass( 'mwe-checkbox-hang-indent-text' )
24552410 .html( gM( 'mwe-upwiz-source-ownwork-assert',
24562411 $j( '<input />' )
24572412 .attr( { name: 'author' } )
2458 - .addClass( 'mwe-upwiz-sign' )
2459 - .blur( function() { ownWorkDeed.applyDeed( _this.uploads ); } ) ) ),
 2413+ .addClass( 'mwe-upwiz-sign' ) ) ),
24602414 $j( '<p />' )
24612415 .addClass( 'mwe-checkbox-hang-indent-text' )
24622416 .addClass( 'mwe-small-print' )
@@ -2467,34 +2421,36 @@
24682422 var customDiv = $j('<div/>')
24692423 .append(
24702424 $j( '<input />')
2471 - .attr( { id: 'mwe-upwiz-deed-accept-ownwork-custom', type: 'checkbox' } )
2472 - .click( function() { ownWorkDeed.applyDeed( _this.uploads ); } )
2473 - .addClass( 'mwe-checkbox-hang-indent' ),
 2425+ .attr( { type: 'checkbox' } )
 2426+ .click( function() {
 2427+ if ( $j( this ).is( ':checked' ) ) {
 2428+ _this.choose( ownWorkDeed );
 2429+ } else {
 2430+ _this.choose( mw.UploadWizardNullDeed );
 2431+ }
 2432+ } )
 2433+ .addClass( 'mwe-upwiz-deed-accept-ownwork-custom mwe-checkbox-hang-indent' ),
24742434 $j( '<p />' )
24752435 .addClass( 'mwe-checkbox-hang-indent-text' )
24762436 .append( gM( 'mwe-upwiz-source-ownwork-assert-custom',
24772437 '<span id="mwe-custom-author-input"></span>' ) ),
24782438 licenseInputDiv )
2479 - .hide();
 2439+ .maskSafeHide();
24802440
2481 - hiddenInputsDiv = $j( '<span />' ).hide().append( _this.sourceInput );
2482 -
2483 - $j( '#mwe-upwiz-macro-deed-ownwork .mwe-upwiz-deed-form' ).
2484 - append( standardDiv,
2485 - toggleDiv,
2486 - customDiv,
2487 - hiddenInputsDiv );
 2441+ $j( _this.selector ).find( '.mwe-upwiz-macro-deed-ownwork .mwe-upwiz-deed-form' )
 2442+ .append( standardDiv,
 2443+ toggleDiv,
 2444+ customDiv );
24882445
24892446 mw.UploadWizardUtil.makeFadingToggler( standardDiv, toggleDiv, customDiv );
24902447
24912448 // have to add the author input this way -- gM() will flatten it to a string and we'll lose it as a dom object
2492 - authorInput.blur( function() { ownWorkDeed.applyDeed( _this.uploads ) } ).addClass( 'mwe-upwiz-sign' );
2493 - $j( '#mwe-custom-author-input' ).append( authorInput );
 2449+ $j( _this.selector ).find( '.mwe-custom-author-input' ).append( authorInput );
24942450
24952451 // synchronize both username signatures
24962452 // set initial value to configured username
24972453 // if one changes all the others change
2498 - $j( '.mwe-upwiz-sign' )
 2454+ $j( _this.selector ).find( '.mwe-upwiz-sign' )
24992455 .attr( { value: mw.getConfig( 'userName' ) } )
25002456 .keyup( function() {
25012457 var thisInput = this;
@@ -2507,90 +2463,75 @@
25082464 } );
25092465
25102466
2511 - $j( '#mwe-upwiz-macro-deed-ownwork .mwe-upwiz-deed-header-link').click(
 2467+ $j( _this.selector ).find( '.mwe-upwiz-macro-deed-ownwork .mwe-upwiz-deed-header-link').click(
25122468 function() {
2513 - _this.showDeed( $j( '#mwe-upwiz-macro-deed-ownwork' ) );
2514 - ownWorkDeed.applyDeed( _this.uploads );
 2469+ _this.showDeed( $j( '.mwe-upwiz-macro-deed-ownwork' ) );
25152470 }
25162471 );
25172472 },
25182473
2519 - /**
2520 - * Set up the deed for when you "found pics on a website", i.e. there's a third party
2521 - */
25222474 setupDeedThirdParty: function() {
2523 - mw.log("setupdeed third party");
25242475 var _this = this;
2525 -
2526 - var sourceInput = $j('<textarea class="mwe-source" name="source" rows="1" cols="40"></textarea>' )
 2476+ var sourceInput = $j('<textarea class="mwe-source mwe-long-textarea" name="source" rows="1" cols="40"></textarea>' )
25272477 .growTextArea()
2528 - .blur( function() { thirdPartyDeed.applyDeed( _this.uploads ); } );
2529 - var authorInput = $j('<textarea class="mwe-author" name="author" rows="1" cols="40"></textarea>' )
 2478+ var authorInput = $j('<textarea class="mwe-author mwe-long-textarea" name="author" rows="1" cols="40"></textarea>' )
25302479 .growTextArea()
2531 - .blur( function() { thirdPartyDeed.applyDeed( _this.uploads ); } );
2532 - var licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' );
2533 - var licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv );
 2480+ licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' );
 2481+ licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv );
25342482 licenseInput.setDefaultValues();
25352483
2536 - thirdPartyDeed = new mw.UploadWizardDeed( { 'source': sourceInput, 'author' : authorInput, 'license' : licenseInput } );
2537 -
2538 - licenseInput.setChange( function() { thirdPartyDeed.applyDeed( _this.uploads ); } );
 2484+ var thirdPartyDeed = $j.extend( new mw.UploadWizardDeed(), {
 2485+ sourceInput: sourceInput,
 2486+ authorInput: authorInput,
 2487+ licenseInput: licenseInput,
25392488
2540 - var standardDiv = $j( '<div />' );
2541 - /* .append(
2542 - $j( '<p />' ).html( gM( 'mwe-upwiz-source-thirdparty-intro' ) )
2543 - );
2544 - */
2545 -
2546 - var toggleDiv = $j( '<div />' );
 2489+ isReady: function() {
 2490+ return (! mw.isEmpty( $j( _this.sourceInput ).val() ) )
 2491+ && (! mw.isEmpty( $j( _this.authorInput ).val() ) )
 2492+ && (! mw.isEmpty( $j( _this.licenseInput ).val() ) )
 2493+ }
 2494+
 2495+ } );
25472496
25482497 var customDiv = $j( '<div />' )
2549 - .append(
2550 - $j( '<div />' ).append( gM( 'mwe-upwiz-source-thirdparty-custom-intro' ) ),
2551 - $j( '<div />' )
2552 - .addClass( "mwe-upwiz-thirdparty-fields" )
2553 - .append( $j( '<label />' )
2554 - .attr( { 'for' : 'source' } )
2555 - .text( gM( 'mwe-upwiz-source' ) ) )
2556 - .append( sourceInput ),
2557 - $j( '<div />' )
2558 - .addClass( "mwe-upwiz-thirdparty-fields" )
2559 - .append( $j( '<label />' )
2560 - .attr( { 'for' : 'author' } )
2561 - .text( gM( 'mwe-upwiz-author' ) ) )
2562 - .append( authorInput ),
2563 - $j( '<div />' ).text( gM( 'mwe-upwiz-source-thirdparty-license' ) ),
2564 - licenseInputDiv
2565 - ).hide();
 2498+ .append(
 2499+ $j( '<div />' ).append( gM( 'mwe-upwiz-source-thirdparty-custom-intro' ) ),
 2500+ $j( '<div />' )
 2501+ .addClass( "mwe-upwiz-thirdparty-fields" )
 2502+ .append( $j( '<label />' )
 2503+ .attr( { 'for' : 'source' } )
 2504+ .text( gM( 'mwe-upwiz-source' ) ) )
 2505+ .append( sourceInput ),
 2506+ $j( '<div />' )
 2507+ .addClass( "mwe-upwiz-thirdparty-fields" )
 2508+ .append( $j( '<label />' )
 2509+ .attr( { 'for' : 'author' } )
 2510+ .text( gM( 'mwe-upwiz-author' ) ) )
 2511+ .append( authorInput ),
 2512+ $j( '<div />' ).text( gM( 'mwe-upwiz-source-thirdparty-license' ) ),
 2513+ licenseInputDiv
 2514+ );
25662515
 2516+ $j( _this.selector ).find( '.mwe-upwiz-macro-deed-thirdparty .mwe-upwiz-deed-form' ).append( customDiv );
25672517
2568 - $j( '#mwe-upwiz-macro-deed-thirdparty .mwe-upwiz-deed-form' ).
2569 - append( standardDiv, toggleDiv, customDiv );
2570 -
2571 - mw.UploadWizardUtil.makeFadingToggler( standardDiv, toggleDiv, customDiv );
2572 -
2573 - $j( '.mwe-upwiz-deed-thirdparty-accept' )
 2518+ $j( _this.selector ).find( '.mwe-upwiz-deed-thirdparty-accept' )
25742519 .attr( { value: gM( 'mwe-upwiz-source-thirdparty-accept' ) } )
25752520 .click( function() {
2576 - thirdPartyDeed.applyDeed( _this.uploads );
 2521+ _this.choose( thirdPartyDeed );
25772522 } );
25782523
2579 - $j( '#mwe-upwiz-macro-deed-thirdparty .mwe-upwiz-deed-header-link').click(
 2524+ $j( _this.selector ).find( '.mwe-upwiz-macro-deed-thirdparty .mwe-upwiz-deed-header-link').click(
25802525 function() {
2581 - _this.showDeed( $j( '#mwe-upwiz-macro-deed-thirdparty' ) );
2582 - thirdPartyDeed.applyDeed( _this.uploads );
 2526+ _this.showDeed( $j( '.mwe-upwiz-macro-deed-thirdparty' ) );
 2527+ _this.choose( thirdPartyDeed );
25832528 }
25842529 );
25852530
 2531+ }
 2532+};
25862533
2587 - },
25882534
25892535
2590 -
2591 -
2592 -
2593 -};
2594 -
25952536 /**
25962537 * Miscellaneous utilities
25972538 */
@@ -2646,17 +2587,17 @@
26472588 text.text( gM( 'mwe-upwiz-fewer-options' ) );
26482589 icon.removeClass( "ui-icon-triangle-1-e" )
26492590 .addClass( "ui-icon-triangle-1-s" );
2650 - moreDiv.show();
 2591+ moreDiv.maskSafeShow();
26512592 if (fade) {
2652 - standardDiv.disableInputsFade();
 2593+ standardDiv.mask();
26532594 }
26542595 } else {
26552596 text.text( gM( 'mwe-upwiz-more-options' ) );
26562597 icon.removeClass( "ui-icon-triangle-1-s" )
26572598 .addClass( "ui-icon-triangle-1-e" )
2658 - moreDiv.hide();
 2599+ moreDiv.maskSafeHide();
26592600 if (fade) {
2660 - standardDiv.enableInputsFade();
 2601+ standardDiv.unmask();
26612602 }
26622603 }
26632604 };
@@ -2771,23 +2712,81 @@
27722713 return this;
27732714 };
27742715
2775 -jQuery.fn.disableInputsFade = function( options ) {
2776 - this.fadeTo( 'fast', 0.5 );
2777 - $j.each( this.find( 'input' ), function( i, input ) {
2778 - if ( input.disabled ) {
2779 - $j( input ).data( { wasDisabled: true } );
2780 - }
2781 - input.disabled = true;
 2716+jQuery.fn.mask = function( options ) {
 2717+
 2718+ // intercept clicks...
 2719+ // Note: the size of the div must be obtainable. Hence, this cannot be a div without layout (e.g. display:none).
 2720+ // some of this is borrowed from http://code.google.com/p/jquery-loadmask/ , but simplified
 2721+ $j.each( this, function( i, el ) {
 2722+
 2723+ if ( ! $j( el ).data( 'mask' ) ) {
 2724+
 2725+
 2726+ //fix for z-index bug with selects in IE6
 2727+ if ( $j.browser.msie && $j.browser.version.substring(0,1) === '6' ){
 2728+ el.find( "select" ).addClass( "masked-hidden" );
 2729+ }
 2730+
 2731+ var mask = $j( '<div />' )
 2732+ .css( { 'position' : 'absolute',
 2733+ 'top' : '0px', // el.offsetTop + 'px',
 2734+ 'left' : '0px', // el.offsetLeft + 'px',
 2735+ 'width' : el.offsetWidth + 'px',
 2736+ 'height' : el.offsetHeight + 'px',
 2737+ 'z-index' : 100 } )
 2738+ .click( function( e ) { e.stopPropagation(); } );
 2739+
 2740+ $j( el ).css( { 'position' : 'relative' } )
 2741+ .fadeTo( 'fast', 0.5 )
 2742+ .append( mask )
 2743+ .data( 'mask', mask );
 2744+
 2745+ //auto height fix for IE -- not sure about this, i think offsetWidth + Height is a better solution. Test!
 2746+ /*
 2747+ if( $j.browser.msie ) {
 2748+ mask.height(el.height() + parseInt(el.css("padding-top")) + parseInt(el.css("padding-bottom")));
 2749+ mask.width(el.width() + parseInt(el.css("padding-left")) + parseInt(el.css("padding-right")));
 2750+ }
 2751+ */
 2752+
 2753+ }
 2754+
 2755+ // XXX bind to a custom event in case the div size changes : ?
 2756+
27822757 } );
 2758+
27832759 return this;
 2760+
27842761 };
27852762
2786 -jQuery.fn.enableInputsFade = function( options ) {
2787 - $j.each( this.find( 'input' ), function( i, input ) {
2788 - if ( ! $j( input ).data( 'wasDisabled' ) ) {
2789 - input.disabled = false;
 2763+jQuery.fn.unmask = function( options ) {
 2764+
 2765+ $j.each( this, function( i, el ) {
 2766+ if ( $j( el ).data( 'mask' ) ) {
 2767+ var mask = $j( el ).data( 'mask' );
 2768+ $j( el ).removeData( 'mask' ); // from the data
 2769+ mask.remove(); // from the DOM
 2770+ $j( el ).fadeTo( 'fast', 1.0 );
27902771 }
27912772 } );
2792 - this.fadeTo( 'fast', 1.0 );
 2773+
 2774+
27932775 return this;
27942776 };
 2777+
 2778+
 2779+/**
 2780+ * Safe hide and show
 2781+ * Rather than use display: none, this collapses the divs to zero height
 2782+ * This is good because then the elements in the divs still have layout and we can do things like mask and unmask (above)
 2783+ */
 2784+
 2785+jQuery.fn.maskSafeHide = function( options ) {
 2786+ return this.css( { 'height' : '0px', 'overflow' : 'hidden' } );
 2787+};
 2788+
 2789+// XXX check overflow properties, is auto/auto not the right thing?
 2790+// may be causing scrollbar to appear when div changes size
 2791+jQuery.fn.maskSafeShow = function( options ) {
 2792+ return this.css( { 'height' : 'auto', 'overflow' : 'visible' } );
 2793+};
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/css/uploadWizard.css
@@ -113,7 +113,7 @@
114114
115115 /* file inputs are freakishly large to overflow the containing div -- we get a div
116116 that can act as a more styleable single-click file input */
117 -.mwe-upwiz-file-input {
 117+.mwe-upwiz-file-input, .disabler {
118118 font-size: 100px;
119119 -moz-opacity: 0.3;
120120 filter:alpha(opacity: 0);
@@ -278,6 +278,11 @@
279279 background: yellow;
280280 }
281281
 282+.mwe-upwiz-tabdiv {
 283+ height: 0px;
 284+ overflow: hidden;
 285+}
 286+
282287 #mwe-upwiz-tabdiv-file {
283288 width: 550px;
284289 }
@@ -345,10 +350,14 @@
346351 margin-bottom: 12px;
347352 }
348353
 354+#mwe-upwiz-macro-files {
 355+ margin-top: 12px;
 356+}
349357 .mwe-upwiz-details-file {
350358 border-bottom: 1px solid #e0e0e0;
351359 margin-bottom: 12px;
352360 padding-bottom: 12px;
 361+ width: 660px;
353362 }
354363
355364
@@ -395,4 +404,27 @@
396405
397406 }
398407
399 -.
 408+#mwe-upwiz-details-filename. {
 409+ overflow: hidden;
 410+ width: 350px;
 411+}
 412+
 413+#mwe-upwiz-other-textarea, fieldset.mwe-fieldset {
 414+ width: 450px;
 415+}
 416+
 417+fieldset.mwe-fieldset {
 418+ border: 1px solid #cccccc;
 419+ padding-left: 12px;
 420+ padding-right: 12px;
 421+}
 422+
 423+legend.mwe-legend {
 424+ padding: 0.5em 0.5em 0.5em 0.33em;
 425+ color: #666666;
 426+}
 427+
 428+.masked-hidden {
 429+ visibility: hidden !important;
 430+}
 431+
Index: branches/js2-work/phase3/js/specialUploadWizardPage.js
@@ -21,7 +21,7 @@
2222 // Commons already had a template called 'tl', though.
2323 // so, this workaround will cause tagalog descriptions to be saved with this template instead.
2424 mw.setConfig( 'languageTemplateFixups', { tl: 'tgl' } );
25 - mw.setConfig( 'defaultLicenses', [ 'cc_by_sa_30', 'gfdl' ] );
 25+ mw.setConfig( 'defaultLicenses', [ 'cc_by_sa_30' ] );
2626
2727 var uploadWizard = new mw.UploadWizard();
2828 uploadWizard.createInterface( '#upload-wizard' );

Status & tagging log