diff --git a/js/db_structure.js b/js/db_structure.js index a6229c7720..162a6c724e 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -96,7 +96,7 @@ $(document).ready(function() { height: 230, width: 900, modal: true, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, buttons : button_options_error })// end dialog options } else { @@ -107,7 +107,7 @@ $(document).ready(function() { height: 600, width: 900, modal: true, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, buttons : button_options });// end dialog options //Remove the top menu container from the dialog diff --git a/js/functions.js b/js/functions.js index 9dcc20eae1..19ab7ce599 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1517,7 +1517,7 @@ function PMA_createTableDialog( $div, url , target) title: PMA_messages['strCreateTable'], height: 230, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, buttons : button_options_error })// end dialog options //remove the redundant [Back] link in the error message. @@ -1559,7 +1559,7 @@ function PMA_createTableDialog( $div, url , target) top: 0 }); - PMA_verifyTypeOfAllColumns(); + PMA_verifyColumnsProperties(); }, close: function() { $(window).unbind('resize.dialog-resizer'); @@ -2180,7 +2180,7 @@ $(document).ready(function() { if ($("#create_table_div").length > 0) { $("#create_table_div").html(data); } - PMA_verifyTypeOfAllColumns(); + PMA_verifyColumnsProperties(); PMA_ajaxRemoveMessage($msgbox); }) //end $.post() @@ -2540,19 +2540,37 @@ $(document).ready(function() { $(document).ready(function() { // is called here for normal page loads and also when opening // the Create table dialog - PMA_verifyTypeOfAllColumns(); + PMA_verifyColumnsProperties(); // // needs live() to work also in the Create Table dialog $("select[class='column_type']").live('change', function() { PMA_showNoticeForEnum($(this)); }); + $(".default_type").live('change', function() { + PMA_hideShowDefaultValue($(this)); + }); }); -function PMA_verifyTypeOfAllColumns() +function PMA_verifyColumnsProperties() { $("select[class='column_type']").each(function() { PMA_showNoticeForEnum($(this)); }); + $(".default_type").each(function() { + PMA_hideShowDefaultValue($(this)); + }); +} + +/** + * Hides/shows the default value input field, depending on the default type + */ +function PMA_hideShowDefaultValue($default_type) +{ + if ($default_type.val() == 'USER_DEFINED') { + $default_type.siblings('.default_value').show().focus(); + } else { + $default_type.siblings('.default_value').hide(); + } } /** diff --git a/js/sql.js b/js/sql.js index d729677a92..bfbbf3a256 100644 --- a/js/sql.js +++ b/js/sql.js @@ -376,7 +376,7 @@ $(document).ready(function() { title: PMA_messages['strChangeTbl'], height: 230, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, close: function(event, ui) { $('#change_row_dialog').remove(); }, @@ -389,7 +389,7 @@ $(document).ready(function() { title: PMA_messages['strChangeTbl'], height: 600, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, close: function(event, ui) { $('#change_row_dialog').remove(); }, diff --git a/js/tbl_structure.js b/js/tbl_structure.js index bdcf1eeac6..226d1c4cd9 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -219,7 +219,7 @@ $(document).ready(function() { title: PMA_messages['strEdit'], height: 230, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, modal: true, buttons : button_options_error })// end dialog options @@ -230,7 +230,7 @@ $(document).ready(function() { title: PMA_messages['strEdit'], height: 600, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, modal: true, buttons : button_options }) @@ -371,7 +371,7 @@ $(document).ready(function() { title: PMA_messages['strAddColumns'], height: 230, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, modal: true, buttons : button_options_error })// end dialog options @@ -382,7 +382,7 @@ $(document).ready(function() { title: PMA_messages['strAddColumns'], height: 600, width: 900, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, modal: true, buttons : button_options }) @@ -441,7 +441,7 @@ function changeColumns(action,url) height: 230, width: 900, modal: true, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, buttons : button_options_error })// end dialog options } else { @@ -452,7 +452,7 @@ function changeColumns(action,url) height: 600, width: 900, modal: true, - open: PMA_verifyTypeOfAllColumns, + open: PMA_verifyColumnsProperties, buttons : button_options }) //Remove the top menu container from the dialog diff --git a/libraries/tbl_properties.inc.php b/libraries/tbl_properties.inc.php index 6f3cba4306..12576f4193 100644 --- a/libraries/tbl_properties.inc.php +++ b/libraries/tbl_properties.inc.php @@ -360,7 +360,7 @@ for ($i = 0; $i < $num_fields; $i++) { $row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']); } - $content_cells[$i][$ci] = ''; foreach ($default_options as $key => $value) { $content_cells[$i][$ci] .= '