Index: trunk/extensions/UploadWizard/UploadWizardHooks.php |
— | — | @@ -30,6 +30,7 @@ |
31 | 31 | 'resources/jquery/jquery.spinner.js', |
32 | 32 | 'resources/jquery/jquery.autoEllipsis.js', |
33 | 33 | 'resources/jquery/jquery.suggestions.js', |
| 34 | + 'resources/jquery/jquery.removeCtrl.js', |
34 | 35 | |
35 | 36 | // mediawiki-specific interface helper (relies on mediawiki globals) |
36 | 37 | 'resources/jquery/jquery.mwCoolCats.js', |
— | — | @@ -121,6 +122,7 @@ |
122 | 123 | 'resources/uploadWizard.css', |
123 | 124 | 'resources/jquery/jquery.arrowSteps.css', |
124 | 125 | 'resources/jquery/jquery.mwCoolCats.css', |
| 126 | + 'resources/jquery/jquery.removeCtrl.css', |
125 | 127 | 'resources/jquery.ui/themes/redmond/jquery-ui-1.7.1.custom.css' |
126 | 128 | ), |
127 | 129 | 'messages' => array( |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -42,9 +42,11 @@ |
43 | 43 | 'mwe-upwiz-add-file-0' => 'Click here to upload a file', |
44 | 44 | 'mwe-upwiz-browse' => 'Browse...', |
45 | 45 | 'mwe-upwiz-transported' => 'OK', |
| 46 | + 'mwe-upwiz-failed' => 'Failed', |
46 | 47 | 'mwe-upwiz-click-here' => 'Click here to select a file', |
47 | 48 | 'mwe-upwiz-uploading' => 'uploading...', |
48 | 49 | 'mwe-upwiz-editing' => 'editing...', |
| 50 | + 'mwe-upwiz-remove' => 'Remove', |
49 | 51 | 'mwe-upwiz-remove-upload' => 'Remove this file from the list of files to upload', |
50 | 52 | 'mwe-upwiz-remove-description' => 'Remove this description', |
51 | 53 | 'mwe-upwiz-upload' => 'Upload', |
Index: trunk/extensions/UploadWizard/resources/jquery/dir.combined.css |
— | — | @@ -198,3 +198,24 @@ |
199 | 199 | * html .pkg, * html #content-inner { height: 1%; } |
200 | 200 | .pkg, #content-inner { display: block; } |
201 | 201 | /* */ |
| 202 | +.mwe-upwiz-remove-ctrl { |
| 203 | + outline: none; |
| 204 | + cursor: pointer; |
| 205 | +} |
| 206 | + |
| 207 | +.mwe-upwiz-remove-ctrl.hover .mwe-upwiz-remove-ctrl-msg { |
| 208 | + text-decoration: underline; |
| 209 | +} |
| 210 | + |
| 211 | +.mwe-upwiz-remove-ctrl div { |
| 212 | + color: #0645ad; |
| 213 | + font-variant: bold; |
| 214 | + float: left; |
| 215 | +} |
| 216 | + |
| 217 | +/* XXX this is highly specific to our installation |
| 218 | +.mwe-upwiz-remove-ctrl.hover { |
| 219 | +.ui-icon { background-image: url(/w/extensions/UsabilityInitiative/css/vector/images/ui-icons_cd0a0a_256x240.png) } |
| 220 | +} |
| 221 | +*/ |
| 222 | + |
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.removeCtrl.css |
— | — | @@ -0,0 +1,21 @@ |
| 2 | +.mwe-upwiz-remove-ctrl { |
| 3 | + outline: none; |
| 4 | + cursor: pointer; |
| 5 | +} |
| 6 | + |
| 7 | +.mwe-upwiz-remove-ctrl.hover .mwe-upwiz-remove-ctrl-msg { |
| 8 | + text-decoration: underline; |
| 9 | +} |
| 10 | + |
| 11 | +.mwe-upwiz-remove-ctrl div { |
| 12 | + color: #0645ad; |
| 13 | + font-variant: bold; |
| 14 | + float: left; |
| 15 | +} |
| 16 | + |
| 17 | +/* XXX this is highly specific to our installation |
| 18 | +.mwe-upwiz-remove-ctrl.hover { |
| 19 | +.ui-icon { background-image: url(/w/extensions/UsabilityInitiative/css/vector/images/ui-icons_cd0a0a_256x240.png) } |
| 20 | +} |
| 21 | +*/ |
| 22 | + |
Property changes on: trunk/extensions/UploadWizard/resources/jquery/jquery.removeCtrl.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 23 | + native |
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.mwCoolCats.js |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | var $li = $j( '<li class="cat"></li>' ); |
79 | 79 | $container.find( 'ul' ).append( $li ); |
80 | 80 | $li.append( '<a class="cat" target="_new" href="' + href + '">' + cat +' </a>' ); |
81 | | - $li.append( $j.fn.removeCtrl( 'mwe-upwiz-category-remove', function() { $li.remove(); } ) ); |
| 81 | + $li.append( $j.fn.removeCtrl( null, 'mwe-upwiz-category-remove', function() { $li.remove(); } ) ); |
82 | 82 | } |
83 | 83 | |
84 | 84 | function _catLink( cat ) { |
Index: trunk/extensions/UploadWizard/resources/jquery/dir.combined.min.css |
— | — | @@ -40,3 +40,5 @@ |
41 | 41 | |
42 | 42 | * html .pkg,* html #content-inner{height:1%;} |
43 | 43 | .pkg,#content-inner{display:block;} |
| 44 | + |
| 45 | +.mwe-upwiz-remove-ctrl{outline:none;cursor:pointer;}.mwe-upwiz-remove-ctrl.hover .mwe-upwiz-remove-ctrl-msg{text-decoration:underline;}.mwe-upwiz-remove-ctrl div{color:#0645ad;font-variant:bold;float:left;} |
\ No newline at end of file |
Index: trunk/extensions/UploadWizard/resources/jquery/jquery.removeCtrl.js |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +/** |
| 3 | + * Create 'remove' control, an X which highlights in some standardized way, with optional tooltips |
| 4 | + */ |
| 5 | +( function ( $j ) { |
| 6 | + $j.fn.removeCtrl = function( msgKey, tooltipMsgKey, callback ) { |
| 7 | + var msg = (msgKey === null) ? '' : gM( msgKey ); |
| 8 | + return $j( '<div class="mwe-upwiz-remove-ctrl ui-corner-all" />' ) |
| 9 | + .attr( 'title', gM( tooltipMsgKey ) ) |
| 10 | + .click( callback ) |
| 11 | + .hover( function() { $j( this ).addClass( 'hover' ); }, |
| 12 | + function() { $j( this ).removeClass( 'hover' ); } ) |
| 13 | + .append( $j( '<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">' + msg + '</div>' ) ); |
| 14 | + }; |
| 15 | +} )( jQuery ); |
Property changes on: trunk/extensions/UploadWizard/resources/jquery/jquery.removeCtrl.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 16 | + native |
Index: trunk/extensions/UploadWizard/resources/dir.combined.css |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | /* perhaps a general class for links that are actually "buttons" */ |
53 | | -#mwe-upwiz-add-file, .mwe-upwiz-remove-ctrl, .mwe-upwiz-more-options { |
| 53 | +#mwe-upwiz-add-file, .mwe-upwiz-more-options { |
54 | 54 | outline: none; |
55 | 55 | cursor: pointer; |
56 | 56 | } |
— | — | @@ -82,22 +82,14 @@ |
83 | 83 | background: #f5f5f5; |
84 | 84 | } |
85 | 85 | |
86 | | - |
87 | | - |
88 | | -.mwe-upwiz-remove-ctrl { |
| 86 | +.mwe-upwiz-file-status-line-item { |
| 87 | + display: inline-block; |
| 88 | + float: left; |
| 89 | + margin-right: .5em; |
89 | 90 | } |
90 | 91 | |
91 | | -/* XXX this is highly specific to our installation |
92 | | -.mwe-upwiz-remove-ctrl.hover { |
93 | | -.ui-icon { background-image: url(/w/extensions/UsabilityInitiative/css/vector/images/ui-icons_cd0a0a_256x240.png) } |
94 | | -} |
95 | | -*/ |
96 | | - |
97 | 92 | .mwe-upwiz-visible-file .mwe-upwiz-remove-ctrl { |
98 | | - float: right; |
99 | 93 | visibility: hidden; |
100 | | - margin: 0.25em; |
101 | | - padding: 0.25em; |
102 | 94 | } |
103 | 95 | |
104 | 96 | .mwe-upwiz-file-indicator, .mwe-upwiz-count { |
— | — | @@ -124,10 +116,34 @@ |
125 | 117 | overflow: hidden; |
126 | 118 | } |
127 | 119 | |
| 120 | +.mwe-upwiz-icon { |
| 121 | + float: left; |
| 122 | +} |
| 123 | + |
| 124 | +.mwe-upwiz-filled-filelist { |
| 125 | + border: 1px solid #d8d8d8; |
| 126 | +} |
| 127 | + |
| 128 | +.mwe-upwiz-file-texts { |
| 129 | + margin-left: 46px; |
| 130 | +} |
| 131 | + |
| 132 | +.mwe-upwiz-file-status { |
| 133 | + display: none; |
| 134 | + color: #797979; |
| 135 | +} |
| 136 | + |
128 | 137 | .mwe-upwiz-progress-bar-etr-container { |
129 | 138 | /* needed ? */ |
130 | 139 | } |
131 | 140 | |
| 141 | +.mwe-upwiz-file-preview { |
| 142 | + float: left; |
| 143 | + height: 40px; |
| 144 | + width: 40px; |
| 145 | + margin-right: 6px; |
| 146 | + background: url(32px-Blank-document.svg.png) no-repeat center top; |
| 147 | +} |
132 | 148 | |
133 | 149 | .mwe-upwiz-add-files-n { |
134 | 150 | float: left; |
— | — | @@ -172,7 +188,8 @@ |
173 | 189 | margin-left: 8em; |
174 | 190 | } |
175 | 191 | |
176 | | -.mwe-upwiz-file { |
| 192 | +.filled + .filled { |
| 193 | + border-top: 1px solid #d8d8d8; |
177 | 194 | } |
178 | 195 | |
179 | 196 | #mwe-upwiz-upload-ctrls { |
Index: trunk/extensions/UploadWizard/resources/dir.combined.min.css |
— | — | @@ -2,14 +2,15 @@ |
3 | 3 | max-width:900px; |
4 | 4 | }.mwe-upwiz-clearing{clear:left;width:100%;}#mwe-upwiz-content{padding:1em;}.mwe-upwiz-add-files-0,#mwe-upwiz-files{margin-top:3em;margin-bottom:3em;}.mwe-upwiz-add-files-0{text-align:center;font-size:large;}#mwe-upwiz-add-file{} |
5 | 5 | #mwe-upwiz-add-file.hover{text-decoration:underline;} |
6 | | -#mwe-upwiz-add-file,.mwe-upwiz-remove-ctrl,.mwe-upwiz-more-options{outline:none;cursor:pointer;} |
| 6 | +#mwe-upwiz-add-file,.mwe-upwiz-more-options{outline:none;cursor:pointer;} |
7 | 7 | .mwe-upwiz-file-ctrl-container{position:absolute;overflow:hidden;}.mwe-upwiz-file-input,.mwe-upwiz-visible-file{cursor:pointer;} |
8 | | -.mwe-upwiz-file-input,.disabler{font-size:100px;-moz-opacity:0.3;filter:alpha(opacity:0);opacity:0;z-index:2;}.mwe-upwiz-file.filled{position:relative;}.mwe-upwiz-file.odd .mwe-upwiz-visible-file{background:#f5f5f5;}.mwe-upwiz-remove-ctrl{}.mwe-upwiz-visible-file .mwe-upwiz-remove-ctrl{float:right;visibility:hidden;margin:0.25em;padding:0.25em;}.mwe-upwiz-file-indicator,.mwe-upwiz-count{float:right;margin-left:0.5em;padding:0.5em 0.5em 0.5em 20px; |
9 | | -}.mwe-upwiz-visible-file .mwe-upwiz-file-indicator{visibility:hidden;}.mwe-upwiz-visible-file{display:none;}.mwe-upwiz-file.filled .mwe-upwiz-visible-file{display:block;}.mwe-upwiz-visible-file-filename{padding:0.5em;margin-right:40px;overflow:hidden;}.mwe-upwiz-progress-bar-etr-container{ |
10 | | -}.mwe-upwiz-add-files-n{float:left;margin-top:5px;margin-left:4px;}#mwe-upwiz-add-file-container.mwe-upwiz-add-files-n,.mwe-upwiz-progress-bar-etr{width:300px;padding-left:5px;}#mwe-upwiz-add-file-container.mwe-upwiz-add-files-n{float:left;}.mwe-upwiz-visible-file{width:100%; |
| 8 | +.mwe-upwiz-file-input,.disabler{font-size:100px;-moz-opacity:0.3;filter:alpha(opacity:0);opacity:0;z-index:2;}.mwe-upwiz-file.filled{position:relative;}.mwe-upwiz-file.odd .mwe-upwiz-visible-file{background:#f5f5f5;}.mwe-upwiz-file-status-line-item{display:inline-block;float:left;margin-right:.5em;}.mwe-upwiz-visible-file .mwe-upwiz-remove-ctrl{visibility:hidden;}.mwe-upwiz-file-indicator,.mwe-upwiz-count{float:right;margin-left:0.5em;padding:0.5em 0.5em 0.5em 20px; |
| 9 | +}.mwe-upwiz-visible-file .mwe-upwiz-file-indicator{visibility:hidden;}.mwe-upwiz-visible-file{display:none;}.mwe-upwiz-file.filled .mwe-upwiz-visible-file{display:block;}.mwe-upwiz-visible-file-filename{padding:0.5em;margin-right:40px;overflow:hidden;}.mwe-upwiz-icon{float:left;}.mwe-upwiz-filled-filelist{border:1px solid #d8d8d8;}.mwe-upwiz-file-texts{margin-left:46px;}.mwe-upwiz-file-status{display:none;color:#797979;}.mwe-upwiz-progress-bar-etr-container{ |
| 10 | +} |
| 11 | +.mwe-upwiz-file-preview{float:left;height:40px;width:40px;margin-right:6px;background:url(32px-Blank-document.svg.png) no-repeat center top;}.mwe-upwiz-add-files-n{float:left;margin-top:5px;margin-left:4px;}#mwe-upwiz-add-file-container.mwe-upwiz-add-files-n,.mwe-upwiz-progress-bar-etr{width:300px;padding-left:5px;}#mwe-upwiz-add-file-container.mwe-upwiz-add-files-n{float:left;}.mwe-upwiz-visible-file{width:100%; |
11 | 12 | white-space:nowrap;overflow:hidden;}.mwe-upwiz-file.hover .mwe-upwiz-visible-file{background:#e0f0ff !important;}.mwe-upwiz-file.hover .mwe-upwiz-remove-ctrl{visibility:visible;} |
12 | 13 | .helper{color:#cccccc; |
13 | | -font-variant:italic,oblique;text-align:center;}#mwe-upwiz-files{margin-right:8em;margin-left:8em;}.mwe-upwiz-file{}#mwe-upwiz-upload-ctrls{margin-top:1em;}#mwe-upwiz-add-file-container{ |
| 14 | +font-variant:italic,oblique;text-align:center;}#mwe-upwiz-files{margin-right:8em;margin-left:8em;}.filled + .filled{border-top:1px solid #d8d8d8;}#mwe-upwiz-upload-ctrls{margin-top:1em;}#mwe-upwiz-add-file-container{ |
14 | 15 | }.mwe-upwiz-details-descriptions .mwe-upwiz-remove-ctrl{vertical-align:top;display:inline-block;}a[disabled=true]{color:#999999;text-decoration:none;cursor:default;}a[disabled=true]:hover{text-decoration:none;}.mwe-upwiz-status-progress{background:url(spinner-orange.gif) no-repeat left center;font-weight:bold;color:#ff9900;}.mwe-upwiz-status-completed{background:url(checkmark.gif) no-repeat left center;font-weight:bold;color:#009900;}.mwe-upwiz-status-failed{background:url(16px-Gnome-process-stop.svg.png) no-repeat left center;font-weight:bold;color:#CC0000;}.mwe-upwiz-progress{margin-top:15px;}.mwe-upwiz-progress-bar-etr{float:left;}.mwe-upwiz-etr{text-align:center;}.mwe-upwiz-upload-warning{background:#ffffe0;}.mwe-upwiz-details-error{display:none;background:#ffffe0;}.mwe-upwiz-thumbnail,.mwe-upwiz-thumbnail-small{border:1px solid #cccccc;text-align:center;background:#ffffff;}.mwe-upwiz-thumbnail{padding:0.5em;width:120px;}.mwe-upwiz-thumbnail-side{float:left;margin-bottom:1em;margin-right:1em;}.mwe-upwiz-thumbnail-small{padding:0.25em;width:60px;}#mwe-upwiz-deeds-thumbnails{text-align:center;margin:1em 0;background:#f0f0f0;}#mwe-upwiz-deeds-thumbnails .mwe-upwiz-thumbnail-small{display:inline-block;margin:1em;vertical-align:middle;} |
15 | 16 | .mwe-upwiz-data{float:left;width:46em;} |
16 | 17 | .busy{ |
Index: trunk/extensions/UploadWizard/resources/32px-Blank-document.svg.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/UploadWizard/resources/32px-Blank-document.svg.png |
___________________________________________________________________ |
Added: svn:mime-type |
17 | 18 | + image/png |
Index: trunk/extensions/UploadWizard/resources/32px-Nuvola_apps_important_orange.svg.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/UploadWizard/resources/32px-Nuvola_apps_important_orange.svg.png |
___________________________________________________________________ |
Added: svn:mime-type |
18 | 19 | + image/png |
Index: trunk/extensions/UploadWizard/resources/combined.js |
— | — | @@ -5064,6 +5064,20 @@ |
5065 | 5065 | }; |
5066 | 5066 | |
5067 | 5067 | } )( jQuery ); |
| 5068 | +/** |
| 5069 | + * Create 'remove' control, an X which highlights in some standardized way, with optional tooltips |
| 5070 | + */ |
| 5071 | +( function ( $j ) { |
| 5072 | + $j.fn.removeCtrl = function( msgKey, tooltipMsgKey, callback ) { |
| 5073 | + var msg = (msgKey === null) ? '' : gM( msgKey ); |
| 5074 | + return $j( '<div class="mwe-upwiz-remove-ctrl ui-corner-all" />' ) |
| 5075 | + .attr( 'title', gM( tooltipMsgKey ) ) |
| 5076 | + .click( callback ) |
| 5077 | + .hover( function() { $j( this ).addClass( 'hover' ); }, |
| 5078 | + function() { $j( this ).removeClass( 'hover' ); } ) |
| 5079 | + .append( $j( '<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">' + msg + '</div>' ) ); |
| 5080 | + }; |
| 5081 | +} )( jQuery ); |
5068 | 5082 | /** |
5069 | 5083 | * Simple predictive typing category adder for Mediawiki. |
5070 | 5084 | * Relies on globals: wgScriptPath, wgNamespaceIds, wgFormattedNamespaces |
— | — | @@ -5143,7 +5157,7 @@ |
5144 | 5158 | var $li = $j( '<li class="cat"></li>' ); |
5145 | 5159 | $container.find( 'ul' ).append( $li ); |
5146 | 5160 | $li.append( '<a class="cat" target="_new" href="' + href + '">' + cat +' </a>' ); |
5147 | | - $li.append( $j.fn.removeCtrl( 'mwe-upwiz-category-remove', function() { $li.remove(); } ) ); |
| 5161 | + $li.append( $j.fn.removeCtrl( null, 'mwe-upwiz-category-remove', function() { $li.remove(); } ) ); |
5148 | 5162 | } |
5149 | 5163 | |
5150 | 5164 | function _catLink( cat ) { |
— | — | @@ -5211,9 +5225,6 @@ |
5212 | 5226 | /** |
5213 | 5227 | * Log a string msg to the console |
5214 | 5228 | * |
5215 | | - * all mw.log statements will be removed on minification so |
5216 | | - * lots of mw.log calls will not impact performance in non debug mode |
5217 | | - * |
5218 | 5229 | * @param {String} string String to output to console |
5219 | 5230 | */ |
5220 | 5231 | mw.log = function( s, level ) { |
— | — | @@ -7902,7 +7913,9 @@ |
7903 | 7914 | this.transport = new mw.IframeTransport( |
7904 | 7915 | this.$form, |
7905 | 7916 | function( fraction ){ _this.upload.setTransportProgress( fraction ); }, |
7906 | | - function( result ) { _this.upload.setTransported( result ); } |
| 7917 | + function( result ) { |
| 7918 | + _this.upload.setTransported( result ); |
| 7919 | + } |
7907 | 7920 | ); |
7908 | 7921 | |
7909 | 7922 | }; |
— | — | @@ -9098,10 +9111,6 @@ |
9099 | 9112 | }; |
9100 | 9113 | |
9101 | 9114 | } )( jQuery ); |
9102 | | -// XXX |
9103 | | -// this is sure starting to look like we should compose of UI, handler. |
9104 | | - |
9105 | | - |
9106 | 9115 | /** |
9107 | 9116 | * Represents the upload -- in its local and remote state. (Possibly those could be separate objects too...) |
9108 | 9117 | * This is our 'model' object if we are thinking MVC. Needs to be better factored, lots of feature envy with the UploadWizard |
— | — | @@ -9195,16 +9204,15 @@ |
9196 | 9205 | /** |
9197 | 9206 | * To be executed when an individual upload finishes. Processes the result and updates step 2's details |
9198 | 9207 | * @param result the API result in parsed JSON form |
9199 | | - * XXX needs refactor --- new api needs error handler instead |
9200 | 9208 | */ |
9201 | 9209 | setTransported: function( result ) { |
9202 | 9210 | var _this = this; |
9203 | | - _this.state = 'transported'; |
9204 | | - _this.transportProgress = 1; |
9205 | | - $j( _this.ui.div ).trigger( 'transportedEvent' ); |
9206 | 9211 | |
9207 | 9212 | if ( result.upload && result.upload.imageinfo ) { |
9208 | 9213 | // success |
| 9214 | + _this.state = 'transported'; |
| 9215 | + _this.transportProgress = 1; |
| 9216 | + _this.ui.showTransported(); |
9209 | 9217 | _this.extractUploadInfo( result ); |
9210 | 9218 | _this.deedPreview.setup(); |
9211 | 9219 | _this.details.populate(); |
— | — | @@ -9219,11 +9227,11 @@ |
9220 | 9228 | // and other errors that result in a stash |
9221 | 9229 | } else { |
9222 | 9230 | // XXX handle errors better |
| 9231 | + _this.state = 'error'; |
| 9232 | + _this.ui.showFailed(); |
9223 | 9233 | if ( result.error ) { |
9224 | 9234 | alert( "error : " + result.error.code + " : " + result.error.info ); |
9225 | 9235 | } |
9226 | | - this.ui.showFailed(); |
9227 | | - alert("huh?"); |
9228 | 9236 | // TODO now we should tag the upload as failed |
9229 | 9237 | // if can recover, should maybe allow re-uploading. |
9230 | 9238 | } |
— | — | @@ -9386,19 +9394,26 @@ |
9387 | 9395 | |
9388 | 9396 | |
9389 | 9397 | visibleFilenameDiv = $j('<div class="mwe-upwiz-visible-file"></div>') |
9390 | | - .append( |
9391 | | - $j.fn.removeCtrl( 'mwe-upwiz-remove-upload', function() { _this.upload.remove(); } ), |
9392 | | - |
9393 | | - $j( '<div class="mwe-upwiz-file-indicator"></div>' ), |
| 9398 | + .append( '<div class="mwe-upwiz-file-indicator"></div>' |
| 9399 | + + '<div class="mwe-upwiz-visible-file-filename">' |
| 9400 | + + '<div class="mwe-upwiz-file-preview"/>' |
| 9401 | + + '<div class="mwe-upwiz-file-texts">' |
| 9402 | + + '<div class="mwe-upwiz-visible-file-filename-text"/>' |
| 9403 | + + '<div class="mwe-upwiz-file-status-line">' |
| 9404 | + + '<div class="mwe-upwiz-file-status mwe-upwiz-file-status-line-item"></div>' |
| 9405 | + + '</div>' |
| 9406 | + + '</div>' |
| 9407 | + + '</div>' |
| 9408 | + ); |
| 9409 | + visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' ).append( |
| 9410 | + $j.fn.removeCtrl( |
| 9411 | + 'mwe-upwiz-remove', |
| 9412 | + 'mwe-upwiz-remove-upload', |
| 9413 | + function() { _this.upload.remove(); } |
| 9414 | + ).addClass( "mwe-upwiz-file-status-line-item" ) |
| 9415 | + ); |
9394 | 9416 | |
9395 | | - $j( '<div class="mwe-upwiz-visible-file-filename">' ) |
9396 | | - .append( |
9397 | | - $j( '<span class="ui-icon ui-icon-document" style="display: inline-block;" />' ), |
9398 | | - $j( '<span class="mwe-upwiz-visible-file-filename-text"/>' ) |
9399 | | - ) |
9400 | 9417 | |
9401 | | - ); |
9402 | | - |
9403 | 9418 | //_this.errorDiv = $j('<div class="mwe-upwiz-upload-error mwe-upwiz-file-indicator" style="display: none;"></div>').get(0); |
9404 | 9419 | |
9405 | 9420 | _this.filenameCtrl = $j('<input type="hidden" name="filename" value=""/>').get(0); |
— | — | @@ -9433,12 +9448,12 @@ |
9434 | 9449 | |
9435 | 9450 | // XXX evil hardcoded |
9436 | 9451 | // we don't really need filesdiv if we do it this way? |
9437 | | - $j( _this.div ).insertBefore( '#mwe-upwiz-upload-ctrls' ); // append( _this.div ); |
| 9452 | + $j( filesDiv ).append( _this.div ); |
9438 | 9453 | |
9439 | 9454 | // _this.progressBar = ( no progress bar for individual uploads yet ) |
9440 | 9455 | // we bind to the ui div since unbind doesn't work for non-DOM objects |
9441 | 9456 | $j( _this.div ).bind( 'transportProgressEvent', function(e) { _this.showTransportProgress(); } ); |
9442 | | - $j( _this.div ).bind( 'transportedEvent', function(e) { _this.showTransported(); } ); |
| 9457 | + // $j( _this.div ).bind( 'transportedEvent', function(e) { _this.showTransported(); } ); |
9443 | 9458 | |
9444 | 9459 | }; |
9445 | 9460 | |
— | — | @@ -9468,7 +9483,7 @@ |
9469 | 9484 | }, |
9470 | 9485 | |
9471 | 9486 | /** |
9472 | | - * |
| 9487 | + * change the indicator at the far right |
9473 | 9488 | */ |
9474 | 9489 | showIndicatorMessage: function( statusClass, msgKey ) { |
9475 | 9490 | var _this = this; |
— | — | @@ -9483,13 +9498,31 @@ |
9484 | 9499 | $j( _this.div ).find( '.mwe-upwiz-visible-file-filename' ) |
9485 | 9500 | .css( 'margin-right', ( $indicator.outerWidth() + 24 ).toString() + 'px' ); |
9486 | 9501 | $indicator.css( 'visibility', 'visible' ); |
| 9502 | + |
| 9503 | + _this.setStatus( msgKey ); |
9487 | 9504 | }, |
9488 | 9505 | |
| 9506 | + // too abstract? |
| 9507 | + setStatus: function( msgKey, args ) { |
| 9508 | + if ( !mw.isDefined( args ) ) { |
| 9509 | + args = []; |
| 9510 | + } |
| 9511 | + this.setStatusStr( gM( msgKey, args ) ); |
| 9512 | + }, |
| 9513 | + |
| 9514 | + setStatusStr: function( str ) { |
| 9515 | + $j( this.div ).find( '.mwe-upwiz-file-status' ).html( str ).show(); |
| 9516 | + }, |
| 9517 | + |
| 9518 | + clearStatus: function() { |
| 9519 | + $j( this.div ).find( '.mwe-upwiz-file-status' ).hide(); |
| 9520 | + }, |
| 9521 | + |
9489 | 9522 | /** |
9490 | 9523 | * Put the visual state of an individual upload ito "progress" |
9491 | 9524 | * @param fraction The fraction of progress. Float between 0 and 1 |
9492 | 9525 | */ |
9493 | | - showTransportProgress: function() { |
| 9526 | + showTransportProgress: function( fraction ) { |
9494 | 9527 | this.showIndicatorMessage( 'progress', 'mwe-upwiz-uploading' ); |
9495 | 9528 | // update individual progress bar with fraction? |
9496 | 9529 | }, |
— | — | @@ -9523,6 +9556,7 @@ |
9524 | 9557 | //_this.error( 'bad-filename-extension', ext ); |
9525 | 9558 | alert("bad extension"); |
9526 | 9559 | } |
| 9560 | + this.clearStatus(); |
9527 | 9561 | }, |
9528 | 9562 | |
9529 | 9563 | /** |
— | — | @@ -9562,6 +9596,7 @@ |
9563 | 9597 | */ |
9564 | 9598 | updateFilename: function() { |
9565 | 9599 | var _this = this; |
| 9600 | + // TODO get basename of file; Chrome does this C:\fakepath\something which is highly irritating |
9566 | 9601 | var path = _this.fileInputCtrl.value; |
9567 | 9602 | |
9568 | 9603 | // visible filenam. |
— | — | @@ -9579,7 +9614,7 @@ |
9580 | 9615 | // we use the visible-file div because it has the same offsetParent as the file input |
9581 | 9616 | // the second argument offsets the fileinput to the right so there's room for the close icon to get mouse events |
9582 | 9617 | _this.moveFileInputToCover( |
9583 | | - $div.find( '.mwe-upwiz-visible-file-filename' ) |
| 9618 | + $div.find( '.mwe-upwiz-visible-file-filename-text' ) |
9584 | 9619 | ); |
9585 | 9620 | |
9586 | 9621 | // Highlight the file on mouseover (and also show controls like the remove control). |
— | — | @@ -9594,7 +9629,7 @@ |
9595 | 9630 | // Consequently we have to bind to "mouseover" and "mouseout" as well even though that's not as efficient. |
9596 | 9631 | $div.bind( 'mouseenter mouseover', function() { |
9597 | 9632 | $div.addClass( 'hover' ); |
9598 | | - $j( '#mwe-upwiz-files' ) |
| 9633 | + $j( '#mwe-upwiz-filelist' ) |
9599 | 9634 | .children() |
9600 | 9635 | .filter( function() { return this !== _this.div; } ) |
9601 | 9636 | .removeClass('hover'); |
— | — | @@ -10129,7 +10164,7 @@ |
10130 | 10165 | |
10131 | 10166 | if ( ! required ) { |
10132 | 10167 | $j( description.div ).append( |
10133 | | - $j.fn.removeCtrl( 'mwe-upwiz-remove-description', function() { _this.removeDescription( description ); } ) |
| 10168 | + $j.fn.removeCtrl( null, 'mwe-upwiz-remove-description', function() { _this.removeDescription( description ); } ) |
10134 | 10169 | ); |
10135 | 10170 | } |
10136 | 10171 | |
— | — | @@ -10779,7 +10814,7 @@ |
10780 | 10815 | return false; |
10781 | 10816 | } |
10782 | 10817 | |
10783 | | - var upload = new mw.UploadWizardUpload( _this.api, '#mwe-upwiz-files' ); |
| 10818 | + var upload = new mw.UploadWizardUpload( _this.api, '#mwe-upwiz-filelist' ); |
10784 | 10819 | _this.uploadToAdd = upload; |
10785 | 10820 | |
10786 | 10821 | upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' ); |
— | — | @@ -10969,21 +11004,43 @@ |
10970 | 11005 | var _this = this; |
10971 | 11006 | |
10972 | 11007 | if ( _this.uploads.length ) { |
| 11008 | + // we have uploads ready to go, so allow us to proceed |
10973 | 11009 | $j( '#mwe-upwiz-upload-ctrl' ).removeAttr( 'disabled' ); |
10974 | 11010 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons' ).show(); |
| 11011 | + |
| 11012 | + // changes the "click here to add files" to "add another file" |
10975 | 11013 | $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-n' ) ); |
10976 | 11014 | $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-0'); |
10977 | 11015 | $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-n'); |
10978 | | - $j( '#mwe-upwiz-files .mwe-upwiz-file.filled:odd' ).addClass( 'odd' ); |
10979 | | - $j( '#mwe-upwiz-files .mwe-upwiz-file:filled:even' ).removeClass( 'odd' ); |
| 11016 | + |
| 11017 | + // add the styling to the filelist, so it has rounded corners and is visible and all. |
| 11018 | + $j( '#mwe-upwiz-filelist' ).addClass( 'mwe-upwiz-filled-filelist' ); |
| 11019 | + |
| 11020 | + // fix the rounded corners on file elements. |
| 11021 | + // we want them to be rounded only when their edge touched the top or bottom of the filelist. |
| 11022 | + $j( '#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file' ).removeClass( 'ui-corner-top' ).removeClass( 'ui-corner-bottom' ); |
| 11023 | + $j( '#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file:first' ).addClass( 'ui-corner-top' ); |
| 11024 | + $j( '#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file:last' ).addClass( 'ui-corner-bottom' ); |
| 11025 | + $j( '#mwe-upwiz-filelist .filled:odd' ).addClass( 'odd' ); |
| 11026 | + $j( '#mwe-upwiz-filelist .filled:even' ).removeClass( 'odd' ); |
10980 | 11027 | } else { |
| 11028 | + // no uploads, so don't allow us to proceed |
10981 | 11029 | $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' ); |
| 11030 | + |
| 11031 | + // remove the border from the filelist. We can't hide it or make it invisible since it contains the displaced |
| 11032 | + // file input element that becomes the "click here to add" |
| 11033 | + $j( '#mwe-upwiz-filelist' ).removeClass( 'mwe-upwiz-filled-filelist' ); |
| 11034 | + |
| 11035 | + // we can't continue |
10982 | 11036 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons' ).hide(); |
| 11037 | + |
| 11038 | + // change "add another file" into "click here to add a file" |
10983 | 11039 | $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-0' ) ); |
10984 | 11040 | $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-0'); |
10985 | 11041 | $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-n'); |
10986 | 11042 | } |
10987 | 11043 | |
| 11044 | + // allow an "add another upload" button only if we aren't at max |
10988 | 11045 | if ( _this.uploads.length < _this.maxUploads ) { |
10989 | 11046 | $j( '#mwe-upwiz-add-file' ).removeAttr( 'disabled' ); |
10990 | 11047 | $j( _this.uploadToAdd.ui.div ).show(); |
— | — | @@ -11135,13 +11192,14 @@ |
11136 | 11193 | /** |
11137 | 11194 | * Create 'remove' control, an X which highlights in some standardized way. |
11138 | 11195 | */ |
11139 | | - $j.fn.removeCtrl = function( tooltipMsgKey, callback ) { |
| 11196 | + $j.fn.removeCtrl = function( msgKey, tooltipMsgKey, callback ) { |
| 11197 | + var msg = (msgKey === null) ? '' : gM( msgKey ); |
11140 | 11198 | return $j( '<div class="mwe-upwiz-remove-ctrl ui-corner-all" />' ) |
11141 | 11199 | .attr( 'title', gM( tooltipMsgKey ) ) |
11142 | 11200 | .click( callback ) |
11143 | 11201 | .hover( function() { $j( this ).addClass( 'hover' ); }, |
11144 | 11202 | function() { $j( this ).removeClass( 'hover' ); } ) |
11145 | | - .append( $j( '<span class="ui-icon ui-icon-close" />' ) ); |
| 11203 | + .append( $j( '<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">' + msg + '</div>' ) ); |
11146 | 11204 | }; |
11147 | 11205 | |
11148 | 11206 | /** |
Index: trunk/extensions/UploadWizard/resources/uploadWizard.css |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | } |
51 | 51 | |
52 | 52 | /* perhaps a general class for links that are actually "buttons" */ |
53 | | -#mwe-upwiz-add-file, .mwe-upwiz-remove-ctrl, .mwe-upwiz-more-options { |
| 53 | +#mwe-upwiz-add-file, .mwe-upwiz-more-options { |
54 | 54 | outline: none; |
55 | 55 | cursor: pointer; |
56 | 56 | } |
— | — | @@ -82,22 +82,14 @@ |
83 | 83 | background: #f5f5f5; |
84 | 84 | } |
85 | 85 | |
86 | | - |
87 | | - |
88 | | -.mwe-upwiz-remove-ctrl { |
| 86 | +.mwe-upwiz-file-status-line-item { |
| 87 | + display: inline-block; |
| 88 | + float: left; |
| 89 | + margin-right: .5em; |
89 | 90 | } |
90 | 91 | |
91 | | -/* XXX this is highly specific to our installation |
92 | | -.mwe-upwiz-remove-ctrl.hover { |
93 | | -.ui-icon { background-image: url(/w/extensions/UsabilityInitiative/css/vector/images/ui-icons_cd0a0a_256x240.png) } |
94 | | -} |
95 | | -*/ |
96 | | - |
97 | 92 | .mwe-upwiz-visible-file .mwe-upwiz-remove-ctrl { |
98 | | - float: right; |
99 | 93 | visibility: hidden; |
100 | | - margin: 0.25em; |
101 | | - padding: 0.25em; |
102 | 94 | } |
103 | 95 | |
104 | 96 | .mwe-upwiz-file-indicator, .mwe-upwiz-count { |
— | — | @@ -124,10 +116,34 @@ |
125 | 117 | overflow: hidden; |
126 | 118 | } |
127 | 119 | |
| 120 | +.mwe-upwiz-icon { |
| 121 | + float: left; |
| 122 | +} |
| 123 | + |
| 124 | +.mwe-upwiz-filled-filelist { |
| 125 | + border: 1px solid #d8d8d8; |
| 126 | +} |
| 127 | + |
| 128 | +.mwe-upwiz-file-texts { |
| 129 | + margin-left: 46px; |
| 130 | +} |
| 131 | + |
| 132 | +.mwe-upwiz-file-status { |
| 133 | + display: none; |
| 134 | + color: #797979; |
| 135 | +} |
| 136 | + |
128 | 137 | .mwe-upwiz-progress-bar-etr-container { |
129 | 138 | /* needed ? */ |
130 | 139 | } |
131 | 140 | |
| 141 | +.mwe-upwiz-file-preview { |
| 142 | + float: left; |
| 143 | + height: 40px; |
| 144 | + width: 40px; |
| 145 | + margin-right: 6px; |
| 146 | + background: url(32px-Blank-document.svg.png) no-repeat center top; |
| 147 | +} |
132 | 148 | |
133 | 149 | .mwe-upwiz-add-files-n { |
134 | 150 | float: left; |
— | — | @@ -172,7 +188,8 @@ |
173 | 189 | margin-left: 8em; |
174 | 190 | } |
175 | 191 | |
176 | | -.mwe-upwiz-file { |
| 192 | +.filled + .filled { |
| 193 | + border-top: 1px solid #d8d8d8; |
177 | 194 | } |
178 | 195 | |
179 | 196 | #mwe-upwiz-upload-ctrls { |
Index: trunk/extensions/UploadWizard/resources/32px-Dialog-apply.svg.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/UploadWizard/resources/32px-Dialog-apply.svg.png |
___________________________________________________________________ |
Added: svn:mime-type |
180 | 197 | + image/png |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -1,7 +1,3 @@ |
2 | | -// XXX |
3 | | -// this is sure starting to look like we should compose of UI, handler. |
4 | | - |
5 | | - |
6 | 2 | /** |
7 | 3 | * Represents the upload -- in its local and remote state. (Possibly those could be separate objects too...) |
8 | 4 | * This is our 'model' object if we are thinking MVC. Needs to be better factored, lots of feature envy with the UploadWizard |
— | — | @@ -95,7 +91,6 @@ |
96 | 92 | /** |
97 | 93 | * To be executed when an individual upload finishes. Processes the result and updates step 2's details |
98 | 94 | * @param result the API result in parsed JSON form |
99 | | - * XXX needs refactor --- new api needs error handler instead |
100 | 95 | */ |
101 | 96 | setTransported: function( result ) { |
102 | 97 | var _this = this; |
— | — | @@ -286,19 +281,26 @@ |
287 | 282 | |
288 | 283 | |
289 | 284 | visibleFilenameDiv = $j('<div class="mwe-upwiz-visible-file"></div>') |
290 | | - .append( |
291 | | - $j.fn.removeCtrl( 'mwe-upwiz-remove-upload', function() { _this.upload.remove(); } ), |
292 | | - |
293 | | - $j( '<div class="mwe-upwiz-file-indicator"></div>' ), |
| 285 | + .append( '<div class="mwe-upwiz-file-indicator"></div>' |
| 286 | + + '<div class="mwe-upwiz-visible-file-filename">' |
| 287 | + + '<div class="mwe-upwiz-file-preview"/>' |
| 288 | + + '<div class="mwe-upwiz-file-texts">' |
| 289 | + + '<div class="mwe-upwiz-visible-file-filename-text"/>' |
| 290 | + + '<div class="mwe-upwiz-file-status-line">' |
| 291 | + + '<div class="mwe-upwiz-file-status mwe-upwiz-file-status-line-item"></div>' |
| 292 | + + '</div>' |
| 293 | + + '</div>' |
| 294 | + + '</div>' |
| 295 | + ); |
| 296 | + visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' ).append( |
| 297 | + $j.fn.removeCtrl( |
| 298 | + 'mwe-upwiz-remove', |
| 299 | + 'mwe-upwiz-remove-upload', |
| 300 | + function() { _this.upload.remove(); } |
| 301 | + ).addClass( "mwe-upwiz-file-status-line-item" ) |
| 302 | + ); |
294 | 303 | |
295 | | - $j( '<div class="mwe-upwiz-visible-file-filename">' ) |
296 | | - .append( |
297 | | - $j( '<span class="ui-icon ui-icon-document" style="display: inline-block;" />' ), |
298 | | - $j( '<span class="mwe-upwiz-visible-file-filename-text"/>' ) |
299 | | - ) |
300 | 304 | |
301 | | - ); |
302 | | - |
303 | 305 | //_this.errorDiv = $j('<div class="mwe-upwiz-upload-error mwe-upwiz-file-indicator" style="display: none;"></div>').get(0); |
304 | 306 | |
305 | 307 | _this.filenameCtrl = $j('<input type="hidden" name="filename" value=""/>').get(0); |
— | — | @@ -333,7 +335,7 @@ |
334 | 336 | |
335 | 337 | // XXX evil hardcoded |
336 | 338 | // we don't really need filesdiv if we do it this way? |
337 | | - $j( _this.div ).insertBefore( '#mwe-upwiz-upload-ctrls' ); // append( _this.div ); |
| 339 | + $j( filesDiv ).append( _this.div ); |
338 | 340 | |
339 | 341 | // _this.progressBar = ( no progress bar for individual uploads yet ) |
340 | 342 | // we bind to the ui div since unbind doesn't work for non-DOM objects |
— | — | @@ -368,7 +370,7 @@ |
369 | 371 | }, |
370 | 372 | |
371 | 373 | /** |
372 | | - * |
| 374 | + * change the indicator at the far right |
373 | 375 | */ |
374 | 376 | showIndicatorMessage: function( statusClass, msgKey ) { |
375 | 377 | var _this = this; |
— | — | @@ -383,13 +385,31 @@ |
384 | 386 | $j( _this.div ).find( '.mwe-upwiz-visible-file-filename' ) |
385 | 387 | .css( 'margin-right', ( $indicator.outerWidth() + 24 ).toString() + 'px' ); |
386 | 388 | $indicator.css( 'visibility', 'visible' ); |
| 389 | + |
| 390 | + _this.setStatus( msgKey ); |
387 | 391 | }, |
388 | 392 | |
| 393 | + // too abstract? |
| 394 | + setStatus: function( msgKey, args ) { |
| 395 | + if ( !mw.isDefined( args ) ) { |
| 396 | + args = []; |
| 397 | + } |
| 398 | + this.setStatusStr( gM( msgKey, args ) ); |
| 399 | + }, |
| 400 | + |
| 401 | + setStatusStr: function( str ) { |
| 402 | + $j( this.div ).find( '.mwe-upwiz-file-status' ).html( str ).show(); |
| 403 | + }, |
| 404 | + |
| 405 | + clearStatus: function() { |
| 406 | + $j( this.div ).find( '.mwe-upwiz-file-status' ).hide(); |
| 407 | + }, |
| 408 | + |
389 | 409 | /** |
390 | 410 | * Put the visual state of an individual upload ito "progress" |
391 | 411 | * @param fraction The fraction of progress. Float between 0 and 1 |
392 | 412 | */ |
393 | | - showTransportProgress: function() { |
| 413 | + showTransportProgress: function( fraction ) { |
394 | 414 | this.showIndicatorMessage( 'progress', 'mwe-upwiz-uploading' ); |
395 | 415 | // update individual progress bar with fraction? |
396 | 416 | }, |
— | — | @@ -423,6 +443,7 @@ |
424 | 444 | //_this.error( 'bad-filename-extension', ext ); |
425 | 445 | alert("bad extension"); |
426 | 446 | } |
| 447 | + this.clearStatus(); |
427 | 448 | }, |
428 | 449 | |
429 | 450 | /** |
— | — | @@ -462,6 +483,7 @@ |
463 | 484 | */ |
464 | 485 | updateFilename: function() { |
465 | 486 | var _this = this; |
| 487 | + // TODO get basename of file; Chrome does this C:\fakepath\something which is highly irritating |
466 | 488 | var path = _this.fileInputCtrl.value; |
467 | 489 | |
468 | 490 | // visible filenam. |
— | — | @@ -479,7 +501,7 @@ |
480 | 502 | // we use the visible-file div because it has the same offsetParent as the file input |
481 | 503 | // the second argument offsets the fileinput to the right so there's room for the close icon to get mouse events |
482 | 504 | _this.moveFileInputToCover( |
483 | | - $div.find( '.mwe-upwiz-visible-file-filename' ) |
| 505 | + $div.find( '.mwe-upwiz-visible-file-filename-text' ) |
484 | 506 | ); |
485 | 507 | |
486 | 508 | // Highlight the file on mouseover (and also show controls like the remove control). |
— | — | @@ -494,7 +516,7 @@ |
495 | 517 | // Consequently we have to bind to "mouseover" and "mouseout" as well even though that's not as efficient. |
496 | 518 | $div.bind( 'mouseenter mouseover', function() { |
497 | 519 | $div.addClass( 'hover' ); |
498 | | - $j( '#mwe-upwiz-files' ) |
| 520 | + $j( '#mwe-upwiz-filelist' ) |
499 | 521 | .children() |
500 | 522 | .filter( function() { return this !== _this.div; } ) |
501 | 523 | .removeClass('hover'); |
— | — | @@ -1029,7 +1051,7 @@ |
1030 | 1052 | |
1031 | 1053 | if ( ! required ) { |
1032 | 1054 | $j( description.div ).append( |
1033 | | - $j.fn.removeCtrl( 'mwe-upwiz-remove-description', function() { _this.removeDescription( description ); } ) |
| 1055 | + $j.fn.removeCtrl( null, 'mwe-upwiz-remove-description', function() { _this.removeDescription( description ); } ) |
1034 | 1056 | ); |
1035 | 1057 | } |
1036 | 1058 | |
— | — | @@ -1679,7 +1701,7 @@ |
1680 | 1702 | return false; |
1681 | 1703 | } |
1682 | 1704 | |
1683 | | - var upload = new mw.UploadWizardUpload( _this.api, '#mwe-upwiz-files' ); |
| 1705 | + var upload = new mw.UploadWizardUpload( _this.api, '#mwe-upwiz-filelist' ); |
1684 | 1706 | _this.uploadToAdd = upload; |
1685 | 1707 | |
1686 | 1708 | upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' ); |
— | — | @@ -1869,21 +1891,43 @@ |
1870 | 1892 | var _this = this; |
1871 | 1893 | |
1872 | 1894 | if ( _this.uploads.length ) { |
| 1895 | + // we have uploads ready to go, so allow us to proceed |
1873 | 1896 | $j( '#mwe-upwiz-upload-ctrl' ).removeAttr( 'disabled' ); |
1874 | 1897 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons' ).show(); |
| 1898 | + |
| 1899 | + // changes the "click here to add files" to "add another file" |
1875 | 1900 | $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-n' ) ); |
1876 | 1901 | $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-0'); |
1877 | 1902 | $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-n'); |
1878 | | - $j( '#mwe-upwiz-files .mwe-upwiz-file.filled:odd' ).addClass( 'odd' ); |
1879 | | - $j( '#mwe-upwiz-files .mwe-upwiz-file:filled:even' ).removeClass( 'odd' ); |
| 1903 | + |
| 1904 | + // add the styling to the filelist, so it has rounded corners and is visible and all. |
| 1905 | + $j( '#mwe-upwiz-filelist' ).addClass( 'mwe-upwiz-filled-filelist' ); |
| 1906 | + |
| 1907 | + // fix the rounded corners on file elements. |
| 1908 | + // we want them to be rounded only when their edge touched the top or bottom of the filelist. |
| 1909 | + $j( '#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file' ).removeClass( 'ui-corner-top' ).removeClass( 'ui-corner-bottom' ); |
| 1910 | + $j( '#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file:first' ).addClass( 'ui-corner-top' ); |
| 1911 | + $j( '#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file:last' ).addClass( 'ui-corner-bottom' ); |
| 1912 | + $j( '#mwe-upwiz-filelist .filled:odd' ).addClass( 'odd' ); |
| 1913 | + $j( '#mwe-upwiz-filelist .filled:even' ).removeClass( 'odd' ); |
1880 | 1914 | } else { |
| 1915 | + // no uploads, so don't allow us to proceed |
1881 | 1916 | $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' ); |
| 1917 | + |
| 1918 | + // remove the border from the filelist. We can't hide it or make it invisible since it contains the displaced |
| 1919 | + // file input element that becomes the "click here to add" |
| 1920 | + $j( '#mwe-upwiz-filelist' ).removeClass( 'mwe-upwiz-filled-filelist' ); |
| 1921 | + |
| 1922 | + // we can't continue |
1882 | 1923 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons' ).hide(); |
| 1924 | + |
| 1925 | + // change "add another file" into "click here to add a file" |
1883 | 1926 | $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-0' ) ); |
1884 | 1927 | $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-0'); |
1885 | 1928 | $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-n'); |
1886 | 1929 | } |
1887 | 1930 | |
| 1931 | + // allow an "add another upload" button only if we aren't at max |
1888 | 1932 | if ( _this.uploads.length < _this.maxUploads ) { |
1889 | 1933 | $j( '#mwe-upwiz-add-file' ).removeAttr( 'disabled' ); |
1890 | 1934 | $j( _this.uploadToAdd.ui.div ).show(); |
— | — | @@ -2032,18 +2076,10 @@ |
2033 | 2077 | _this.upload.setThumbnail( thumbnailDiv, mw.UploadWizard.config[ 'smallThumbnailWidth' ] ); |
2034 | 2078 | } |
2035 | 2079 | }; |
2036 | | - /** |
2037 | | - * Create 'remove' control, an X which highlights in some standardized way. |
2038 | | - */ |
2039 | | - $j.fn.removeCtrl = function( tooltipMsgKey, callback ) { |
2040 | | - return $j( '<div class="mwe-upwiz-remove-ctrl ui-corner-all" />' ) |
2041 | | - .attr( 'title', gM( tooltipMsgKey ) ) |
2042 | | - .click( callback ) |
2043 | | - .hover( function() { $j( this ).addClass( 'hover' ); }, |
2044 | | - function() { $j( this ).removeClass( 'hover' ); } ) |
2045 | | - .append( $j( '<span class="ui-icon ui-icon-close" />' ) ); |
2046 | | - }; |
2047 | 2080 | |
| 2081 | +} )( jQuery ); |
| 2082 | + |
| 2083 | +( function ( $j ) { |
2048 | 2084 | /** |
2049 | 2085 | * Prevent the closing of a window with a confirm message (the onbeforeunload event seems to |
2050 | 2086 | * work in most browsers |
Index: trunk/extensions/UploadWizard/resources/combined.min.js |
— | — | @@ -5067,8 +5067,22 @@ |
5068 | 5068 | |
5069 | 5069 | |
5070 | 5070 | |
| 5071 | +(function($j){ |
| 5072 | +$j.fn.removeCtrl=function(msgKey,tooltipMsgKey,callback){ |
| 5073 | +var msg=(msgKey===null)?'':gM(msgKey); |
| 5074 | +return $j('<div class="mwe-upwiz-remove-ctrl ui-corner-all" />') |
| 5075 | +.attr('title',gM(tooltipMsgKey)) |
| 5076 | +.click(callback) |
| 5077 | +.hover(function(){$j(this).addClass('hover');}, |
| 5078 | +function(){$j(this).removeClass('hover');}) |
| 5079 | +.append($j('<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">'+msg+'</div>')); |
| 5080 | +}; |
| 5081 | +})(jQuery); |
5071 | 5082 | |
5072 | 5083 | |
| 5084 | + |
| 5085 | + |
| 5086 | + |
5073 | 5087 | (function($j){$j.fn.mwCoolCats=function(options){ |
5074 | 5088 | |
5075 | 5089 | var defaults={ |
— | — | @@ -5143,7 +5157,7 @@ |
5144 | 5158 | var $li=$j('<li class="cat"></li>'); |
5145 | 5159 | $container.find('ul').append($li); |
5146 | 5160 | $li.append('<a class="cat" target="_new" href="'+href+'">'+cat+' </a>'); |
5147 | | -$li.append($j.fn.removeCtrl('mwe-upwiz-category-remove',function(){$li.remove();})); |
| 5161 | +$li.append($j.fn.removeCtrl(null,'mwe-upwiz-category-remove',function(){$li.remove();})); |
5148 | 5162 | } |
5149 | 5163 | |
5150 | 5164 | function _catLink(cat){ |
— | — | @@ -5213,9 +5227,6 @@ |
5214 | 5228 | |
5215 | 5229 | |
5216 | 5230 | |
5217 | | - |
5218 | | - |
5219 | | - |
5220 | 5231 | mw.log=function(s,level){ |
5221 | 5232 | |
5222 | 5233 | if(typeof level==='undefined'){ |
— | — | @@ -7902,7 +7913,9 @@ |
7903 | 7914 | this.transport=new mw.IframeTransport( |
7904 | 7915 | this.$form, |
7905 | 7916 | function(fraction){_this.upload.setTransportProgress(fraction);}, |
7906 | | -function(result){_this.upload.setTransported(result);} |
| 7917 | +function(result){ |
| 7918 | +_this.upload.setTransported(result); |
| 7919 | +} |
7907 | 7920 | ); |
7908 | 7921 | |
7909 | 7922 | }; |
— | — | @@ -9105,10 +9118,6 @@ |
9106 | 9119 | |
9107 | 9120 | |
9108 | 9121 | |
9109 | | - |
9110 | | - |
9111 | | - |
9112 | | - |
9113 | 9122 | (function($j){ |
9114 | 9123 | |
9115 | 9124 | mw.UploadWizardUpload=function(api,filesDiv){ |
— | — | @@ -9196,15 +9205,14 @@ |
9197 | 9206 | |
9198 | 9207 | |
9199 | 9208 | |
9200 | | - |
9201 | 9209 | setTransported:function(result){ |
9202 | 9210 | var _this=this; |
9203 | | -_this.state='transported'; |
9204 | | -_this.transportProgress=1; |
9205 | | -$j(_this.ui.div).trigger('transportedEvent'); |
9206 | 9211 | |
9207 | 9212 | if(result.upload&&result.upload.imageinfo){ |
9208 | 9213 | |
| 9214 | +_this.state='transported'; |
| 9215 | +_this.transportProgress=1; |
| 9216 | +_this.ui.showTransported(); |
9209 | 9217 | _this.extractUploadInfo(result); |
9210 | 9218 | _this.deedPreview.setup(); |
9211 | 9219 | _this.details.populate(); |
— | — | @@ -9219,11 +9227,11 @@ |
9220 | 9228 | |
9221 | 9229 | }else{ |
9222 | 9230 | |
| 9231 | +_this.state='error'; |
| 9232 | +_this.ui.showFailed(); |
9223 | 9233 | if(result.error){ |
9224 | 9234 | alert("error : "+result.error.code+" : "+result.error.info); |
9225 | 9235 | } |
9226 | | -this.ui.showFailed(); |
9227 | | -alert("huh?"); |
9228 | 9236 | |
9229 | 9237 | |
9230 | 9238 | } |
— | — | @@ -9386,21 +9394,28 @@ |
9387 | 9395 | |
9388 | 9396 | |
9389 | 9397 | visibleFilenameDiv=$j('<div class="mwe-upwiz-visible-file"></div>') |
9390 | | -.append( |
9391 | | -$j.fn.removeCtrl('mwe-upwiz-remove-upload',function(){_this.upload.remove();}), |
| 9398 | +.append('<div class="mwe-upwiz-file-indicator"></div>' |
| 9399 | ++'<div class="mwe-upwiz-visible-file-filename">' |
| 9400 | ++'<div class="mwe-upwiz-file-preview"/>' |
| 9401 | ++'<div class="mwe-upwiz-file-texts">' |
| 9402 | ++'<div class="mwe-upwiz-visible-file-filename-text"/>' |
| 9403 | ++'<div class="mwe-upwiz-file-status-line">' |
| 9404 | ++'<div class="mwe-upwiz-file-status mwe-upwiz-file-status-line-item"></div>' |
| 9405 | ++'</div>' |
| 9406 | ++'</div>' |
| 9407 | ++'</div>' |
| 9408 | +); |
| 9409 | +visibleFilenameDiv.find('.mwe-upwiz-file-status-line').append( |
| 9410 | +$j.fn.removeCtrl( |
| 9411 | +'mwe-upwiz-remove', |
| 9412 | +'mwe-upwiz-remove-upload', |
| 9413 | +function(){_this.upload.remove();} |
| 9414 | +).addClass("mwe-upwiz-file-status-line-item") |
| 9415 | +); |
9392 | 9416 | |
9393 | | -$j('<div class="mwe-upwiz-file-indicator"></div>'), |
9394 | 9417 | |
9395 | | -$j('<div class="mwe-upwiz-visible-file-filename">') |
9396 | | -.append( |
9397 | | -$j('<span class="ui-icon ui-icon-document" style="display: inline-block;" />'), |
9398 | | -$j('<span class="mwe-upwiz-visible-file-filename-text"/>') |
9399 | | -) |
9400 | 9418 | |
9401 | | -); |
9402 | 9419 | |
9403 | | - |
9404 | | - |
9405 | 9420 | _this.filenameCtrl=$j('<input type="hidden" name="filename" value=""/>').get(0); |
9406 | 9421 | |
9407 | 9422 | |
— | — | @@ -9433,13 +9448,13 @@ |
9434 | 9449 | |
9435 | 9450 | |
9436 | 9451 | |
9437 | | -$j(_this.div).insertBefore('#mwe-upwiz-upload-ctrls'); |
| 9452 | +$j(filesDiv).append(_this.div); |
9438 | 9453 | |
9439 | 9454 | |
9440 | 9455 | |
9441 | 9456 | $j(_this.div).bind('transportProgressEvent',function(e){_this.showTransportProgress();}); |
9442 | | -$j(_this.div).bind('transportedEvent',function(e){_this.showTransported();}); |
9443 | 9457 | |
| 9458 | + |
9444 | 9459 | }; |
9445 | 9460 | |
9446 | 9461 | |
— | — | @@ -9483,13 +9498,31 @@ |
9484 | 9499 | $j(_this.div).find('.mwe-upwiz-visible-file-filename') |
9485 | 9500 | .css('margin-right',($indicator.outerWidth()+24).toString()+'px'); |
9486 | 9501 | $indicator.css('visibility','visible'); |
| 9502 | + |
| 9503 | +_this.setStatus(msgKey); |
9487 | 9504 | }, |
9488 | 9505 | |
9489 | 9506 | |
| 9507 | +setStatus:function(msgKey,args){ |
| 9508 | +if(!mw.isDefined(args)){ |
| 9509 | +args=[]; |
| 9510 | +} |
| 9511 | +this.setStatusStr(gM(msgKey,args)); |
| 9512 | +}, |
9490 | 9513 | |
| 9514 | +setStatusStr:function(str){ |
| 9515 | +$j(this.div).find('.mwe-upwiz-file-status').html(str).show(); |
| 9516 | +}, |
9491 | 9517 | |
| 9518 | +clearStatus:function(){ |
| 9519 | +$j(this.div).find('.mwe-upwiz-file-status').hide(); |
| 9520 | +}, |
9492 | 9521 | |
9493 | | -showTransportProgress:function(){ |
| 9522 | + |
| 9523 | + |
| 9524 | + |
| 9525 | + |
| 9526 | +showTransportProgress:function(fraction){ |
9494 | 9527 | this.showIndicatorMessage('progress','mwe-upwiz-uploading'); |
9495 | 9528 | |
9496 | 9529 | }, |
— | — | @@ -9523,6 +9556,7 @@ |
9524 | 9557 | |
9525 | 9558 | alert("bad extension"); |
9526 | 9559 | } |
| 9560 | +this.clearStatus(); |
9527 | 9561 | }, |
9528 | 9562 | |
9529 | 9563 | |
— | — | @@ -9562,6 +9596,7 @@ |
9563 | 9597 | |
9564 | 9598 | updateFilename:function(){ |
9565 | 9599 | var _this=this; |
| 9600 | + |
9566 | 9601 | var path=_this.fileInputCtrl.value; |
9567 | 9602 | |
9568 | 9603 | |
— | — | @@ -9579,7 +9614,7 @@ |
9580 | 9615 | |
9581 | 9616 | |
9582 | 9617 | _this.moveFileInputToCover( |
9583 | | -$div.find('.mwe-upwiz-visible-file-filename') |
| 9618 | +$div.find('.mwe-upwiz-visible-file-filename-text') |
9584 | 9619 | ); |
9585 | 9620 | |
9586 | 9621 | |
— | — | @@ -9594,7 +9629,7 @@ |
9595 | 9630 | |
9596 | 9631 | $div.bind('mouseenter mouseover',function(){ |
9597 | 9632 | $div.addClass('hover'); |
9598 | | -$j('#mwe-upwiz-files') |
| 9633 | +$j('#mwe-upwiz-filelist') |
9599 | 9634 | .children() |
9600 | 9635 | .filter(function(){return this!==_this.div;}) |
9601 | 9636 | .removeClass('hover'); |
— | — | @@ -10129,7 +10164,7 @@ |
10130 | 10165 | |
10131 | 10166 | if(!required){ |
10132 | 10167 | $j(description.div).append( |
10133 | | -$j.fn.removeCtrl('mwe-upwiz-remove-description',function(){_this.removeDescription(description);}) |
| 10168 | +$j.fn.removeCtrl(null,'mwe-upwiz-remove-description',function(){_this.removeDescription(description);}) |
10134 | 10169 | ); |
10135 | 10170 | } |
10136 | 10171 | |
— | — | @@ -10779,7 +10814,7 @@ |
10780 | 10815 | return false; |
10781 | 10816 | } |
10782 | 10817 | |
10783 | | -var upload=new mw.UploadWizardUpload(_this.api,'#mwe-upwiz-files'); |
| 10818 | +var upload=new mw.UploadWizardUpload(_this.api,'#mwe-upwiz-filelist'); |
10784 | 10819 | _this.uploadToAdd=upload; |
10785 | 10820 | |
10786 | 10821 | upload.ui.moveFileInputToCover('#mwe-upwiz-add-file'); |
— | — | @@ -10969,21 +11004,43 @@ |
10970 | 11005 | var _this=this; |
10971 | 11006 | |
10972 | 11007 | if(_this.uploads.length){ |
| 11008 | + |
10973 | 11009 | $j('#mwe-upwiz-upload-ctrl').removeAttr('disabled'); |
10974 | 11010 | $j('#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons').show(); |
| 11011 | + |
| 11012 | + |
10975 | 11013 | $j('#mwe-upwiz-add-file').html(gM('mwe-upwiz-add-file-n')); |
10976 | 11014 | $j('#mwe-upwiz-add-file-container').removeClass('mwe-upwiz-add-files-0'); |
10977 | 11015 | $j('#mwe-upwiz-add-file-container').addClass('mwe-upwiz-add-files-n'); |
10978 | | -$j('#mwe-upwiz-files .mwe-upwiz-file.filled:odd').addClass('odd'); |
10979 | | -$j('#mwe-upwiz-files .mwe-upwiz-file:filled:even').removeClass('odd'); |
| 11016 | + |
| 11017 | + |
| 11018 | +$j('#mwe-upwiz-filelist').addClass('mwe-upwiz-filled-filelist'); |
| 11019 | + |
| 11020 | + |
| 11021 | + |
| 11022 | +$j('#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file').removeClass('ui-corner-top').removeClass('ui-corner-bottom'); |
| 11023 | +$j('#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file:first').addClass('ui-corner-top'); |
| 11024 | +$j('#mwe-upwiz-filelist .filled .mwe-upwiz-visible-file:last').addClass('ui-corner-bottom'); |
| 11025 | +$j('#mwe-upwiz-filelist .filled:odd').addClass('odd'); |
| 11026 | +$j('#mwe-upwiz-filelist .filled:even').removeClass('odd'); |
10980 | 11027 | }else{ |
| 11028 | + |
10981 | 11029 | $j('#mwe-upwiz-upload-ctrl').attr('disabled','disabled'); |
| 11030 | + |
| 11031 | + |
| 11032 | + |
| 11033 | +$j('#mwe-upwiz-filelist').removeClass('mwe-upwiz-filled-filelist'); |
| 11034 | + |
| 11035 | + |
10982 | 11036 | $j('#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons').hide(); |
| 11037 | + |
| 11038 | + |
10983 | 11039 | $j('#mwe-upwiz-add-file').html(gM('mwe-upwiz-add-file-0')); |
10984 | 11040 | $j('#mwe-upwiz-add-file-container').addClass('mwe-upwiz-add-files-0'); |
10985 | 11041 | $j('#mwe-upwiz-add-file-container').removeClass('mwe-upwiz-add-files-n'); |
10986 | 11042 | } |
10987 | 11043 | |
| 11044 | + |
10988 | 11045 | if(_this.uploads.length<_this.maxUploads){ |
10989 | 11046 | $j('#mwe-upwiz-add-file').removeAttr('disabled'); |
10990 | 11047 | $j(_this.uploadToAdd.ui.div).show(); |
— | — | @@ -11135,13 +11192,14 @@ |
11136 | 11193 | |
11137 | 11194 | |
11138 | 11195 | |
11139 | | -$j.fn.removeCtrl=function(tooltipMsgKey,callback){ |
| 11196 | +$j.fn.removeCtrl=function(msgKey,tooltipMsgKey,callback){ |
| 11197 | +var msg=(msgKey===null)?'':gM(msgKey); |
11140 | 11198 | return $j('<div class="mwe-upwiz-remove-ctrl ui-corner-all" />') |
11141 | 11199 | .attr('title',gM(tooltipMsgKey)) |
11142 | 11200 | .click(callback) |
11143 | 11201 | .hover(function(){$j(this).addClass('hover');}, |
11144 | 11202 | function(){$j(this).removeClass('hover');}) |
11145 | | -.append($j('<span class="ui-icon ui-icon-close" />')); |
| 11203 | +.append($j('<div class="ui-icon ui-icon-close" /><div class="mwe-upwiz-remove-ctrl-msg">'+msg+'</div>')); |
11146 | 11204 | }; |
11147 | 11205 | |
11148 | 11206 | |
Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php |
— | — | @@ -201,6 +201,7 @@ |
202 | 202 | . '<div class="mwe-upwiz-stepdiv ui-helper-clearfix" id="mwe-upwiz-stepdiv-file">' |
203 | 203 | . '<div id="mwe-upwiz-intro">' . wfMsg('mwe-upwiz-intro') . '</div>' |
204 | 204 | . '<div id="mwe-upwiz-files">' |
| 205 | + . '<div id="mwe-upwiz-filelist" class="ui-corner-all"></div>' |
205 | 206 | . '<div id="mwe-upwiz-upload-ctrls" class="mwe-upwiz-file">' |
206 | 207 | . '<div id="mwe-upwiz-add-file-container" class="mwe-upwiz-add-files-0">' |
207 | 208 | . '<a id="mwe-upwiz-add-file">' . wfMsg("mwe-upwiz-add-file-0") . '</a>' |