Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option to disable drag drop files completely #13155

Closed
ChristianStadler76 opened this Issue Apr 6, 2017 · 12 comments

Comments

Projects
None yet
8 participants
@ChristianStadler76
Copy link

ChristianStadler76 commented Apr 6, 2017

Well, the title should say everything: I'd like to have a configuration option to disable drag and drop files support completely in phpMyAdmin. When I'm importing files I now have to click the 'Choose File'-button and then navigate manually to the file in my file-system in order to circumvent the drag and drop auto-import feature.

@jvitasek

This comment has been minimized.

Copy link

jvitasek commented May 15, 2017

+1

@WouterWidgets

This comment has been minimized.

Copy link

WouterWidgets commented Jun 23, 2017

I totally agree.
I am very used to be able to drag files directly onto an input[type=file] browse button.

Off-topic:
Also, when importing a new database (.sql dump with a CREATE DATABASE statement), the new drag-and-drop functionality won't allow me to upload the file and displays a 'select database first' message.

Workarounds

After doing some digging in the code, I found a way to disable the functionality without touching any code.
If you add an element with class name 'noDragDrop' to the DOM, the functionality is disabled.
For example, you could run the code below from a bookmarklet or from your dev console:

javascript:jQuery('<div class="noDragDrop"></div>').appendTo(document.body);void 0;

I've added it as a bookmarklet, so I can use it on any server's phpMyAdmin.

Alternatively, you could add a return; statement at the top of this method and this method in js/common.js.
This makes the change permanent though.

Regards, Wouter

@jbastan

This comment has been minimized.

Copy link

jbastan commented Jul 1, 2017

To make this permanent, where can I find the js file? Best I can tell, first js file is loaded by PHP here: 3rdparty/phpMyAdmin/js/get_scripts.js.php
on there at line 1058 I see "_dragenter" as the function referencing "if ($(".noDragDrop").length !== 0)"

@jbastan

This comment has been minimized.

Copy link

jbastan commented Jul 1, 2017

I think I found my own solution to this. Since I'm using WHM/Cpanel
Path was here: usr/local/cpanel/base/3rdparty/phpMyAdmin/js
Look at file: common.js at lines 513 - 515
I commented out 3 lines:

// $(document).on('dragenter', PMA_DROP_IMPORT._dragenter);
// $(document).on('dragover', PMA_DROP_IMPORT._dragover);
// $(document).on('dragleave', '.pma_drop_handler', PMA_DROP_IMPORT._dragleave);

tested and all seems to be working as expected.

@eesau

This comment has been minimized.

Copy link

eesau commented Jul 11, 2017

I just accidentally dropped a file to a phpMyAdmin window where it shouldn't have gone. No confirmation whether to import the file. Really lousy user interface design here.

@ibennetch

This comment has been minimized.

Copy link
Member

ibennetch commented Jul 12, 2017

@eesau What do you think the solution to that should be? Would a configuration directive allowing you to disable drag and drop have helped in your situation?

@ibennetch

This comment has been minimized.

Copy link
Member

ibennetch commented Jul 12, 2017

I would support having a configuration directive 'drag_and_drop' or 'drag_and_drop_enabled' that would allow disabling this feature.

@jbastan

This comment has been minimized.

Copy link

jbastan commented Jul 12, 2017

Yes, if there was a toggle in phpMyAdmin along with the other setting, it would solve my issue. I had submitted a ticket to cpanel asking for such feature in future updates, they mostly dragged their feet except for the last person who directed me here.

It's annoying because I have multiple windows open and when I dragged a file too-fast across the browser to my FTP program, it would sometimes crash the phpMyAdmin window since I can't disable/close the gray pop-over. It doesn't always auto-close. Besides, I had no idea why it was listening/expecting a file in the first place (what format, what will it do, etc). Maybe if I was on the [Import] tab, it would be more acceptable to start the listener.

Anyway, my manual fix above solved it for me. I'm happy so far till future updates replace my customization.

@eesau

This comment has been minimized.

Copy link

eesau commented Jul 24, 2017

@ibennetch Yes it would. There are two reasons I want to turn it off:

  1. The obvious situation would be dropping a file containing just "DROP some_important_database;" over a production server phpMyAdmin window by mistake. The database would be dropped without confirmation, which is bad. I didn't destroy an entire database, but imported some test data to a production database, which I had to delete. The Import tab is enough for my needs.

  2. I have phpMyAdmin open all the time in a browser window. When it is in the background, but still visible, dragging a file over the window grays it out with the drop files here text, and this doesn't go away when the dragging continues off the window. I have to reload the page to use phpMyAdmin again. This is frustrating.

@cretace

This comment has been minimized.

Copy link

cretace commented Mar 5, 2018

Has this not been addressed yet?

@jbastan

This comment has been minimized.

Copy link

jbastan commented Mar 6, 2018

correct. I still have to update my files when cpanel makes major changes that replaces my previous edits. Though I've been happy with my solution above (June 30, '17).

nulll-pointer added a commit to nulll-pointer/phpmyadmin that referenced this issue Jun 24, 2018

Add configuration setting to toggle drag drop file Import
This commit-
Adds a configuration directive to toggle drag drop Import feature as requested in phpmyadmin#13155
TODO:
1. Test it on multiple servers.
2. Disable javascript handlers for drag drop

nulll-pointer added a commit to nulll-pointer/phpmyadmin that referenced this issue Jun 24, 2018

Add configuration setting to toggle drag drop file Import
This commit-
Adds a configuration directive to toggle drag drop Import feature as requested in phpmyadmin#13155
TODO:
1. Test it on multiple servers.
2. Disable javascript handlers for drag drop
Signed-Off-By: Lakshay arora <arora.lakshya123@gmail.com>

@ibennetch ibennetch self-assigned this Jun 29, 2018

@ibennetch ibennetch added this to the 5.0.0 milestone Jun 29, 2018

@ibennetch

This comment has been minimized.

Copy link
Member

ibennetch commented Jun 29, 2018

This has been implemented for the upcoming phpMyadmin version 5; If you'd like, you can can test it now on the demo site or with the daily snapshot downloads. Thanks for the suggestion!

@ibennetch ibennetch closed this Jun 29, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.