Dotclear


Ignore:
Timestamp:
08/09/13 16:18:50 (12 years ago)
Author:
Nicolas <nikrou77@…>
Branch:
default
Message:

Revert jquery.fileupload files and upgrade them to latest state.
Start button is allways shown but disabled if any file is in the list to be send.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • admin/js/jsUpload/jquery.fileupload-ui.js

    r1206 r1320  
    11/* 
    2  * jQuery File Upload User Interface Plugin 8.2.1 
     2 * jQuery File Upload User Interface Plugin 8.7.1 
    33 * https://github.com/blueimp/jQuery-File-Upload 
    44 * 
     
    2020            'jquery', 
    2121            'tmpl', 
    22             './jquery.fileupload-resize', 
     22            './jquery.fileupload-image', 
     23            './jquery.fileupload-audio', 
     24            './jquery.fileupload-video', 
    2325            './jquery.fileupload-validate' 
    2426        ], factory); 
     
    104106                    ); 
    105107                }); 
    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              */ 
    117108            }, 
    118109            // Callback for the start of each file upload request: 
    119110            send: function (e, data) { 
    120                 $(this).find('.start').hide(); 
    121111                var that = $(this).data('blueimp-fileupload') || 
    122112                        $(this).data('fileupload'); 
     
    140130            // Callback for successful uploads: 
    141131            done: function (e, data) { 
    142  
    143132                var that = $(this).data('blueimp-fileupload') || 
    144133                        $(this).data('fileupload'), 
     
    151140                    data.context.each(function (index) { 
    152141                        var file = files[index] || 
    153                                 {error: 'Empty file upload result'}, 
    154                             deferred = that._addFinishedDeferreds(); 
     142                                {error: 'Empty file upload result'}; 
     143                        deferred = that._addFinishedDeferreds(); 
    155144                        that._transition($(this)).done( 
    156145                            function () { 
     
    171160                    }); 
    172161                } 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); 
    175165                    that._forceReflow(template); 
    176166                    deferred = that._addFinishedDeferreds(); 
     
    227217                    }); 
    228218                } 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) 
    231222                        .data('data', data); 
    232223                    that._forceReflow(data.context); 
     
    281272            // Callback for uploads start, equivalent to the global ajaxStart event: 
    282273            start: function (e) { 
    283                 $(this).find('.start').hide(); 
    284274                var that = $(this).data('blueimp-fileupload') || 
    285                 $(this).data('fileupload'); 
     275                        $(this).data('fileupload'); 
    286276                that._resetFinishedDeferreds(); 
    287277                that._transition($(this).find('.fileupload-progress')).done( 
    288  
    289278                    function () { 
    290  
    291279                        that._trigger('started', e); 
    292280                    } 
     
    295283            // Callback for uploads stop, equivalent to the global ajaxStop event: 
    296284            stop: function (e) { 
    297                 $(this).find('.start').show(); 
    298285                var that = $(this).data('blueimp-fileupload') || 
    299286                        $(this).data('fileupload'), 
     
    312299                    } 
    313300                ); 
    314             /* 
    315              *  Recherche des fichers restants à uploader 
    316              *  Désactivation du bouton si plus rien 
    317              */ 
    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              */ 
    327301            }, 
    328302            processstart: function () { 
     
    335309            destroy: function (e, data) { 
    336310                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 () { 
    340313                        that._transition(data.context).done( 
    341314                            function () { 
     
    344317                            } 
    345318                        ); 
    346                     }); 
     319                    }; 
     320                if (data.url) { 
     321                    $.ajax(data).done(removeNode); 
     322                } else { 
     323                    removeNode(); 
    347324                } 
    348325            } 
     
    637614            this._super(); 
    638615            this._resetFinishedDeferreds(); 
     616            if (!$.support.fileInput) { 
     617                this._disableFileInputButton(); 
     618            } 
    639619        }, 
    640620 
Note: See TracChangeset for help on using the changeset viewer.

Sites map