Save bytes
This commit is contained in:
parent
390d10284d
commit
804fb36faa
|
@ -138,20 +138,21 @@ function textarea($name, $value, $rows = 10, $cols = 80) {
|
||||||
*/
|
*/
|
||||||
function edit_type($key, $field, $collations, $foreign_keys = array()) {
|
function edit_type($key, $field, $collations, $foreign_keys = array()) {
|
||||||
global $structured_types, $types, $unsigned, $on_actions;
|
global $structured_types, $types, $unsigned, $on_actions;
|
||||||
|
$type = $field["type"];
|
||||||
?>
|
?>
|
||||||
<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"<?php echo on_help("getTarget(event).value", 1); ?>><?php
|
<td><select name="<?php echo $key; ?>[type]" class="type" onfocus="lastType = selectValue(this);" onchange="editingTypeChange(this);"<?php echo on_help("getTarget(event).value", 1); ?>><?php
|
||||||
echo optionlist(
|
echo optionlist(
|
||||||
(!$field["type"] || isset($types[$field["type"]]) || isset($foreign_keys[$field["type"]]) ? array() : array($field["type"]))
|
(!$type || isset($types[$type]) || isset($foreign_keys[$type]) ? array() : array($type))
|
||||||
+ $structured_types
|
+ $structured_types
|
||||||
+ ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array())
|
+ ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array())
|
||||||
, $field["type"]
|
, $type
|
||||||
);
|
);
|
||||||
?></select>
|
?></select>
|
||||||
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $field["type"]) ? " class='required'" : ""); ?> onchange="editingLengthChange(this);" onkeyup="this.onchange();"><td class="options"><?php //! type="number" with enabled JavaScript
|
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); ?> onchange="editingLengthChange(this);" onkeyup="this.onchange();"><td class="options"><?php //! type="number" with enabled JavaScript
|
||||||
echo "<select name='$key" . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
echo "<select name='$key" . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
||||||
echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$field["type"] || preg_match('~((^|[^o])int|float|double|decimal)$~', $field["type"]) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
echo ($unsigned ? "<select name='$key" . "[unsigned]'" . (!$type || preg_match('~((^|[^o])int|float|double|decimal)$~', $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
||||||
echo (isset($field['on_update']) ? "<select name='$key" . "[on_update]'" . ($field["type"] == "timestamp" ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
|
echo (isset($field['on_update']) ? "<select name='$key" . "[on_update]'" . ($type == "timestamp" ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
|
||||||
echo ($foreign_keys ? "<select name='$key" . "[on_delete]'" . (preg_match("~`~", $field["type"]) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
echo ($foreign_keys ? "<select name='$key" . "[on_delete]'" . (preg_match("~`~", $type) ? "" : " class='hidden'") . "><option value=''>(" . lang('ON DELETE') . ")" . optionlist(explode("|", $on_actions), $field["on_delete"]) . "</select> " : " "); // space for IE
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Filter length value including enums
|
/** Filter length value including enums
|
||||||
|
|
Loading…
Reference in a new issue