Ajaxified Create Database action. Have to append newly created db to table yet though

This commit is contained in:
ninadsp
2010-07-31 02:25:29 +05:30
parent b19fa7c60f
commit e6f083c703
3 changed files with 33 additions and 1 deletions

View File

@@ -41,6 +41,11 @@ if (! $result) {
// avoid displaying the not-created db name in header or navi panel // avoid displaying the not-created db name in header or navi panel
$GLOBALS['db'] = ''; $GLOBALS['db'] = '';
$GLOBALS['table'] = ''; $GLOBALS['table'] = '';
if($GLOBALS['is_ajax_request'] == true) {
PMA_ajaxResponse($message, FALSE);
}
require_once './libraries/header.inc.php'; require_once './libraries/header.inc.php';
require_once './main.php'; require_once './main.php';
} else { } else {
@@ -48,6 +53,10 @@ if (! $result) {
$message->addParam($new_db); $message->addParam($new_db);
$GLOBALS['db'] = $new_db; $GLOBALS['db'] = $new_db;
if($GLOBALS['is_ajax_request'] == true) {
PMA_ajaxResponse($message, true);
}
require_once './libraries/header.inc.php'; require_once './libraries/header.inc.php';
require_once './' . $cfg['DefaultTabDatabase']; require_once './' . $cfg['DefaultTabDatabase'];
} }

View File

@@ -2050,3 +2050,26 @@ $(document).ready(function() {
}); });
}); //end of Drop Database Ajax action }); //end of Drop Database Ajax action
}) })
/**
* jQuery coding for 'Create Database'. Used wherever libraries/
* display_create_database.lib.php is used, ie main.php and server_databases.php
*/
$(document).ready(function() {
$('#create_database_form').live('submit', function(event) {
event.preventDefault();
PMA_ajaxShowMessage(PMA_messages['strProcessingRequest']);
$(this).append('<input type="hidden" name="ajax_request" value="true" />');
$.post($(this).attr('action'), $(this).serialize(), function(data) {
if(data.success == true) {
PMA_ajaxShowMessage(data.message);
}
else {
PMA_ajaxShowMessage(data.error);
}
})
})
})

View File

@@ -17,7 +17,7 @@ require_once './libraries/check_user_privileges.lib.php';
if ($is_create_db_priv) { if ($is_create_db_priv) {
// The user is allowed to create a db // The user is allowed to create a db
?> ?>
<form method="post" action="db_create.php"><strong> <form method="post" action="db_create.php" id="create_database_form" ><strong>
<?php echo '<label for="text_create_db">' . __('Create new database') . '</label>&nbsp;' . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br /> <?php echo '<label for="text_create_db">' . __('Create new database') . '</label>&nbsp;' . PMA_showMySQLDocu('SQL-Syntax', 'CREATE_DATABASE'); ?></strong><br />
<?php echo PMA_generate_common_hidden_inputs('', '', 5); ?> <?php echo PMA_generate_common_hidden_inputs('', '', 5); ?>
<input type="hidden" name="reload" value="1" /> <input type="hidden" name="reload" value="1" />