auto get back to the Table Operations tab

This commit is contained in:
Atul Pratap Singh
2011-03-27 18:04:08 +05:30
committed by Michal Čihař
parent 6adfdb3b44
commit 6acf4acd25
3 changed files with 44 additions and 21 deletions

View File

@@ -932,5 +932,7 @@ window.onload = function()
/** /**
* Displays the footer * Displays the footer
*/ */
require './libraries/footer.inc.php'; if(!isset($_REQUEST['table_maintenance'])) {
require './libraries/footer.inc.php';
}
?> ?>

View File

@@ -45,9 +45,9 @@ if (PMA_isValid($_REQUEST['new_name'])) {
} else { } else {
$message = PMA_Message::error(__('Can\'t copy table to same one!')); $message = PMA_Message::error(__('Can\'t copy table to same one!'));
} }
$goto = './tbl_operations.php'; $result = false;
} else { } else {
PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'], $result = PMA_Table::moveCopy($db, $table, $_REQUEST['target_db'], $_REQUEST['new_name'],
$_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table'); $_REQUEST['what'], isset($_REQUEST['submit_move']), 'one_table');
if (isset($_REQUEST['submit_move'])) { if (isset($_REQUEST['submit_move'])) {
@@ -66,23 +66,18 @@ if (PMA_isValid($_REQUEST['new_name'])) {
$table = $_REQUEST['new_name']; $table = $_REQUEST['new_name'];
} }
$reload = 1; $reload = 1;
$disp_query = $sql_query;
$disp_message = $message;
unset($sql_query, $message);
$goto = $cfg['DefaultTabTable'];
} }
} else { } else {
/** /**
* No new name for the table! * No new name for the table!
*/ */
$message = PMA_Message::error(__('The table name is empty!')); $message = PMA_Message::error(__('The table name is empty!'));
$goto = './tbl_operations.php'; $result = false;
} }
/** /**
* Back to the calling script * Back to the calling script
*/ */
require $goto; $_message = $message;
unset($message);
?> ?>

View File

@@ -63,6 +63,20 @@ if ($is_aria) {
$reread_info = false; $reread_info = false;
$table_alters = array(); $table_alters = array();
/**
* If the table has to be moved to some other database
*/
if(isset($_REQUEST['submit_move']) || isset($_REQUEST['submit_copy'])) {
$_message = '';
require_once './tbl_move_copy.php';
}
/**
* If the table has to be maintained
*/
if(isset($_REQUEST['table_maintenance'])) {
require_once './sql.php';
unset($result);
}
/** /**
* Updates table comment, type and options if required * Updates table comment, type and options if required
*/ */
@@ -266,7 +280,7 @@ unset($columns);
<!-- Move table --> <!-- Move table -->
<div id="div_table_rename"> <div id="div_table_rename">
<form method="post" action="tbl_move_copy.php" <form method="post" action="tbl_operations.php"
onsubmit="return emptyFormElements(this, 'new_name')"> onsubmit="return emptyFormElements(this, 'new_name')">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<input type="hidden" name="reload" value="1" /> <input type="hidden" name="reload" value="1" />
@@ -505,7 +519,7 @@ if (isset($possible_row_formats[$tbl_type])) {
<!-- Copy table --> <!-- Copy table -->
<div id="div_table_copy"> <div id="div_table_copy">
<form method="post" action="tbl_move_copy.php" <form method="post" action="tbl_operations.php"
onsubmit="return emptyFormElements(this, 'new_name')"> onsubmit="return emptyFormElements(this, 'new_name')">
<?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?> <?php echo PMA_generate_common_hidden_inputs($GLOBALS['db'], $GLOBALS['table']); ?>
<input type="hidden" name="reload" value="1" /> <input type="hidden" name="reload" value="1" />
@@ -577,9 +591,12 @@ if (isset($possible_row_formats[$tbl_type])) {
if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) { if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
if ($is_myisam_or_aria || $is_innodb) { if ($is_myisam_or_aria || $is_innodb) {
$this_url_params = array_merge($url_params, $this_url_params = array_merge($url_params,
array('sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table']))); array(
'sql_query' => 'CHECK TABLE ' . PMA_backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
));
?> ?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>"> <li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Check table'); ?></a> <?php echo __('Check table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'CHECK_TABLE'); ?>
</li> </li>
@@ -597,9 +614,12 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
} }
if ($is_myisam_or_aria || $is_berkeleydb) { if ($is_myisam_or_aria || $is_berkeleydb) {
$this_url_params = array_merge($url_params, $this_url_params = array_merge($url_params,
array('sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table']))); array(
'sql_query' => 'ANALYZE TABLE ' . PMA_backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
));
?> ?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>"> <li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Analyze table'); ?></a> <?php echo __('Analyze table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'ANALYZE_TABLE');?>
</li> </li>
@@ -607,9 +627,12 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
} }
if ($is_myisam_or_aria) { if ($is_myisam_or_aria) {
$this_url_params = array_merge($url_params, $this_url_params = array_merge($url_params,
array('sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table']))); array(
'sql_query' => 'REPAIR TABLE ' . PMA_backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
));
?> ?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>"> <li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Repair table'); ?></a> <?php echo __('Repair table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'REPAIR_TABLE'); ?>
</li> </li>
@@ -617,9 +640,12 @@ if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
} }
if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) { if ($is_myisam_or_aria || $is_innodb || $is_berkeleydb) {
$this_url_params = array_merge($url_params, $this_url_params = array_merge($url_params,
array('sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table']))); array(
'sql_query' => 'OPTIMIZE TABLE ' . PMA_backquote($GLOBALS['table']),
'table_maintenance' => 'Go',
));
?> ?>
<li><a href="sql.php<?php echo PMA_generate_common_url($this_url_params); ?>"> <li><a href="tbl_operations.php<?php echo PMA_generate_common_url($this_url_params); ?>">
<?php echo __('Optimize table'); ?></a> <?php echo __('Optimize table'); ?></a>
<?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?> <?php echo PMA_showMySQLDocu('MySQL_Database_Administration', 'OPTIMIZE_TABLE'); ?>
</li> </li>