Revert "[BUGFIX] Improve confirmation dialog in drag'n'drop fileupload" 58/27158/4
authorFrans Saris <franssaris@gmail.com>
Thu, 30 Jan 2014 16:05:04 +0000 (17:05 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Thu, 30 Jan 2014 17:30:12 +0000 (18:30 +0100)
This reverts commit 495afb59adf47818215bb702a71ec5f79dfd4359

The patch is reverted because it does not work when there is paging in
the filelist or a file has no thumb shown.
Further the filename canonicalization done by the storage driver is
not respected when checking the new file name.

Change-Id: I6f4b91bbf28e7b6f0cb8d7bcfb42f0cfb5eeacc6
Reviewed-on: https://review.typo3.org/27158
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
typo3/sysext/backend/Resources/Public/JavaScript/DragUploader.js
typo3/sysext/filelist/Classes/FileList.php
typo3/sysext/lang/locallang_core.xlf

index 8c6e031..1f8a6c0 100644 (file)
@@ -33,7 +33,6 @@ define('TYPO3/CMS/Backend/DragUploader', ['jquery'], function($) {
                me.$progress = $('<div />').addClass('DragUpload-ProgressInformation').hide().appendTo(me.$body);
                me.uploadCompletedCount = 0;
                me.fileQueue = [];
-               me.filesOnServer = [];
 
                me.fileDenyPattern = new RegExp($('[data-file-deny-pattern]').attr('data-file-deny-pattern'), 'i');
                me.maxFileSize = parseInt($('[data-max-file-size]').attr('data-max-file-size'));
@@ -88,27 +87,8 @@ define('TYPO3/CMS/Backend/DragUploader', ['jquery'], function($) {
                        }
                        me.ignoreDrop(event);
 
-                       // collect files which would be overridden
-                       var filesToOverride = [];
-                       $.each(event.dataTransfer.files, function(i, file) {
-                               if($.inArray(file.name, me.filesOnServer) > -1) {
-                                       filesToOverride.push(file.name);
-                               }
-                       });
-
-                       var override = false;
-                       if (filesToOverride.length > 0) {
-                               var message = TYPO3.l10n.localize('file_upload.overwriteExistingFiles')
-                                       + "\n\n" + filesToOverride.join("\n");
-
-                               // ask user if we should override files
-                               override = confirm(message);
-
-                               if (override === false) {
-                                       // user canceled upload, do not proceed
-                                       return false;
-                               }
-                       }
+                       // ask user if we should override files
+                       var override = confirm(TYPO3.l10n.localize('file_upload.overwriteExistingFiles'));
 
                        // Add each file to queue and trigger upload
                        $.each(event.dataTransfer.files, function(i, file) {
@@ -145,7 +125,6 @@ define('TYPO3/CMS/Backend/DragUploader', ['jquery'], function($) {
                                        xhr.onload = function () {
                                                me.uploadCompletedCount++;
                                                me.updateProgress();
-                                               me.filesOnServer.push(file.name);
                                        };
                                        xhr.onerror = function() {
                                                TYPO3.Flashmessage.display(
@@ -206,11 +185,6 @@ define('TYPO3/CMS/Backend/DragUploader', ['jquery'], function($) {
                                        }
                                });
                        }
-
-                       // initialize the files which are already present on server
-                       $('[data-file-name]').each(function(index, row) {
-                               me.filesOnServer.push($(row).data('file-name'));
-                       });
                }
 
 
index 6aefe6c..0434dcf 100644 (file)
@@ -660,7 +660,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                                                                $processedFile = $fileObject->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                                                                if ($processedFile) {
                                                                        $thumbUrl = $processedFile->getPublicUrl(TRUE);
-                                                                       $theData[$field] .= '<br /><img src="' . $thumbUrl . '" hspace="2" data-file-name="' . htmlspecialchars($fileName) . '" title="' . htmlspecialchars($fileName) . '" alt="" />';
+                                                                       $theData[$field] .= '<br /><img src="' . $thumbUrl . '" hspace="2" title="' . htmlspecialchars($fileName) . '" alt="" />';
                                                                }
                                                        }
                                                        break;
index 5f4eef3..1e688ed 100644 (file)
@@ -467,7 +467,7 @@ Do you want to continue WITHOUT saving?</source>
                                <source>Upload complete! Filelist reloading...</source>
                        </trans-unit>
                        <trans-unit id="file_upload.overwriteExistingFiles" xml:space="preserve">
-                               <source>The files below will be overwritten.</source>
+                               <source>Shall existing files be overwritten?</source>
                        </trans-unit>
                        <trans-unit id="file_upload.php.number_of_files" xml:space="preserve">
                                <source>Number of files:</source>