|
771 | 771 | self.fileManager = {
|
772 | 772 | stack: {},
|
773 | 773 | processed: [],
|
| 774 | + errors: [], |
774 | 775 | loadedImages: {},
|
775 | 776 | totalImages: 0,
|
776 | 777 | totalFiles: null,
|
|
904 | 905 | fm.totalSize = null;
|
905 | 906 | fm.uploadedSize = 0;
|
906 | 907 | fm.stack = {};
|
| 908 | + fm.errors = []; |
907 | 909 | fm.processed = [];
|
908 | 910 | fm.stats = {};
|
909 | 911 | fm.clearImages();
|
|
2042 | 2044 | self._raise('filefoldererror', [folders, msg]);
|
2043 | 2045 | },
|
2044 | 2046 | _showUploadError: function (msg, params, event) {
|
2045 |
| - var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', fId = params.fileId || '', |
2046 |
| - e = params && params.id ? |
2047 |
| - '<li data-thumb-id="' + params.id + '" data-file-id="' + fId + '">' + msg + '</li>' : '<li>' + msg + '</li>'; |
| 2047 | + var self = this, $error = self.$errorContainer, ev = event || 'fileuploaderror', |
| 2048 | + fId = params && params.fileId || '', e = params && params.id ? |
| 2049 | + '<li data-thumb-id="' + params.id + '" data-file-id="' + fId + '">' + msg + '</li>' : '<li>' + msg + '</li>'; |
2048 | 2050 | if ($error.find('ul').length === 0) {
|
2049 | 2051 | self._addError('<ul>' + e + '</ul>');
|
2050 | 2052 | } else {
|
|
2755 | 2757 | }
|
2756 | 2758 | if (self.isAjaxUpload) {
|
2757 | 2759 | if (self.fileManager.count() > 0) {
|
2758 |
| - files = self.fileManager.stack; |
| 2760 | + files = $.extend(true, {}, self.fileManager.stack); |
2759 | 2761 | self.fileManager.clear();
|
2760 | 2762 | self._clearFileInput();
|
2761 | 2763 | } else {
|
|
3178 | 3180 | }
|
3179 | 3181 | updateUploadLog = function () {
|
3180 | 3182 | if (!uploadFailed) {
|
3181 |
| - self.fileManager.removeFile(id); |
| 3183 | + fm.removeFile(id); |
| 3184 | + } else { |
| 3185 | + fm.errors.push(id); |
3182 | 3186 | }
|
3183 |
| - self.fileManager.setProcessed(id); |
3184 |
| - if (self.fileManager.isProcessed()) { |
| 3187 | + fm.setProcessed(id); |
| 3188 | + if (fm.isProcessed()) { |
3185 | 3189 | self.fileBatchCompleted = true;
|
3186 | 3190 | }
|
3187 | 3191 | };
|
|
3191 | 3195 | return;
|
3192 | 3196 | }
|
3193 | 3197 | setTimeout(function () {
|
3194 |
| - var triggerReset = self.fileManager.count() === 0; |
| 3198 | + var triggerReset = fm.count() === 0, errCount = fm.errors.length; |
3195 | 3199 | self._updateInitialPreview();
|
3196 | 3200 | self.unlock(triggerReset);
|
3197 | 3201 | if (triggerReset) {
|
|
3202 | 3206 | $h.addCss($initThumbs, $h.SORT_CSS);
|
3203 | 3207 | self._initSortable();
|
3204 | 3208 | }
|
3205 |
| - self._raise('filebatchuploadcomplete', [self.fileManager.stack, self._getExtraData()]); |
3206 |
| - self.fileManager.clear(); |
| 3209 | + self._raise('filebatchuploadcomplete', [fm.stack, self._getExtraData()]); |
| 3210 | + if (!self.retryErrorUploads || errCount === 0) { |
| 3211 | + fm.clear(); |
| 3212 | + } |
3207 | 3213 | self._setProgress(101);
|
3208 | 3214 | self.ajaxAborted = false;
|
3209 | 3215 | }, self.processDelay);
|
|
3226 | 3232 | if (!isBatch) {
|
3227 | 3233 | self.lock();
|
3228 | 3234 | }
|
| 3235 | + if (fm.errors.indexOf(id) !== -1) { |
| 3236 | + delete fm.errors[id]; |
| 3237 | + } |
3229 | 3238 | self._raise('filepreupload', [outData, previewId, i]);
|
3230 | 3239 | $.extend(true, params, outData);
|
3231 | 3240 | if (self._abort(params)) {
|
|
0 commit comments