From e0e3c0e84fa04539cc760c879616eb9d4387cf2d Mon Sep 17 00:00:00 2001 From: Smita Kumari Date: Tue, 13 Jan 2015 20:24:56 +0530 Subject: [PATCH 1/6] FRE #1568: fold add column position radio into one 'add column after' dropdown Signed-off-by: Smita Kumari --- js/tbl_structure.js | 10 ++++++++++ libraries/create_addfield.lib.php | 8 ++------ libraries/structure.lib.php | 26 +++++++++++++------------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 583adfc64b..28ef9faecf 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -66,6 +66,13 @@ function reloadFieldForm() { $('#page_content').show(); } +function checkFirst() { + if ($("select[name=after_field] option:selected").data('pos') === 'first') { + $("input[name=field_where]").val('first'); + } else { + $("input[name=field_where]").val('after'); + } +} /** * Unbind all event handlers before tearing down a page */ @@ -87,6 +94,9 @@ AJAX.registerOnload('tbl_structure.js', function () { indexes = []; fulltext_indexes = []; + //by default select the last option to add new column (adds at end of the table) + $("select[name=after_field] option:last").attr("selected","selected"); + /** *Ajax action for submitting the "Column Change" and "Add Column" form */ diff --git a/libraries/create_addfield.lib.php b/libraries/create_addfield.lib.php index 9969d6bd64..25ee55f9da 100644 --- a/libraries/create_addfield.lib.php +++ b/libraries/create_addfield.lib.php @@ -99,10 +99,6 @@ function PMA_setColumnCreationStatementSuffix($current_field_num, return $sql_suffix; } - if ($_REQUEST['field_where'] == 'last') { - return $sql_suffix; - } - // Only the first field can be added somewhere other than at the end if ($current_field_num == 0) { if ($_REQUEST['field_where'] == 'first') { @@ -177,7 +173,7 @@ function PMA_getStatementPrefix($is_create_tbl = true) } /** - * Merge index definitions for one type of index + * Merge index definitions for one type of index * * @param array $definitions the index definitions to merge to * @param boolean $is_create_tbl true if requirement is to get the statement @@ -185,7 +181,7 @@ function PMA_getStatementPrefix($is_create_tbl = true) * @param array $indexed_columns the columns for one type of index * @param string $index_keyword the index keyword to use in the definition * - * @return array $index_definitions + * @return array $index_definitions */ function PMA_mergeIndexStatements( $definitions, $is_create_tbl, $indexed_columns, $index_keyword diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index efc7288f46..17ed1d7fb4 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -1069,7 +1069,9 @@ function PMA_getServerSlaveStatus($server_slave_status, $truename) if ((strlen($searchTable) > 0) || strlen($searchDb) > 0) { $ignored = true; } - foreach ($GLOBALS['replication_info']['slave']['Wild_Ignore_Table'] as $db_table) { + foreach ( + $GLOBALS['replication_info']['slave']['Wild_Ignore_Table'] as $db_table + ) { $table_part = PMA_extractDbOrTable($db_table, 'table'); $pattern = "@^" . /*overload*/mb_substr($table_part, 0, -1) @@ -1698,9 +1700,12 @@ function PMA_getHtmlForAddColumn($columns_list) // I tried displaying the drop-down inside the label but with Firefox // the drop-down was blinking $column_selector = ''; - - $choices = array( - 'last' => __('At End of Table'), - 'first' => __('At Beginning of Table'), - 'after' => sprintf(__('After %s'), '') - ); - $html_output .= PMA_Util::getRadioFields( - 'field_where', $choices, 'last', false - ); + $html_output .= ''; + $html_output .= ' ' . __('after') . ' '; $html_output .= $column_selector; $html_output .= '' . ''; @@ -2847,7 +2845,9 @@ function PMA_displayTableBrowseForSelectedColumns($db, $table, $goto, */ function PMA_checkFavoriteTable($db, $current_table) { - foreach ($_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']] as $key => $value) { + foreach ( + $_SESSION['tmpval']['favorite_tables'][$GLOBALS['server']] as $key => $value + ) { if ($value['db'] == $db && $value['table'] == $current_table) { return true; } From 5fa0cef84c648a16236d725f7d96abf88d99edd0 Mon Sep 17 00:00:00 2001 From: Smita Kumari Date: Tue, 13 Jan 2015 23:47:30 +0530 Subject: [PATCH 2/6] change text Signed-off-by: Smita Kumari --- libraries/structure.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index 17ed1d7fb4..83af261466 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -1704,7 +1704,7 @@ function PMA_getHtmlForAddColumn($columns_list) $column_selector .= ''; foreach ($columns_list as $one_column_name) { $column_selector .= '