Changeset 1320:e3b4f3b9169a
- Timestamp:
- 08/09/13 16:18:50 (12 years ago)
- Branch:
- default
- Location:
- admin
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
admin/js/_media.js
r1280 r1320 2 2 if ($('#fileupload').length==0) { 3 3 return; 4 } 5 6 function enableButton(button) { 7 button.prop('disabled',false).removeClass('disabled'); 8 } 9 10 function disableButton(button) { 11 button.prop('disabled',true).addClass('disabled'); 4 12 } 5 13 … … 10 18 }); 11 19 12 $('.button.cancel', '#fileupload').click(function(e) { 13 $('.button.cancel, .button.start','#fileupload .fileupload-buttonbar').hide(); 20 $('.button.cancel', '#fileupload .fileupload-buttonbar').click(function(e) { 21 $('.button.cancel','#fileupload .fileupload-buttonbar').hide(); 22 disableButton($('.button.start','#fileupload .fileupload-buttonbar')); 23 }); 24 25 $('.cancel').live('click', function(e) { 26 if ($('.fileupload-ctrl .files .template-upload', '#fileupload').length==0) { 27 $('.button.cancel','#fileupload .fileupload-buttonbar').hide(); 28 disableButton($('.button.start','#fileupload .fileupload-buttonbar')); 29 } 14 30 }); 15 31 … … 28 44 disabled: true 29 45 }).bind('fileuploadadd', function(e, data) { 30 $('.button.cancel, .button.start', '#fileupload .fileupload-buttonbar').show(); 46 $('.button.cancel','#fileupload .fileupload-buttonbar').show(); 47 enableButton($('.button.start','#fileupload .fileupload-buttonbar')); 31 48 }).bind('fileuploaddone', function(e, data) { 32 49 if (data.result.files[0].html !==undefined) { … … 36 53 }).bind('fileuploadalways', function(e, data) { 37 54 if ($('.fileupload-ctrl .files .template-upload', '#fileupload').length==0) { 38 $('.button.start, .button.cancel','#fileupload .fileupload-buttonbar').hide(); 55 $('.button.cancel','#fileupload .fileupload-buttonbar').hide(); 56 disableButton($('.button.start','#fileupload .fileupload-buttonbar')); 39 57 } 40 58 }); … … 47 65 label = dotclear.jsUpload.msg.choose_files; 48 66 $('#fileupload').fileupload({disabled:false}); 67 disableButton($('.button.start','#fileupload .fileupload-buttonbar')); 49 68 } else { 50 69 $msg = dotclear.msg.enhanced_uploader_activate; … … 61 80 // We must remove files in table 62 81 $('.files .upload-file', '#fileupload').remove(); 63 $('.button.cancel, .button.start','#fileupload .fileupload-buttonbar').hide(); 64 $('.button.start','#fileupload').show(); 82 $('.button.cancel,.button.clean','#fileupload .fileupload-buttonbar').hide(); 65 83 $('#fileupload').fileupload({disabled:true}); 66 84 } else { … … 68 86 label = dotclear.jsUpload.msg.choose_files; 69 87 $('#upfile').attr('multiple', true); 70 $('.button.start','#fileupload').hide(); 88 var startButton = $('.button.start','#fileupload .fileupload-buttonbar'); 89 disableButton(startButton); 90 startButton.show(); 71 91 $('#fileupload').fileupload({disabled:false}); 72 92 } -
admin/js/jsUpload/jquery.fileupload-process.js
r1144 r1320 1 1 /* 2 * jQuery File Upload Processing Plugin 1. 12 * jQuery File Upload Processing Plugin 1.2.2 3 3 * https://github.com/blueimp/jQuery-File-Upload 4 4 * … … 99 99 var processQueue = []; 100 100 $.each(options.processQueue, function () { 101 var settings = {}; 101 var settings = {}, 102 action = this.action, 103 prefix = this.prefix === true ? action : this.prefix; 102 104 $.each(this, function (key, value) { 103 105 if ($.type(value) === 'string' && 104 106 value.charAt(0) === '@') { 105 settings[key] = options[value.slice(1)]; 107 settings[key] = options[ 108 value.slice(1) || (prefix ? prefix + 109 key.charAt(0).toUpperCase() + key.slice(1) : key) 110 ]; 106 111 } else { 107 112 settings[key] = value; 108 113 } 114 109 115 }); 110 116 processQueue.push(settings); … … 128 134 this._trigger('processstart'); 129 135 } 130 $.each(data.files, function (index , file) {136 $.each(data.files, function (index) { 131 137 var opts = index ? $.extend({}, options) : options, 132 138 func = function () { -
admin/js/jsUpload/jquery.fileupload-ui.js
r1206 r1320 1 1 /* 2 * jQuery File Upload User Interface Plugin 8. 2.12 * jQuery File Upload User Interface Plugin 8.7.1 3 3 * https://github.com/blueimp/jQuery-File-Upload 4 4 * … … 20 20 'jquery', 21 21 'tmpl', 22 './jquery.fileupload-resize', 22 './jquery.fileupload-image', 23 './jquery.fileupload-audio', 24 './jquery.fileupload-video', 23 25 './jquery.fileupload-validate' 24 26 ], factory); … … 104 106 ); 105 107 }); 106 107 /*108 *109 * Activation du bouton si un fichier trouvé110 */111 var fileUploadButtonBar = that.element.find('.fileupload-buttonbar');112 fileUploadButtonBar.find('.start').prop('disabled', false);113 fileUploadButtonBar.find('.start').removeClass('disabled');114 /*115 *116 */117 108 }, 118 109 // Callback for the start of each file upload request: 119 110 send: function (e, data) { 120 $(this).find('.start').hide();121 111 var that = $(this).data('blueimp-fileupload') || 122 112 $(this).data('fileupload'); … … 140 130 // Callback for successful uploads: 141 131 done: function (e, data) { 142 143 132 var that = $(this).data('blueimp-fileupload') || 144 133 $(this).data('fileupload'), … … 151 140 data.context.each(function (index) { 152 141 var file = files[index] || 153 {error: 'Empty file upload result'} ,154 142 {error: 'Empty file upload result'}; 143 deferred = that._addFinishedDeferreds(); 155 144 that._transition($(this)).done( 156 145 function () { … … 171 160 }); 172 161 } else { 173 template = that._renderDownload(files) 174 .appendTo(that.options.filesContainer); 162 template = that._renderDownload(files)[ 163 that.options.prependFiles ? 'prependTo' : 'appendTo' 164 ](that.options.filesContainer); 175 165 that._forceReflow(template); 176 166 deferred = that._addFinishedDeferreds(); … … 227 217 }); 228 218 } else if (data.errorThrown !== 'abort') { 229 data.context = that._renderUpload(data.files) 230 .appendTo(that.options.filesContainer) 219 data.context = that._renderUpload(data.files)[ 220 that.options.prependFiles ? 'prependTo' : 'appendTo' 221 ](that.options.filesContainer) 231 222 .data('data', data); 232 223 that._forceReflow(data.context); … … 281 272 // Callback for uploads start, equivalent to the global ajaxStart event: 282 273 start: function (e) { 283 $(this).find('.start').hide();284 274 var that = $(this).data('blueimp-fileupload') || 285 $(this).data('fileupload');275 $(this).data('fileupload'); 286 276 that._resetFinishedDeferreds(); 287 277 that._transition($(this).find('.fileupload-progress')).done( 288 289 278 function () { 290 291 279 that._trigger('started', e); 292 280 } … … 295 283 // Callback for uploads stop, equivalent to the global ajaxStop event: 296 284 stop: function (e) { 297 $(this).find('.start').show();298 285 var that = $(this).data('blueimp-fileupload') || 299 286 $(this).data('fileupload'), … … 312 299 } 313 300 ); 314 /*315 * Recherche des fichers restants à uploader316 * Désactivation du bouton si plus rien317 */318 var filesList = that.options.filesContainer;319 if(filesList.find('.start').size() == 0) {320 var fileUploadButtonBar = that.element.find('.fileupload-buttonbar');321 fileUploadButtonBar.find('.start').prop('disabled', true);322 fileUploadButtonBar.find('.start').addClass('disabled');323 }324 /*325 *326 */327 301 }, 328 302 processstart: function () { … … 335 309 destroy: function (e, data) { 336 310 var that = $(this).data('blueimp-fileupload') || 337 $(this).data('fileupload'); 338 if (data.url) { 339 $.ajax(data).done(function () { 311 $(this).data('fileupload'), 312 removeNode = function () { 340 313 that._transition(data.context).done( 341 314 function () { … … 344 317 } 345 318 ); 346 }); 319 }; 320 if (data.url) { 321 $.ajax(data).done(removeNode); 322 } else { 323 removeNode(); 347 324 } 348 325 } … … 637 614 this._super(); 638 615 this._resetFinishedDeferreds(); 616 if (!$.support.fileInput) { 617 this._disableFileInputButton(); 618 } 639 619 }, 640 620 -
admin/js/jsUpload/jquery.fileupload.js
r1144 r1320 1 1 /* 2 * jQuery File Upload Plugin 5.3 1.12 * jQuery File Upload Plugin 5.32.2 3 3 * https://github.com/blueimp/jQuery-File-Upload 4 4 * … … 11 11 12 12 /*jslint nomen: true, unparam: true, regexp: true */ 13 /*global define, window, document, File, Blob, FormData, location*/13 /*global define, window, document, location, File, Blob, FormData */ 14 14 15 15 (function (factory) { … … 28 28 'use strict'; 29 29 30 // Detect file input support, based on 31 // http://viljamis.com/blog/2012/file-upload-support-on-mobile/ 32 $.support.fileInput = !(new RegExp( 33 // Handle devices which give false positives for the feature detection: 34 '(Android (1\\.[0156]|2\\.[01]))' + 35 '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' + 36 '|(w(eb)?OSBrowser)|(webOS)' + 37 '|(Kindle/(1\\.0|2\\.[05]|3\\.0))' 38 ).test(window.navigator.userAgent) || 39 // Feature detection for all other devices: 40 $('<input type="file">').prop('disabled')); 41 30 42 // The FileReader API is not actually used, but works as feature detection, 31 43 // as e.g. Safari supports XHR file uploads via the FormData API, … … 33 45 $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader); 34 46 $.support.xhrFormDataFileUpload = !!window.FormData; 47 48 // Detect support for Blob slicing (required for chunked uploads): 49 $.support.blobSlice = window.Blob && (Blob.prototype.slice || 50 Blob.prototype.webkitSlice || Blob.prototype.mozSlice); 35 51 36 52 // The fileupload widget listens for change events on file input fields defined … … 145 161 // widget (via file input selection, drag & drop, paste or add API call). 146 162 // If the singleFileUploads option is enabled, this callback will be 147 // called once for each file in the selection for XHR file upl aods, else163 // called once for each file in the selection for XHR file uploads, else 148 164 // once for each file selection. 165 // 149 166 // The upload starts when the submit method is invoked on the data parameter. 150 167 // The data object contains a files property holding the added files 151 // and allows to override plugin options as well as define ajax settings. 168 // and allows you to override plugin options as well as define ajax settings. 169 // 152 170 // Listeners for this callback can also be bound the following way: 153 171 // .bind('fileuploadadd', func); 172 // 154 173 // data.submit() returns a Promise object and allows to attach additional 155 174 // handlers using jQuery's Deferred callbacks: … … 233 252 'forceIframeTransport' 234 253 ], 254 255 _blobSlice: $.support.blobSlice && function () { 256 var slice = this.slice || this.webkitSlice || this.mozSlice; 257 return slice.apply(this, arguments); 258 }, 235 259 236 260 _BitrateTimer: function () { … … 380 404 options.headers['Content-Range'] = options.contentRange; 381 405 } 382 if (!multipart ) {406 if (!multipart || options.blob || !this._isInstanceOf('File', file)) { 383 407 options.headers['Content-Disposition'] = 'attachment; filename="' + 384 408 encodeURI(file.name) + '"'; 409 } 410 if (!multipart) { 385 411 options.contentType = file.type; 386 412 options.data = options.blob || file; … … 415 441 } 416 442 if (options.blob) { 417 options.headers['Content-Disposition'] = 'attachment; filename="' +418 encodeURI(file.name) + '"';419 443 formData.append(paramName, options.blob, file.name); 420 444 } else { … … 440 464 441 465 _initIframeSettings: function (options) { 466 var targetHost = $('<a></a>').prop('href', options.url).prop('host'); 442 467 // Setting the dataType to iframe enables the iframe transport: 443 468 options.dataType = 'iframe ' + (options.dataType || ''); … … 445 470 options.formData = this._getFormData(options); 446 471 // Add redirect url to form data on cross-domain uploads: 447 if (options.redirect && $('<a></a>').prop('href', options.url) 448 .prop('host') !== location.host) { 472 if (options.redirect && targetHost && targetHost !== location.host) { 449 473 options.formData.push({ 450 474 name: options.redirectParamName || 'redirect', … … 628 652 // upload requests: 629 653 _chunkedUpload: function (options, testOnly) { 654 options.uploadedBytes = options.uploadedBytes || 0; 630 655 var that = this, 631 656 file = options.files[0], 632 657 fs = file.size, 633 ub = options.uploadedBytes = options.uploadedBytes || 0,658 ub = options.uploadedBytes, 634 659 mcs = options.maxChunkSize || fs, 635 slice = file.slice || file.webkitSlice || file.mozSlice,660 slice = this._blobSlice, 636 661 dfd = $.Deferred(), 637 662 promise = dfd.promise(), … … 851 876 pipe = slot.pipe(send); 852 877 } else { 853 pipe = (this._sequence = this._sequence.pipe(send, send)); 878 this._sequence = this._sequence.pipe(send, send); 879 pipe = this._sequence; 854 880 } 855 881 // Return the piped Promise object, enhanced with an abort method, … … 1101 1127 1102 1128 _onDrop: function (e) { 1129 e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; 1103 1130 var that = this, 1104 dataTransfer = e.dataTransfer = e.originalEvent && 1105 e.originalEvent.dataTransfer, 1131 dataTransfer = e.dataTransfer, 1106 1132 data = {}; 1107 1133 if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { … … 1117 1143 1118 1144 _onDragOver: function (e) { 1119 var dataTransfer = e.dataTransfer = e.originalEvent &&1120 e.originalEvent.dataTransfer;1145 e.dataTransfer = e.originalEvent && e.originalEvent.dataTransfer; 1146 var dataTransfer = e.dataTransfer; 1121 1147 if (dataTransfer) { 1122 1148 if (this._trigger('dragover', e) === false) { … … 1140 1166 }); 1141 1167 } 1142 this._on(this.options.fileInput, { 1143 change: this._onChange 1144 }); 1168 if ($.support.fileInput) { 1169 this._on(this.options.fileInput, { 1170 change: this._onChange 1171 }); 1172 } 1145 1173 }, 1146 1174 … … 1276 1304 return; 1277 1305 } 1306 if (!files.length) { 1307 dfd.reject(); 1308 return; 1309 } 1278 1310 data.files = files; 1279 1311 jqXHR = that._onSend(null, data).then( -
admin/js/jsUpload/jquery.iframe-transport.js
r1144 r1320 1 1 /* 2 * jQuery Iframe Transport Plugin 1. 6.22 * jQuery Iframe Transport Plugin 1.7 3 3 * https://github.com/blueimp/jQuery-File-Upload 4 4 * … … 171 171 172 172 // The iframe transport returns the iframe content document as response. 173 // The following adds converters from iframe to text, json, html, and script: 173 // The following adds converters from iframe to text, json, html, xml 174 // and script. 175 // Please note that the Content-Type for JSON responses has to be text/plain 176 // or text/html, if the browser doesn't include application/json in the 177 // Accept header, else IE will show a download dialog. 178 // The Content-Type for XML responses on the other hand has to be always 179 // application/xml or text/xml, so IE properly parses the XML response. 180 // See also 181 // https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation 174 182 $.ajaxSetup({ 175 183 converters: { … … 182 190 'iframe html': function (iframe) { 183 191 return iframe && $(iframe[0].body).html(); 192 }, 193 'iframe xml': function (iframe) { 194 var xmlDoc = iframe && iframe[0]; 195 return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc : 196 $.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) || 197 $(xmlDoc.body).html()); 184 198 }, 185 199 'iframe script': function (iframe) { -
admin/style/jsUpload/style.css
r1209 r1320 76 76 } 77 77 78 .button.clean, .button.cancel, .button.add , .enhanced_uploader .fileupload-buttonbar .button.start{78 .button.clean, .button.cancel, .button.add { 79 79 display: none; 80 80 }
Note: See TracChangeset
for help on using the changeset viewer.