From 589d918ee7e4e747ce55f2f0c0905bc8d6fe1dc9 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 8 Feb 2011 17:36:05 -0500 Subject: [PATCH 1/4] Errors from the Ajax create table dialog where not displayed --- js/functions.js | 3 ++- libraries/tbl_properties.inc.php | 2 +- tbl_create.php | 16 ++++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/js/functions.js b/js/functions.js index 4fcfb1d72..57b4644e5 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1743,6 +1743,7 @@ $(document).ready(function() { //User wants to submit the form $.post($form.attr('action'), $form.serialize() + "&do_save_data=" + $(this).val(), function(data) { if(data.success == true) { + $('#properties_message').html(''); PMA_ajaxShowMessage(data.message); $("#create_table_dialog").dialog("close").remove(); @@ -1794,7 +1795,7 @@ $(document).ready(function() { } } else { - PMA_ajaxShowMessage(data.error); + $('#properties_message').html(data.error); } }) // end $.post() }) // end create table form (save) diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 4bc1029af..14e493651 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -786,7 +786,7 @@ if ($action == 'tbl_create.php') { /> - +
diff --git a/tbl_create.php b/tbl_create.php index 6d569b50d..4d3171ad9 100644 --- a/tbl_create.php +++ b/tbl_create.php @@ -350,12 +350,16 @@ if (isset($_REQUEST['do_save_data'])) { } exit; } else { - PMA_mysqlDie('', '', '', $err_url, false); - // An error happened while inserting/updating a table definition. - // to prevent total loss of that data, we embed the form once again. - // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php - $num_fields = $_REQUEST['orig_num_fields']; - $regenerate = true; + if ($GLOBALS['is_ajax_request'] == true) { + PMA_ajaxResponse(PMA_DBI_getError(), false); + } else { + PMA_mysqlDie('', '', '', $err_url, false); + // An error happened while inserting/updating a table definition. + // to prevent total loss of that data, we embed the form once again. + // The variable $regenerate will be used to restore data in libraries/tbl_properties.inc.php + $num_fields = $_REQUEST['orig_num_fields']; + $regenerate = true; + } } } // end do create table From a9845254cb7d6b41cf047773c84da127ec0e3c21 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 8 Feb 2011 17:52:30 -0500 Subject: [PATCH 2/4] Gain some vertical space in table create form --- themes/darkblue_orange/css/theme_right.css.php | 4 ++++ themes/original/css/theme_right.css.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index 07e786efb..cdc26d51a 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -1360,6 +1360,10 @@ code.sql, div.sqlvalidate { width: 98%; } +textarea#partitiondefinition { + height:3em; +} + /* for elements that should be revealed only via js */ .hide { display: none; diff --git a/themes/original/css/theme_right.css.php b/themes/original/css/theme_right.css.php index 02736c61b..272221d36 100644 --- a/themes/original/css/theme_right.css.php +++ b/themes/original/css/theme_right.css.php @@ -1312,6 +1312,11 @@ code.sql, div.sqlvalidate { width: 98%; } +textarea#partitiondefinition { + height:3em; +} + + /* for elements that should be revealed only via js */ .hide { display: none; From 698126002c0d0d37559e938f0ced5dac56700e7d Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 8 Feb 2011 18:01:03 -0500 Subject: [PATCH 3/4] Avoid notice of undefined index when cookie does not exist --- themes/darkblue_orange/css/theme_right.css.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/darkblue_orange/css/theme_right.css.php b/themes/darkblue_orange/css/theme_right.css.php index cdc26d51a..f364a3cc2 100644 --- a/themes/darkblue_orange/css/theme_right.css.php +++ b/themes/darkblue_orange/css/theme_right.css.php @@ -15,7 +15,8 @@ if (!defined('PMA_MINIMUM_COMMON')) { /******************************************************************************/ /* general tags */ html { - font-size: get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : $_COOKIE['pma_fontsize']); ?>; + font-size: get('fontsize') ? $GLOBALS['PMA_Config']->get('fontsize') : ( + isset($_COOKIE['pma_fontsize']) ? $_COOKIE['pma_fontsize'] : '82%'));?>; } input, select, textarea { From 27e98f45325d21f900fe7284878885f1a27cbfc7 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Tue, 8 Feb 2011 18:37:30 -0500 Subject: [PATCH 4/4] Better name for this function --- js/functions.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/functions.js b/js/functions.js index 57b4644e5..c1a6b263b 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1556,7 +1556,7 @@ function PMA_ajaxShowMessage(message, timeout) { /** * Hides/shows the "Open in ENUM/SET editor" message, depending on the data type of the column currently selected */ -function toggle_enum_notice(selectElement) { +function showNoticeForEnum(selectElement) { var enum_notice_id = selectElement.attr("id").split("_")[1]; enum_notice_id += "_" + (parseInt(selectElement.attr("id").split("_")[2]) + 1); var selectedType = selectElement.attr("value"); @@ -2041,13 +2041,13 @@ $(document).ready(function() { // // needs live() to work also in the Create Table dialog $("select[class='column_type']").live('change', function() { - toggle_enum_notice($(this)); + showNoticeForEnum($(this)); }); }); function PMA_verifyTypeOfAllColumns() { $("select[class='column_type']").each(function() { - toggle_enum_notice($(this)); + showNoticeForEnum($(this)); }); }