diff --git a/js/server_privileges.js b/js/server_privileges.js index 7214d74dbe..2c9e83a375 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -473,6 +473,57 @@ $(document).ready(function() { * @memberOf jQuery * @name export_user_click */ + $("button.mult_submit[value=export]").live('click', function(event) { + event.preventDefault(); + // can't export if no users checked + if ($(this.form).find("input:checked").length == 0) { + return; + } + var $msgbox = PMA_ajaxShowMessage(); + var button_options = {}; + button_options[PMA_messages['strClose']] = function() { + $(this).dialog("close"); + }; + $.post($(this.form).prop('action'), + $(this.form).serialize() + '&submit_mult=export&ajax_request=true', + function(data) { + var $ajaxDialog = $('
') + .append(data.message) + .dialog({ + title: data.title, + width: 500, + buttons: button_options, + close: function () { + $(this).remove(); + } + }); + PMA_ajaxRemoveMessage($msgbox); + // Attach syntax highlited editor to export dialog + CodeMirror.fromTextArea( + $ajaxDialog.find('textarea')[0], + { + lineNumbers: true, + matchBrackets: true, + indentUnit: 4, + mode: "text/x-mysql" + } + ); + }); //end $.post + }); + // if exporting non-ajax, highlight anyways + if ($("textarea.export").length > 0) + { + CodeMirror.fromTextArea( + $('textarea.export')[0], + { + lineNumbers: true, + matchBrackets: true, + indentUnit: 4, + mode: "text/x-mysql" + } + ); + } + $(".export_user_anchor.ajax").live('click', function(event) { event.preventDefault(); var $msgbox = PMA_ajaxShowMessage(); diff --git a/server_privileges.php b/server_privileges.php index f3bcc41824..9106249630 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -1528,14 +1528,15 @@ $link_export_all = '' - . PMA_getIcon('b_tblexport.png', __('Export all')) + . PMA_getIcon('b_tblexport.png', __('Export all')) . ' ' + . __('Export all') . ''; /** * If we are in an Ajax request for Create User/Edit User/Revoke User/ * Flush Privileges, show $message and exit. */ -if ($GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['adduser']) || $_add_user_error) && ! isset($_REQUEST['initial']) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog']) && ! isset($_REQUEST['db_specific'])) { +if ($GLOBALS['is_ajax_request'] && ! isset($_REQUEST['export']) && (! isset($_REQUEST['submit_mult']) || $_REQUEST['submit_mult'] != 'export') && (! isset($_REQUEST['adduser']) || $_add_user_error) && ! isset($_REQUEST['initial']) && ! isset($_REQUEST['showall']) && ! isset($_REQUEST['edit_user_dialog']) && ! isset($_REQUEST['db_specific'])) { if (isset($sql_query)) { $extra_data['sql_query'] = PMA_showMessage(null, $sql_query); @@ -1623,8 +1624,8 @@ if (isset($viewing_mode) && $viewing_mode == 'db') { */ // export user definition -if (isset($_REQUEST['export'])) { - $response = ''; unset($username, $hostname, $grants, $one_grant); if ($GLOBALS['is_ajax_request']) { @@ -1863,7 +1879,14 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs .'' . __('Uncheck All') . '' . "\n" - . '
' + .'' . __('With selected:') . '' . "\n"; + + PMA_buttonOrImage( + 'submit_mult', 'mult_submit', 'submit_mult_export', + __('Export'), 'b_tblexport.png', 'export' + ); + echo ''; + echo '' . '
' . '
'; printf($link_export_all, urlencode('%'), urlencode('%'), (isset($initial) ? $initial : ''));