Fixed bug #13167: Flash Uploader error messages should be more descriptive / Improve...
authorBenni Mack <benni.mack@typo3.org>
Sun, 17 Jan 2010 15:38:04 +0000 (15:38 +0000)
committerBenni Mack <benni.mack@typo3.org>
Sun, 17 Jan 2010 15:38:04 +0000 (15:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6796 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/backend.php
typo3/js/flashupload.js
typo3/sysext/lang/locallang_misc.xml

index b6b6e0a..f337bdf 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-17  Benjamin Mack  <benni@typo3.org>
+
+       * Fixed bug #13167: Flash Uploader error messages should be more descriptive / Improve error handling of massuploader (Thanks to Steffen Gebert)
+
 2010-01-17  Andreas Otto  <andreas@otto-hanika.de>
 
         * Fixed bug #13254: Flash Messages in wizard "create multiple pages" (Thanks to Georg Ringer)
index a82faf7..3f846b2 100644 (file)
@@ -401,7 +401,7 @@ class TYPO3backend {
                        'errorQueueFileSizeLimit' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueFileSizeLimit'),
                        'errorQueueZeroByteFile' =>  $GLOBALS['LANG']->getLL('fileUpload_errorQueueZeroByteFile'),
                        'errorQueueInvalidFiletype' => $GLOBALS['LANG']->getLL('fileUpload_errorQueueInvalidFiletype'),
-                       'errorUploadHttp' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadHttp'),
+                       'errorUploadHttp' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadHttpError'),
                        'errorUploadMissingUrl' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadMissingUrl'),
                        'errorUploadIO' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadIO'),
                        'errorUploadSecurityError' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadSecurityError'),
@@ -411,6 +411,10 @@ class TYPO3backend {
                        'errorUploadFileValidation' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileValidation'),
                        'errorUploadFileCancelled' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadFileCancelled'),
                        'errorUploadStopped' => $GLOBALS['LANG']->getLL('fileUpload_errorUploadStopped'),
+                       'allErrorMessageTitle' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageTitle'),
+                       'allErrorMessageText' => $GLOBALS['LANG']->getLL('fileUpload_allErrorMessageText'),
+                       'allError401' => $GLOBALS['LANG']->getLL('fileUpload_allError401'),
+                       'allError2038' => $GLOBALS['LANG']->getLL('fileUpload_allError2038'),
                );
 
                        // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
@@ -688,4 +692,4 @@ if(is_array($GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendI
 
 $TYPO3backend->render();
 
-?>
\ No newline at end of file
+?>
index e889cce..aaad3fb 100644 (file)
@@ -34,6 +34,7 @@ Ext.onReady(function() {
        TYPO3.FileUploadWindow = Ext.extend(Ext.Window, {
                completedUploads: 0,    // number of successfully completed uploads in this current instance, could be useful for some applications
                activeUploads: {},              // holds all TYPO3.FileUpload instances currently uploading or in queue
+               lastError: null,        // last error occured
                swf: null,      // holds the SWFUpload instance
                deniedFileTypes: '',    // internal, local check to see if the uploading file is not allowed
                swfDefaultConfig: {     // includes all default options the SWFUpload needs
@@ -385,6 +386,7 @@ Ext.onReady(function() {
                // private
                uploadError: function(fileObj, errorCode, message) {
                        this.activeUploads[fileObj.id].error(errorCode, message);
+                       this.lastError = {'errorCode': errorCode, 'message': message};
                        this.fireEvent('uploadError', this, [this.activeUploads[fileObj.id], errorCode, message]);
                        delete this.activeUploads[fileObj.id];
                },
@@ -406,10 +408,46 @@ Ext.onReady(function() {
                totalComplete: function() {
                        if (this.completedUploads > 0) {
                                this.fireEvent('totalComplete', this);
+                       } else {
+                                       // if all our uploads fail, we try to provide some reasons
+                               this.totalError();
                        }
                        this.cleanup();
                        this.hide();
                },
+
+               // private
+               // this handler is only called by totalComplete, not by swfupload itself
+               totalError: function() {
+                       if (this.lastError == null) {
+                               return;
+                       }
+
+                       var errorCode = this.lastError.errorCode;
+                       var message = this.lastError.message;
+                       var messageText = null;
+
+                               // provide a more detailed problem description for the well known bugs
+                       switch (errorCode) {
+                               case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
+                                       if (message == '401') {
+                                               messageText = String.format(TYPO3.LLL.fileUpload.allError401);
+                                       }
+                               break;
+
+                               case SWFUpload.UPLOAD_ERROR.IO_ERROR:
+                                       if (message == 'Error #2038') {
+                                               messageText = String.format(TYPO3.LLL.fileUpload.allError2038);
+                                       }
+                               break;
+                       }
+                       Ext.MessageBox.show({
+                               title: String.format(TYPO3.LLL.fileUpload.allErrorMessageTitle),
+                               msg: String.format(TYPO3.LLL.fileUpload.allErrorMessageText + (messageText ? messageText : message)),
+                               buttons: Ext.MessageBox.OK,
+                               icon: Ext.MessageBox.ERROR
+                       });
+               },
                
                /**
                 * Removes all components from this container.
@@ -570,7 +608,7 @@ Ext.onReady(function() {
                                break;
 
                                case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
-                                       txt = String.format(TYPO3.LLL.fileUpload.errorUploadHttp);
+                                       txt = String.format(TYPO3.LLL.fileUpload.errorUploadHttp, message);
                                break;
                                case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
                                        txt = String.format(TYPO3.LLL.fileUpload.errorUploadMissingUrl);
index 095604e..53d7528 100755 (executable)
@@ -89,6 +89,7 @@
                        <label index="fileUpload_errorQueueZeroByteFile">{0} is empty</label>
                        <label index="fileUpload_errorQueueInvalidFiletype">Filetype not allowed for {0}</label>
                        <label index="fileUpload_errorUploadHttp">Too many files selected</label>
+                       <label index="fileUpload_errorUploadHttpError">A HTTP error occured: {0}</label>
                        <label index="fileUpload_errorUploadMissingUrl">Internal error: No Upload URL set</label>
                        <label index="fileUpload_errorUploadIO">Internal error: Problems while reading/writing the file</label>
                        <label index="fileUpload_errorUploadSecurityError">Internal error: {0}</label>
                        <label index="fileUpload_errorUploadFileValidation">Internal error while validating the file</label>
                        <label index="fileUpload_errorUploadFileCancelled">Upload of {0} canceled</label>
                        <label index="fileUpload_errorUploadStopped">Upload of {0} stopped</label>
+                       <label index="fileUpload_allErrorMessageTitle">All uploads failed</label>
+                       <label index="fileUpload_allErrorMessageText"><![CDATA[All of your uploads failed.<br /><br />If this problem persists, please try another browser, contact your administrator or disable this "Flash Uploader" in your User Settings.<br /><br />Detailed problem description:<br />]]></label>
+                       <label index="fileUpload_allError401">The server returned the status code 401, which is related to a .htaccess file used for password protection on your server. Unfortunately this can not be handled by your browser's Flash plugin.</label>
+                       <label index="fileUpload_allError2038">An input/output error occured (Error #2038). This i.e. happens with servers using a self-signed SSL certificate, which is a limitation of your browser's Flash plugin.</label>
                </languageKey>
        </data>
 </T3locallang>