Studio-42 / elFinder

📁 Open-source file manager for web, written in JavaScript using jQuery and jQuery UI
https://studio-42.github.io/elFinder/
Other
4.65k stars 1.42k forks source link

Disable Drag and Drop #597

Closed YuccaOne closed 11 years ago

YuccaOne commented 11 years ago

Hi, I would like to disable drag'n drop for upload file. I try with dragUploadAllow : false and dragUploadAllow : 'false' js parameters, but it seems doesn't work. Thanks

ChuckNorrison commented 11 years ago

You are right, the Client Option "dragUploadAllow : false" dont work as expected.

i have fixed it like this:

if (this.transport.upload == 'iframe') {
    this.transport.upload = $.proxy(this.uploads.iframe, this);
} else if (typeof(this.transport.upload) == 'function') {
    this.dragUpload = !!this.options.dragUploadAllow;
} else if (this.xhrUpload) {
    this.transport.upload = $.proxy(this.uploads.xhr, this);
    this.dragUpload = true;
} else {
    this.transport.upload = $.proxy(this.uploads.iframe, this);
}

change it to:

if (this.transport.upload == 'iframe') {
    this.transport.upload = $.proxy(this.uploads.iframe, this);
} else if (typeof(this.transport.upload) == 'function') {
    this.dragUpload = !!this.options.dragUploadAllow;
} else if (this.xhrUpload) {
    this.transport.upload = $.proxy(this.uploads.xhr, this);
    if (this.options.dragUploadAllow != false) {
        this.dragUpload = true;
    }
} else {
    this.transport.upload = $.proxy(this.uploads.iframe, this);
}

i can make a pull request for

Here it is: https://github.com/ChuckNorrison/elFinder/commit/8dda8ab8d956abb1c4ea080902fcba174ae1c644

I dont understand the pull request system, he updated my other pull request with it... all my individual changes are now in https://github.com/Studio-42/elFinder/pull/588 :(

If someone can explain me how to control that stuff to pull specified changes and not all, i can stop this chaos... iam sorry

nao-pon commented 11 years ago

I think this...

    if (this.transport.upload == 'iframe') {
        this.transport.upload = $.proxy(this.uploads.iframe, this);
    } else if (typeof(this.transport.upload) == 'function') {
        this.dragUpload = !!this.options.dragUploadAllow;
    } else if (this.xhrUpload) {
        this.transport.upload = $.proxy(this.uploads.xhr, this);
        this.dragUpload = true;
    } else {
        this.transport.upload = $.proxy(this.uploads.iframe, this);
    }

to

    if (this.transport.upload == 'iframe') {
        this.transport.upload = $.proxy(this.uploads.iframe, this);
    } else if (typeof(this.transport.upload) == 'function') {
        this.dragUpload = !!this.options.dragUploadAllow;
    } else if (this.xhrUpload && !!this.options.dragUploadAllow) {
        this.transport.upload = $.proxy(this.uploads.xhr, this);
        this.dragUpload = true;
    } else {
        this.transport.upload = $.proxy(this.uploads.iframe, this);
    }

How about this?


To Chuck, I recommend you to divide a brunch for every Pull Request. ;-)

YuccaOne commented 11 years ago

Re, I test nao-pon solution (sorry ChuckNorrison) and it works. Thanks

ChuckNorrison commented 11 years ago

OK seems the better solution :) I will test these branches in future, thx :P