r64417 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64416‎ | r64417 | r64418 >
Date:01:57, 31 March 2010
Author:neilk
Status:deferred
Tags:
Comment:
fixed max uploads
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/css/uploadWizard.css (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/mw.UploadWizard.js
@@ -5,7 +5,7 @@
66 "mwe-upwiz-intro": "Introductory text (short)",
77 //"mwe-upwiz-select-files": "Select files:",
88 "mwe-upwiz-add-file-n": "Add another file",
9 - "mwe-upwiz-add-file-0": "Add a file",
 9+ "mwe-upwiz-add-file-0": "Click here to add a file for upload",
1010 "mwe-upwiz-browse": "Browse...",
1111 "mwe-upwiz-transported": "OK",
1212 "mwe-upwiz-click-here": "Click here to select a file",
@@ -547,7 +547,7 @@
548548
549549 // XXX evil hardcoded
550550 // we don't really need filesdiv if we do it this way?
551 - $j( _this.div ).insertBefore( '#mwe-upwiz-add-file' ); // append( _this.div );
 551+ $j( _this.div ).insertBefore( '#mwe-upwiz-add-file-container' ); // append( _this.div );
552552
553553 // _this.progressBar = ( no progress bar for individual uploads yet )
554554 // add a details thing to details
@@ -686,6 +686,7 @@
687687
688688 if ( ! _this.isFilled ) {
689689 _this.isFilled = true;
 690+ $j( _this.div ).addClass( 'filled' );
690691 $j( _this.visibleFilename ).show();
691692 $j( _this.removeCtrl ).show();
692693 $j(_this.div ).css( {
@@ -1722,9 +1723,11 @@
17231724 + '<div id="mwe-upwiz-tabdiv-file">'
17241725 + '<div id="mwe-upwiz-intro">' + gM('mwe-upwiz-intro') + '</div>'
17251726 + '<div id="mwe-upwiz-files">'
1726 - + '<a id="mwe-upwiz-add-file">' + gM("mwe-upwiz-add-file-0") + '</a>'
 1727+ + '<div class="shim" style="height: 120px"></div>'
 1728+ + '<div id="mwe-upwiz-add-file-container" class="mwe-upwiz-add-files-0"><a id="mwe-upwiz-add-file">' + gM("mwe-upwiz-add-file-0") + '</a></div>'
 1729+ + '<div class="clearShim"></div>'
17271730 + '</div>'
1728 - + '<div><button id="mwe-upwiz-upload-ctrl" disabled="disabled">' + gM("mwe-upwiz-upload") + '</button></div>'
 1731+ + '<div class="proceed"><button id="mwe-upwiz-upload-ctrl" disabled="disabled">' + gM("mwe-upwiz-upload") + '</button></div>'
17291732 + '<div id="mwe-upwiz-progress"></div>'
17301733 + '<div style="clear: left;"></div>'
17311734 + '</div>'
@@ -1847,7 +1850,7 @@
18481851 * add an Upload
18491852 * we create the upload interface, a handler to transport it to the server,
18501853 * and UI for the upload itself and the "details" at the second step of the wizard.
1851 - * Finally stuff it into an array of uploads.
 1854+ * we don't yet add it to the list of uploads; that only happens when it gets a real file.
18521855 * @return boolean success
18531856 */
18541857 newUpload: function() {
@@ -1863,9 +1866,9 @@
18641867 $j( upload ).bind( 'filenameAccepted', function(e) { _this.updateFileCounts(); e.stopPropagation(); } );
18651868 $j( upload ).bind( 'removeUpload', function(e) { _this.removeUpload( upload ); e.stopPropagation(); } );
18661869 $j( upload ).bind( 'filled', function(e) {
 1870+ _this.newUpload();
18671871 _this.uploads.push( upload );
18681872 _this.updateFileCounts();
1869 - _this.newUpload();
18701873 e.stopPropagation();
18711874 } );
18721875 // XXX bind to some error state
@@ -1879,8 +1882,6 @@
18801883 * We can remove the HTML UI directly, as jquery will just get the parent.
18811884 * We need to grep through the array of uploads, since we don't know the current index.
18821885 * We need to update file counts for obvious reasons.
1883 - * Finally, there is an uncounted upload, waiting to be used, which has a fileInput which covers the
1884 - * "add an upload" button. This is absolutely positioned, so it needs to be moved if another upload was removed.
18851886 *
18861887 * @param upload
18871888 */
@@ -1888,7 +1889,6 @@
18891890 var _this = this;
18901891 mw.UploadWizardUtil.removeItem( _this.uploads, upload );
18911892 _this.updateFileCounts();
1892 - _this.uploadToAdd.ui.moveFileInputToCover( '#mwe-upwiz-add-file' );
18931893 },
18941894
18951895 /**
@@ -2019,26 +2019,33 @@
20202020
20212021 /**
20222022 * Occurs whenever we need to update the interface based on how many files there are
 2023+ * Thhere is an uncounted upload, waiting to be used, which has a fileInput which covers the
 2024+ * "add an upload" button. This is absolutely positioned, so it needs to be moved if another upload was removed.
 2025+ * The uncounted upload is also styled differently between the zero and n files cases
20232026 */
20242027 updateFileCounts: function() {
20252028 var _this = this;
20262029
2027 - $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-' + ( _this.uploads.length === 0 ? '0' : 'n' )) );
2028 -
20292030 if ( _this.uploads.length ) {
20302031 $j( '#mwe-upwiz-upload-ctrl' ).removeAttr( 'disabled' );
 2032+ $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-n' ) );
 2033+ $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-0');
20312034 } else {
20322035 $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' );
 2036+ $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-0' ) );
 2037+ $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-0');
20332038 }
20342039
20352040 if ( _this.uploads.length < _this.maxUploads ) {
20362041 $j( '#mwe-upwiz-add-file' ).removeAttr( 'disabled' );
 2042+ $j( _this.uploadToAdd.ui.div ).show();
 2043+ _this.uploadToAdd.ui.moveFileInputToCover( '#mwe-upwiz-add-file' );
20372044 } else {
20382045 $j( '#mwe-upwiz-add-file' ).attr( 'disabled', true );
 2046+ $j( _this.uploadToAdd.ui.div ).hide();
20392047 }
20402048
20412049
2042 -
20432050 },
20442051
20452052 /**
Index: branches/js2-work/phase3/js/mwEmbed/modules/UploadWizard/css/uploadWizard.css
@@ -1,6 +1,3 @@
2 -/* XXX all these absolute pixel floats are evil, will bite us when i18n-ized */
3 -/* XXX mwe-upwiz-add-file jumps to the right when all file inputs are removed */
4 -
52 form.mwe-upwiz-form {
63 display: inline;
74 }
@@ -85,12 +82,17 @@
8683 padding: 1em;
8784 }
8885
89 -#mwe-upwiz-add-file {
90 - margin: 8px;
91 - padding: 16px;
 86+
 87+.mwe-upwiz-add-files-0 {
 88+ margin-top: 40px;
 89+ text-align: center;
9290 font-size: 16px;
9391 }
9492
 93+#mwe-upwiz-add-file {
 94+ padding-top: 16px;
 95+}
 96+
9597 /* NOT a pseudoclass */
9698 #mwe-upwiz-add-file.hover {
9799 text-decoration: underline;
@@ -121,9 +123,7 @@
122124 z-index: 2;
123125 }
124126
125 -}
126 -
127 -.mwe-upwiz-file {
 127+.mwe-upwiz-file.filled {
128128 height: 24px;
129129 }
130130
@@ -131,8 +131,6 @@
132132 width: 300px;
133133 height: 18px;
134134 float: left;
135 - /* top: 0px; */
136 - /* left: 0px; */
137135 white-space: nowrap;
138136 overflow: hidden;
139137
@@ -147,13 +145,6 @@
148146 }
149147
150148
151 -/*
152 -#mwe-upwiz-select-files {
153 - float: left;
154 - width: 100px;
155 -}
156 -*/
157 -
158149 #mwe-upwiz-files {
159150 /* margin-left: 100px; */
160151 }
@@ -229,4 +220,23 @@
230221 background: yellow;
231222 }
232223
 224+#mwe-upwiz-tabdiv-file {
 225+ width: 550px;
 226+}
233227
 228+
 229+.proceed {
 230+ text-align: right;
 231+}
 232+
 233+.shim {
 234+ float:right;
 235+ width: 1px;
 236+}
 237+
 238+.clearShim {
 239+ clear: both;
 240+ height: 1px;
 241+ overflow: hidden;
 242+}
 243+

Status & tagging log