diff --git a/js/server_privileges.js b/js/server_privileges.js index 9ac5a8304..b4c8b532b 100755 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -105,3 +105,34 @@ function suggestPassword(passwd_form) { * Paginate table of users * Flush privileges */ +$(document).ready(function() { + + /** + * Attach AJAX event handlers to 'Add a New User' + * + * @todo create standard options for dialog boxes + */ + $("#fieldset_add_user a").click(function(event) { + event.preventDefault(); + + PMA_ajaxShowMessage(); + + $(this).append('
'); + var add_user_url = $(this).attr("href"); + //add_user_url += "&ajax_request=true"; + $.get(add_user_url, {'ajax_request':true}, function(data) { + $("#add_user_dialog").prepend(data).dialog({ + title: 'Add a New User', + width: 800, + modal: true, + buttons: {"Create User": function() { + //code here to submit the form + }, + "Cancel": function() {$(this).dialog("close")} + } //buttons end + }); //dialog options end + }); + + });//end of Add New User AJAX event handler + +}); //end $(document).ready() \ No newline at end of file diff --git a/server_privileges.php b/server_privileges.php index a17f48576..b7436ed40 100755 --- a/server_privileges.php +++ b/server_privileges.php @@ -16,6 +16,7 @@ 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.custom.js'; require './libraries/server_common.inc.php'; @@ -1982,6 +1983,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs } } } elseif (isset($_REQUEST['adduser'])) { + // Add a new user $GLOBALS['url_query'] .= '&adduser=1'; echo '

' . "\n"