[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_8-24507-ge4bbd02

Rouslan Placella roccivic at users.sourceforge.net
Sun Dec 11 22:20:53 CET 2011


The branch, master has been updated
       via  e4bbd02eefa782f3d8b187deb43c661a67b6b1ec (commit)
       via  93882b9681573502a2a4855f18f1c103dec7a815 (commit)
      from  dbde2f57226a9b9386928281a25f5c53c973e387 (commit)


- Log -----------------------------------------------------------------
commit e4bbd02eefa782f3d8b187deb43c661a67b6b1ec
Author: Rouslan Placella <rouslan at placella.com>
Date:   Sun Dec 11 21:14:37 2011 +0000

    Use PMA_convertFootnotesToTooltips() in ajax user editor

commit 93882b9681573502a2a4855f18f1c103dec7a815
Author: Rouslan Placella <rouslan at placella.com>
Date:   Sun Dec 11 21:10:51 2011 +0000

    Improved export user functionality with ajax

-----------------------------------------------------------------------

Summary of changes:
 js/server_privileges.js |   37 +++++++++++++++++++++++++------------
 server_privileges.php   |   14 +++++++++-----
 2 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/js/server_privileges.js b/js/server_privileges.js
index eb8b3b3..c6636f3 100644
--- a/js/server_privileges.js
+++ b/js/server_privileges.js
@@ -366,7 +366,7 @@ $(document).ready(function() {
 
         var token = $(this).parents('form').find('input[name="token"]').val();
         $.get($(this).attr('href'), {'ajax_request':true, 'edit_user_dialog': true, 'token': token}, function(data) {
-            $('<div id="edit_user_dialog"></div>')
+            var $div = $('<div id="edit_user_dialog"></div>')
             .append(data)
             .dialog({
                 width: 900,
@@ -375,6 +375,7 @@ $(document).ready(function() {
             }); //dialog options end
             displayPasswordGenerateButton();
             PMA_ajaxRemoveMessage($msgbox);
+            PMA_convertFootnotesToTooltips($div);
         }) // end $.get()
     })
 
@@ -467,27 +468,39 @@ $(document).ready(function() {
      * @name        export_user_click
      */
     $(".export_user_anchor.ajax").live('click', function(event) {
-        /** @lends jQuery */
         event.preventDefault();
-
         var $msgbox = PMA_ajaxShowMessage();
-
         /**
          * @var button_options  Object containing options for jQueryUI dialog buttons
          */
         var button_options = {};
-        button_options[PMA_messages['strClose']] = function() {$(this).dialog("close").remove();}
-
+        button_options[PMA_messages['strClose']] = function() {
+            $(this).dialog("close");
+        };
         $.get($(this).attr('href'), {'ajax_request': true}, function(data) {
-            $('<div id="export_dialog"></div>')
-            .prepend(data)
+            var $ajaxDialog = $('<div />')
+            .append(data.message)
             .dialog({
-                width : 500,
-                buttons: button_options
+                title: data.title,
+                width: 500,
+                buttons: button_options,
+                close: function () {
+                    $(this).remove();
+                }
             });
             PMA_ajaxRemoveMessage($msgbox);
-        }) //end $.get
-    }) //end export privileges
+            // Attach syntax highlited editor to export dialog
+            CodeMirror.fromTextArea(
+                $ajaxDialog.find('textarea')[0],
+                {
+                    lineNumbers: true,
+                    matchBrackets: true,
+                    indentUnit: 4,
+                    mode: "text/x-mysql"
+                }
+            );
+        }); //end $.get
+    }); //end export privileges
 
     /**
      * AJAX handler to Paginate the Users Table
diff --git a/server_privileges.php b/server_privileges.php
index 46487fd..14ad7e6 100644
--- a/server_privileges.php
+++ b/server_privileges.php
@@ -16,6 +16,8 @@ require_once './libraries/common.inc.php';
 $GLOBALS['js_include'][] = 'server_privileges.js';
 $GLOBALS['js_include'][] = 'functions.js';
 $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.16.custom.js';
+$GLOBALS['js_include'][] = 'codemirror/lib/codemirror.js';
+$GLOBALS['js_include'][] = 'codemirror/mode/mysql/mysql.js';
 $_add_user_error = false;
 
 require './libraries/server_common.inc.php';
@@ -1540,16 +1542,18 @@ if (isset($viewing_mode) && $viewing_mode == 'db') {
 
 // export user definition
 if (isset($_REQUEST['export'])) {
-    echo '<h2>' . __('User') . ' \'' . htmlspecialchars($username) . '\'@\'' . htmlspecialchars($hostname) . '\'</h2>';
-    echo '<textarea cols="' . $GLOBALS['cfg']['TextareaCols'] . '" rows="' . $GLOBALS['cfg']['TextareaRows'] . '">';
+    $title = __('User') . ' `' . htmlspecialchars($username) . '`@`' . htmlspecialchars($hostname) . '`';
+    $response = '<textarea cols="' . $GLOBALS['cfg']['TextareaCols'] . '" rows="' . $GLOBALS['cfg']['TextareaRows'] . '">';
     $grants = PMA_DBI_fetch_result("SHOW GRANTS FOR '" . PMA_sqlAddSlashes($username) . "'@'" . PMA_sqlAddSlashes($hostname) . "'");
     foreach ($grants as $one_grant) {
-        echo $one_grant . ";\n\n";
+        $response .= $one_grant . ";\n\n";
     }
-    echo '</textarea>';
+    $response .= '</textarea>';
     unset($username, $hostname, $grants, $one_grant);
     if ($GLOBALS['is_ajax_request']) {
-        exit;
+        PMA_ajaxResponse($response, 1, array('title' => $title));
+    } else {
+        echo "<h2>$title</h2>$response";
     }
 }
 


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list