A newly added table will now be appended to the tablesForm if it exists.

tbl_create.php generates the necessary output for it.
Need to figure out how to calculate the size and overhead, when stats
are shown.
This commit is contained in:
ninadsp
2010-07-14 01:36:42 +05:30
parent 98a57e2219
commit 10a9e6912c

View File

@@ -40,6 +40,7 @@
*/ */
require_once './libraries/common.inc.php'; require_once './libraries/common.inc.php';
require_once './libraries/Table.class.php'; require_once './libraries/Table.class.php';
require_once './libraries/mysql_charsets.lib.php';
$GLOBALS['js_include'][] = 'functions.js'; $GLOBALS['js_include'][] = 'functions.js';
$action = 'tbl_create.php'; $action = 'tbl_create.php';
@@ -249,7 +250,69 @@ if (isset($_REQUEST['do_save_data'])) {
$message = PMA_Message::success(__('Table %1$s has been created.')); $message = PMA_Message::success(__('Table %1$s has been created.'));
$message->addParam(PMA_backquote($db) . '.' . PMA_backquote($table)); $message->addParam(PMA_backquote($db) . '.' . PMA_backquote($table));
PMA_ajaxResponse($message, $message->isSuccess()); if($GLOBALS['is_ajax_request'] == true) {
//construct the html for the newly created table's row to be appended
$tbl_url_params = array();
$tbl_url_params['db'] = $db;
$tbl_url_params['table'] = $table;
$is_show_stats = $cfg['ShowStats'];
$new_table_string = '<tr>' . "\n";
$new_table_string .= '<td align="center"> <input type="checkbox" id="checkbox_tbl_" name="selected_tbl[]" value="'.htmlspecialchars($table).'" /> </td>' . "\n";
$new_table_string .= '<th>';
$new_table_string .= '<a href="sql.php' . PMA_generate_common_url($tbl_url_params) . '">'. $table . '</a>';
if (PMA_Tracker::isActive()) {
$truename = str_replace(' ', '&nbsp;', htmlspecialchars($table));
if (PMA_Tracker::isTracked($db, $truename)) {
$new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye.png" alt="' . __('Tracking is active.') . '" title="' . __('Tracking is active.') . '" /></a>';
} elseif (PMA_Tracker::getVersion($db, $truename) > 0) {
$new_table_string .= '<a href="tbl_tracking.php' . PMA_generate_common_url($tbl_url_params) . '"><img class="icon" width="14" height="14" src="' . $pmaThemeImage . 'eye_grey.png" alt="' . __('Tracking is not active.') . '" title="' . __('Tracking is not active.') . '" /></a>';
}
unset($truename);
}
$new_table_string .= '</th>' . "\n";
$new_table_string .= '<td> <img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_browse.png" alt="' . __('Browse') . '" title="' . __('Browse') . '" /> </td>' . "\n";
$new_table_string .= '<td> <a href="tbl_structure.php' . PMA_generate_common_url($tbl_url_params) . '"> ';
$new_table_string .= '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_props.png" alt="' . __('Structure') . '" title="' . __('Structure') . '" />';
$new_table_string .= '</a> </td>' . "\n";
$new_table_string .= '<td> <img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_select.png" alt="' . __('Search') . '" title="' . __('Search') . '" /> </td>' . "\n";
$new_table_string .= '<td> <a href="tbl_change.php' . PMA_generate_common_url($tbl_url_params) . '"> ';
$new_table_string .= '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_insrow.png" alt="' . __('Insert') . '" title="' . __('Insert') . '" />';
$new_table_string .= '</a> </td>' . "\n";
$new_table_string .= '<td> <img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'bd_empty.png" alt="' . __('Empty') . '" title="' . __('Empty') . '" /> </td>' . "\n";
$new_table_string .= '<td> <a class="drop_table_anchor" href="sql.php' . PMA_generate_common_url($tbl_url_params) . '&amp;sql_query=';
$new_table_string .= urlencode('DROP TABLE ' . PMA_backquote($table));
$new_table_string .= '">';
$new_table_string .= '<img class="icon" width="16" height="16" src="' .$pmaThemeImage . 'b_drop.png" alt="' . __('Drop') . '" title="' . __('Drop') . '" />';
$new_table_string .= '</a> </td>' . "\n";
$new_table_string .= '<td class="value">0</td>' . "\n"; //In a newly created table, number of rows has to be zero.
$new_table_string .= '<td nowrap="nowrap">' . $_REQUEST['tbl_type'] . '</td>' . "\n";
$new_table_string .= '<td> <dfn title="' . PMA_getCollationDescr($_REQUEST['tbl_collation']) . '">'. $_REQUEST['tbl_collation'] .'</dfn></td>' . "\n";
if($is_show_stats) {
$new_table_string .= '<td class="value"> <a href="tbl_structure.php' . PMA_generate_common_url($tbl_url_params) . '#showusage" > Size </a> </td>' . "\n" ;
$new_table_string .= '<td class="value">-</td>' . "\n" ;
}
$new_table_string .= '</tr>' . "\n";
$extra_data['new_table_string'] = $new_table_string;
PMA_ajaxResponse($message, $message->isSuccess(), $extra_data);
}
$display_query = $sql_query; $display_query = $sql_query;
$sql_query = ''; $sql_query = '';