From 048c2d87ab463401cd252cd8fbb6d8ed92570dd4 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 8 Dec 2012 09:34:28 -0500 Subject: [PATCH] Partial fix for bug #3593138. Still need to find how to go back to tbl_structure.php after the ALTER TABLE has been executed. --- libraries/mult_submits.inc.php | 6 ++-- libraries/tbl_properties.inc.php | 59 ++++++++++++++++++++------------ tbl_alter.php | 2 +- tbl_structure.php | 4 +++ 4 files changed, 47 insertions(+), 24 deletions(-) diff --git a/libraries/mult_submits.inc.php b/libraries/mult_submits.inc.php index f5e6d1e7b0..8eddf7db91 100644 --- a/libraries/mult_submits.inc.php +++ b/libraries/mult_submits.inc.php @@ -126,7 +126,9 @@ if (! empty($submit_mult) break; case 'change': include './tbl_alter.php'; - break; + // execution stops here but PMA_Response correctly finishes + // the rendering + exit; case 'browse': // this should already be handled by tbl_structure.php } @@ -343,7 +345,7 @@ if (!empty($submit_mult) && !empty($what)) { } exit; -} elseif ($mult_btn == __('Yes')) { +} elseif (! empty($mult_btn) && $mult_btn == __('Yes')) { /** * Executes the query - dropping rows, columns/fields, tables or dbs */ diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 9b8351230b..c3224ff3e1 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -27,6 +27,16 @@ require_once './libraries/StorageEngine.class.php'; */ require_once './libraries/Partition.class.php'; +/** + * We are in transition between old-style echo and new-style PMA_Response + * so this script generates $html and at the bottom, either echos it + * or uses addHTML on it. + * + * Initialize $html in case this variable was used by a caller + * (yes, this script should be refactored into functions) + */ +$html = ''; + $length_values_input_size = 8; $_form_params = array( @@ -706,7 +716,7 @@ for ($i = 0; $i < $num_fields; $i++) { } } // end for -echo '' +$html .= '' . '' . '// ]]>' . ''; -echo '
'; -echo PMA_generate_common_hidden_inputs($_form_params); +$html .= PMA_generate_common_hidden_inputs($_form_params); unset($_form_params); if ($action == 'tbl_create.php') { - echo '' + $html .= '
' . '' . '' + $html .= '' . '' . '
' . __('Table name') . ': ' ); - echo ''; } - echo '
'; } @@ -756,29 +766,29 @@ if (is_array($content_cells) && is_array($header_cells)) { // last row is for javascript insert //$empty_row = array_pop($content_cells); - echo ''; - echo '
' . __('Structure') + $html .= ''; + $html .= ''; - echo ''; + $html .= ''; foreach ($header_cells as $header_val) { - echo ''; + $html .= ''; } - echo ''; + $html .= ''; $odd_row = true; foreach ($content_cells as $content_row) { - echo ''; + $html .= ''; $odd_row = ! $odd_row; if (is_array($content_row)) { foreach ($content_row as $content_row_val) { - echo ''; + $html .= ''; } } - echo ''; + $html .= ''; } - echo '
' . __('Structure') . PMA_Util::showMySQLDocu('SQL-Syntax', 'CREATE_TABLE') . '
' . $header_val . '' . $header_val . '
' . $content_row_val . '' . $content_row_val . '
' + $html .= '
' . '
'; } @@ -820,7 +830,7 @@ function addField() */ if ($action == 'tbl_create.php') { - echo '' + $html .= '
' . '' . '' . '' @@ -861,7 +871,7 @@ if ($action == 'tbl_create.php') { . ''; if (PMA_Partition::havePartitioning()) { - echo '' + $html .= '' . '' @@ -879,14 +889,21 @@ if ($action == 'tbl_create.php') { . '' . ''; } - echo '
' . __('Table comments') . ':  
' . __('PARTITION definition') . ': ' . PMA_Util::showMySQLDocu('Partitioning', 'Partitioning') . '
' + $html .= '' . '
'; } // end if ($action == 'tbl_create.php') -echo '
' +$html .= '
' . '' . '
' . '
' . ''; -echo ''; +$html .= ''; + +// here we expect that the convention of using $response was applied +if (isset($response)) { + $response->addHTML($html); +} else { + echo $html; +} diff --git a/tbl_alter.php b/tbl_alter.php index 8275d616cb..40119e4387 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -242,7 +242,7 @@ if (isset($_REQUEST['do_save_data'])) { } } - if ($GLOBALS['is_ajax_request']) { + if ($response->isAjax()) { $response = PMA_Response::getInstance(); $response->isSuccess($message->isSuccess()); $response->addJSON('message', $message); diff --git a/tbl_structure.php b/tbl_structure.php index 6357c61f5b..c96e02c344 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -76,6 +76,10 @@ if (! empty($submit_mult) && isset($_REQUEST['selected_fld'])) { // handle confirmation of deleting multiple fields/columns $action = 'tbl_structure.php'; include 'libraries/mult_submits.inc.php'; + /** + * if $submit_mult == 'change', execution will have stopped + * at this point + */ if (empty($message)) { $message = PMA_Message::success();