Bug #21288

Flash Uploader only works in click menu in file tree, not in right frame

Added by Georg Ringer over 11 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-10-16
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.0
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

the flash uploader only works when using the click menu in the file tree (2nd frame) and not in the right frame.

when opening the click menu in the right frame and clicking on "upload file" nothing happens.

look at the screenshot for a graphical explanation

(issue imported from #M12253)


Files

flashuploader.gif (8.49 KB) flashuploader.gif Administrator Admin, 2009-10-16 17:35
flashuploader.png (6.23 KB) flashuploader.png Henrik Ziegenhain, 2012-08-02 15:45

Related issues

Has duplicate TYPO3 Core - Bug #20968: JS-Error for "Upload Files" in menusClosed2010-08-12

Actions
#1

Updated by Steffen Gebert over 11 years ago

can reproduce this

#2

Updated by Steffen Gebert over 11 years ago

Problem is that initFlashUploader() is not defined in global scope, but only in a local, reachable from the upload-button on top of file_list.
This initFlashUploader() also takes event as parameter, not path, so it differs a bit.

#3

Updated by Lorenz Ulrich over 9 years ago

I just solved the related bug for DAM and think that it's not a problem to solve this bug. If you're OK with my approach I will provide patches for the core. Currently we have this JavaScript in the file list:

if ($GLOBALS['BE_USER']->uc['enableFlashUploader']) {

    $this->doc->JScodeArray['flashUploader'] = '
        if (top.TYPO3.FileUploadWindow.isFlashAvailable()) {
            document.observe("dom:loaded", function() {
                    // monitor the button
                $("button-upload").observe("click", initFlashUploader);
                    function initFlashUploader(event) {
                        // set the page specific options for the flashUploader
                    var flashUploadOptions = {
                        uploadURL:           top.TS.PATH_typo3 + "ajax.php",
                        uploadFileSizeLimit: "' . t3lib_div::getMaxUploadFileSize() . '",
                        uploadFileTypes: {
                            allow:  "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['allow'] . '",
                            deny: "' . $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace']['deny'] . '" 
                        },
                        uploadFilePostName:  "upload_1",
                        uploadPostParams: {
                            "file[upload][1][target]": "' . $this->id . '",
                            "file[upload][1][data]": 1,
                            "file[upload][1][charset]": "utf-8",
                            "ajaxID": "TYPO3_tcefile::process" 
                        }
                    };

                        // get the flashUploaderWindow instance from the parent frame
                    var flashUploader = top.TYPO3.FileUploadWindow.getInstance(flashUploadOptions);
                        // add an additional function inside the container to show the checkbox option
                    var infoComponent = new top.Ext.Panel({
                        autoEl: { tag: "div" },
                        height: "auto",
                        bodyBorder: false,
                        border: false,
                        hideBorders: true,
                        cls: "t3-upload-window-infopanel",
                        id: "t3-upload-window-infopanel-addition",
                        html: \'<label for="overrideExistingFilesCheckbox"><input id="overrideExistingFilesCheckbox" type="checkbox" onclick="setFlashPostOptionOverwriteExistingFiles(this);" />\' + top.String.format(top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles) + \'</label>\'
                    });
                    flashUploader.add(infoComponent);
                        // do a reload of this frame once all uploads are done
                    flashUploader.on("totalcomplete", function() {
                        window.location.reload();
                    });

                        // this is the callback function that delivers the additional post parameter to the flash application
                    top.setFlashPostOptionOverwriteExistingFiles = function(checkbox) {
                        var uploader = top.TYPO3.getInstance("FileUploadWindow");
                        if (uploader.isVisible()) {
                            uploader.swf.addPostParam("overwriteExistingFiles", (checkbox.checked == true ? 1 : 0));
                        }
                    };

                    event.stop();
                };
            });
        }
    ';
}

This means that the function function initFlashUploader is only available if the event was triggered from a click to a <a id="button-upload">. We can put this function before event observer and it will also be available for direct calling from the context menu.

As for the event or path thing we can take a switch: If it's just a mouse click the the <a>-Tag, we use the target as currently ($this->id), if not, we decode the path and use it:

var target;
if (typeof(event)=="string") {
    target = decodeURIComponent(event);
    alert(target);
} else {
    target = "' . $this->id . '";
}

What do you think?

#4

Updated by Henrik Ziegenhain over 8 years ago

I can confirm this issue for at least 4.5.17 and 4.6.10.

There is a folder-Icon in the upper right corner - upload is also not working here

BTW: I never noticed the folder with its context menu :)

#5

Updated by Gerrit Code Review about 8 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/18480

#6

Updated by Gerrit Code Review about 8 years ago

Patch set 1 for branch TYPO3_6-0 has been pushed to the review server.
It is available at https://review.typo3.org/19211

#7

Updated by Lorenz Ulrich almost 8 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#8

Updated by Gerrit Code Review almost 8 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at https://review.typo3.org/19872

#9

Updated by Ernesto Baschny over 7 years ago

  • Status changed from Under Review to Resolved
  • Target version deleted (0)
  • TYPO3 Version changed from 4.3 to 6.0

Resolved in 6.0.5. Won't backport to 4.5 anymore.

#10

Updated by Benni Mack over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF