Skip to content

Commit

Permalink
Add configuration setting to toggle drag drop file Import
Browse files Browse the repository at this point in the history
This commit-
Adds a configuration directive to toggle drag drop Import feature as requested in #13155
TODO:
1. Test it on multiple servers.
2. Disable javascript handlers for drag drop
Signed-Off-By: Lakshay arora <arora.lakshya123@gmail.com>
  • Loading branch information
aroralakshya committed Jun 24, 2018
1 parent ec4911d commit 61163cd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions libraries/classes/Config/Descriptions.php
Expand Up @@ -627,6 +627,10 @@ public static function getString($path, $type = 'name')
. 'This might be a good way to import large files, however it can break '
. 'transactions.'
);
case 'Import_enable_drag_drop_import_name':
return __('Enable drag and drop import');
case 'Import_enable_drag_drop_import_desc':
return __('Uncheck the checkbox to disable drag and drop import');
case 'Import_allow_interrupt_name':
return __('Partial import: allow interrupt');
case 'Import_charset_name':
Expand Down
3 changes: 2 additions & 1 deletion libraries/classes/Config/Forms/User/ImportForm.php
Expand Up @@ -27,7 +27,8 @@ public static function getForms()
'Import/format',
'Import/charset',
'Import/allow_interrupt',
'Import/skip_queries'
'Import/skip_queries',
'Import/enable_drag_drop_import'
],
'Sql' => [
'Import/sql_compatibility',
Expand Down
4 changes: 3 additions & 1 deletion libraries/classes/Navigation/Navigation.php
Expand Up @@ -83,7 +83,9 @@ public function getDisplay()
}
$retval .= '</div>'; //pma_navi_settings_container
$retval .= '</div>'; // pma_navigation_content
$retval .= $this->_getDropHandler();
if($GLOBALS['cfg']['Import']['enable_drag_drop_import'] === true) { //load drag drop handler only if configuration setting is set to true
$retval .= $this->_getDropHandler();
}
$retval .= '</div>'; // pma_navigation
}

Expand Down
8 changes: 8 additions & 0 deletions libraries/config.default.php
Expand Up @@ -2179,6 +2179,14 @@
*/
$cfg['Import']['allow_interrupt'] = true;

/**
* Enable drag and drop import
* @see feature request : https://github.com/phpmyadmin/phpmyadmin/issues/13155
*
* @global bool $cfg['Import']['enable_drag_drop_import']
*/
$cfg['Import']['enable_drag_drop_import'] = true;

/**
*
*
Expand Down

0 comments on commit 61163cd

Please sign in to comment.