Enum editing
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1240 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
e70157827f
commit
ec0282b7d7
|
@ -404,7 +404,12 @@ class Adminer {
|
||||||
* @return string custom input field or empty string for default
|
* @return string custom input field or empty string for default
|
||||||
*/
|
*/
|
||||||
function editInput($table, $field, $attrs, $value) {
|
function editInput($table, $field, $attrs, $value) {
|
||||||
return '';
|
if ($field["type"] == "enum") {
|
||||||
|
return ($field["null"] ? "<label><input type='radio'$attrs value=''" . (isset($value) || isset($_GET["select"]) ? "" : " checked") . "><em>NULL</em></label> " : "")
|
||||||
|
. "<input type='radio'$attrs value='0'" . ($value === 0 ? " checked" : "") . ">"
|
||||||
|
;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Process sent input
|
/** Process sent input
|
||||||
|
|
|
@ -417,11 +417,8 @@ function input($field, $value, $function) {
|
||||||
echo "<td class='function'>";
|
echo "<td class='function'>";
|
||||||
$functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
|
$functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
|
||||||
if ($field["type"] == "enum") {
|
if ($field["type"] == "enum") {
|
||||||
echo " <td>" . ($functions["orig"] ? "<label><input type='radio' name='fields[$name]' value='-1' checked><em>$functions[orig]</em></label> " : "");
|
echo nbsp($functions[""]) . "<td>" . ($functions["orig"] ? "<label><input type='radio' name='fields[$name]' value='-1' checked><em>$functions[orig]</em></label> " : "");
|
||||||
if (in_array("NULL", $functions)) {
|
echo $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'", $value);
|
||||||
echo "<label><input type='radio' name='fields[$name]' value=''" . (isset($value) || $functions["orig"] ? '' : ' checked') . "><em>NULL</em></label> ";
|
|
||||||
}
|
|
||||||
echo "<input type='radio' name='fields[$name]' value='0'" . ($value === 0 ? ' checked' : '') . '>';
|
|
||||||
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
|
||||||
foreach ($matches[1] as $i => $val) {
|
foreach ($matches[1] as $i => $val) {
|
||||||
$val = stripcslashes(str_replace("''", "'", $val));
|
$val = stripcslashes(str_replace("''", "'", $val));
|
||||||
|
|
|
@ -394,6 +394,9 @@ ORDER BY ORDINAL_POSITION");
|
||||||
|
|
||||||
function editInput($table, $field, $attrs, $value) {
|
function editInput($table, $field, $attrs, $value) {
|
||||||
global $connection;
|
global $connection;
|
||||||
|
if ($field["type"] == "enum") {
|
||||||
|
return ($field["null"] ? "<input type='radio'$attrs value=''" . ($value || isset($_GET["select"]) ? "" : " checked") . ">" : "");
|
||||||
|
}
|
||||||
$foreignKeys = column_foreign_keys($table);
|
$foreignKeys = column_foreign_keys($table);
|
||||||
foreach ((array) $foreignKeys[$field["field"]] as $foreignKey) {
|
foreach ((array) $foreignKeys[$field["field"]] as $foreignKey) {
|
||||||
if (count($foreignKey["source"]) == 1) {
|
if (count($foreignKey["source"]) == 1) {
|
||||||
|
|
Loading…
Reference in a new issue