As suggested by Tyron Madlener:

Display the input field for the default value only after "As defined:"
is selected, and also focus it automatically once it's selected so the user
can type immediately
This commit is contained in:
Marc Delisle 2011-10-16 09:10:48 -04:00
parent ba2159baca
commit 4336ffca2b
5 changed files with 35 additions and 17 deletions

View File

@ -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

View File

@ -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();
}
}
/**

View File

@ -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();
},

View File

@ -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

View File

@ -360,7 +360,7 @@ for ($i = 0; $i < $num_fields; $i++) {
$row['DefaultValue'] = PMA_convert_bit_default_value($row['DefaultValue']);
}
$content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']">';
$content_cells[$i][$ci] = '<select name="field_default_type[' . $i . ']" class="default_type">';
foreach ($default_options as $key => $value) {
$content_cells[$i][$ci] .= '<option value="' . $key . '"';
// is only set when we go back to edit a field's structure
@ -374,7 +374,7 @@ for ($i = 0; $i < $num_fields; $i++) {
$content_cells[$i][$ci] .= '<input id="field_' . $i . '_' . ($ci - $ci_offset) . '"'
. ' type="text" name="field_default_value[' . $i . ']" size="12"'
. ' value="' . (isset($row['DefaultValue']) ? htmlspecialchars($row['DefaultValue']) : '') . '"'
. ' class="textfield" />';
. ' class="textfield default_value" />';
$ci++;
// column collation