From 2d60319e2a0579ec399f89acb63edd7712625d73 Mon Sep 17 00:00:00 2001 From: Thilina Buddika Date: Sun, 12 Aug 2012 18:49:55 +0530 Subject: [PATCH] implementation of PMA_getHtmlForAddColumn() --- libraries/structure.lib.php | 67 +++++++++++++++++++++++++++++++++++-- tbl_structure.php | 34 ++----------------- 2 files changed, 67 insertions(+), 34 deletions(-) diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index a16344a634..ad33a0b11b 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -1516,5 +1516,68 @@ function PMA_getHtmlForSomeLinks($url_query, $tbl_is_view, return $html_output; } -?> - \ No newline at end of file +/** + * Get HTML snippet for "Add column" feature in structure table + * + * @param array $columns_list column list array + * + * @return string $html_output + */ +function PMA_getHtmlForAddColumn($columns_list) +{ + $common_functions = PMA_CommonFunctions::getInstance(); + + $html_output = '
'; + + $html_output .= PMA_generate_common_hidden_inputs( + $GLOBALS['db'], + $GLOBALS['table'] + ); + if ($GLOBALS['cfg']['PropertiesIconic']) { + $html_output .=$common_functions->getImage( + 'b_insrow.png', + __('Add column') + ); + } + $num_fields = ''; + $html_output .= sprintf(__('Add %s column(s)'), $num_fields); + + // 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 .= $common_functions->getRadioFields( + 'field_where', $choices, 'last', false + ); + $html_output .= $column_selector; + $html_output .= '' + . '
'; + + return $html_output; +} + +?> \ No newline at end of file diff --git a/tbl_structure.php b/tbl_structure.php index d3022ca94a..2baa7dd106 100644 --- a/tbl_structure.php +++ b/tbl_structure.php @@ -535,39 +535,9 @@ echo PMA_getHtmlForSomeLinks($url_query, $tbl_is_view, $db_is_information_schema, $tbl_storage_engine, $cfgRelation); if (! $tbl_is_view && ! $db_is_information_schema) { + echo '
'; + echo PMA_getHtmlForAddColumn($columns_list); ?> -
-
- onsubmit="return checkFormElementInRange(this, 'num_fields', '', 1)"> - getImage('b_insrow.png', __('Add column')); - } - echo sprintf(__('Add %s column(s)'), ''); - - // 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'), '') - ); - echo $common_functions->getRadioFields( - 'field_where', $choices, 'last', false - ); - echo $column_selector; - unset($column_selector, $choices); - ?> - -

>