]> git.joonet.de Git - adminer.git/commitdiff
Enum editing
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 12 Nov 2009 15:25:21 +0000 (15:25 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Thu, 12 Nov 2009 15:25:21 +0000 (15:25 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1240 7c3ca157-0c34-0410-bff1-cbf682f78f5c

adminer/include/adminer.inc.php
adminer/include/functions.inc.php
editor/include/adminer.inc.php

index 92f399bb155b6660ba66954b9e3c7f6726f83c07..93195b995ba60d3248810357d16c8cdfeaf5b8c4 100644 (file)
@@ -404,7 +404,12 @@ class Adminer {
        * @return string custom input field or empty string for default
        */
        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
index fcfaa8fae046b8bf08523c52108ba12325601158..60f57800f7dd741c688df78c8dc86d8dd6dbada8 100644 (file)
@@ -417,11 +417,8 @@ function input($field, $value, $function) {
        echo "<td class='function'>";
        $functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
        if ($field["type"] == "enum") {
-               echo "&nbsp;<td>" . ($functions["orig"] ? "<label><input type='radio' name='fields[$name]' value='-1' checked><em>$functions[orig]</em></label> " : "");
-               if (in_array("NULL", $functions)) {
-                       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' : '') . '>';
+               echo nbsp($functions[""]) . "<td>" . ($functions["orig"] ? "<label><input type='radio' name='fields[$name]' value='-1' checked><em>$functions[orig]</em></label> " : "");
+               echo $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'", $value);
                preg_match_all("~'((?:[^']|'')*)'~", $field["length"], $matches);
                foreach ($matches[1] as $i => $val) {
                        $val = stripcslashes(str_replace("''", "'", $val));
index 24b3cd01f3e5b3b4b63a009089a1c09d44887fd3..19b18186d10311b3652c3157fa947283b3e37b96 100644 (file)
@@ -394,6 +394,9 @@ ORDER BY ORDINAL_POSITION");
        
        function editInput($table, $field, $attrs, $value) {
                global $connection;
+               if ($field["type"] == "enum") {
+                       return ($field["null"] ? "<input type='radio'$attrs value=''" . ($value || isset($_GET["select"]) ? "" : " checked") . ">" : "");
+               }
                $foreignKeys = column_foreign_keys($table);
                foreach ((array) $foreignKeys[$field["field"]] as $foreignKey) {
                        if (count($foreignKey["source"]) == 1) {