Separate function and value
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@632 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
parent
5e2989a714
commit
6d3b5935eb
|
@ -52,7 +52,7 @@ if ($in) {
|
||||||
echo "<table cellspacing='0'>\n";
|
echo "<table cellspacing='0'>\n";
|
||||||
foreach ($in as $key) {
|
foreach ($in as $key) {
|
||||||
$field = $routine["fields"][$key];
|
$field = $routine["fields"][$key];
|
||||||
echo "<tr><th>" . htmlspecialchars($field["field"]) . "</th><td>";
|
echo "<tr><th>" . htmlspecialchars($field["field"]) . "</th>";
|
||||||
$value = $_POST["fields"][$key];
|
$value = $_POST["fields"][$key];
|
||||||
if (strlen($value) && ($field["type"] == "enum" || $field["type"] == "set")) {
|
if (strlen($value) && ($field["type"] == "enum" || $field["type"] == "set")) {
|
||||||
$value = intval($value);
|
$value = intval($value);
|
||||||
|
|
|
@ -23,6 +23,7 @@ code { background: #eee; }
|
||||||
.binary { color: red; }
|
.binary { color: red; }
|
||||||
.odd td { background: #F5F5F5; }
|
.odd td { background: #F5F5F5; }
|
||||||
.time { color: Silver; font-size: 70%; float: right; margin-top: -3em; }
|
.time { color: Silver; font-size: 70%; float: right; margin-top: -3em; }
|
||||||
|
.function { text-align: right; }
|
||||||
tr:hover td { background: #ddf; }
|
tr:hover td { background: #ddf; }
|
||||||
thead tr:hover td { background: transparent; }
|
thead tr:hover td { background: transparent; }
|
||||||
#menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; overflow: auto; overflow-y: hidden; white-space: nowrap; }
|
#menu { position: absolute; margin: 10px 0 0; padding: 0 0 30px 0; top: 2em; left: 0; width: 19em; overflow: auto; overflow-y: hidden; white-space: nowrap; }
|
||||||
|
|
|
@ -66,7 +66,7 @@ if ($fields) {
|
||||||
unset($create);
|
unset($create);
|
||||||
echo "<table cellspacing='0'>\n";
|
echo "<table cellspacing='0'>\n";
|
||||||
foreach ($fields as $name => $field) {
|
foreach ($fields as $name => $field) {
|
||||||
echo "<tr><th>" . htmlspecialchars($name) . "</th><td>";
|
echo "<tr><th>" . htmlspecialchars($name) . "</th>";
|
||||||
$value = (!isset($row) ? $field["default"] :
|
$value = (!isset($row) ? $field["default"] :
|
||||||
(strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) :
|
(strlen($row[$name]) && ($field["type"] == "enum" || $field["type"] == "set") ? intval($row[$name]) :
|
||||||
($_POST["clone"] && $field["auto_increment"] ? "" :
|
($_POST["clone"] && $field["auto_increment"] ? "" :
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
function input($name, $field, $value) {
|
function input($name, $field, $value, $separator = "</td><td>") { //! pass empty separator if there are no functions in the whole table
|
||||||
global $types;
|
global $types;
|
||||||
$name = htmlspecialchars(bracket_escape($name));
|
$name = htmlspecialchars(bracket_escape($name));
|
||||||
|
echo "<td" . ($separator ? " class='function'" : "") . ">";
|
||||||
if ($field["type"] == "enum") {
|
if ($field["type"] == "enum") {
|
||||||
if (isset($_GET["select"])) {
|
echo $separator . (isset($_GET["select"]) ? ' <label><input type="radio" name="fields[' . $name . ']" value="-1" checked="checked" /><em>' . lang('original') . '</em></label>' : "");
|
||||||
echo ' <label><input type="radio" name="fields[' . $name . ']" value="-1" checked="checked" /><em>' . lang('original') . '</em></label>';
|
|
||||||
}
|
|
||||||
if ($field["null"] || isset($_GET["default"])) {
|
if ($field["null"] || isset($_GET["default"])) {
|
||||||
echo ' <label><input type="radio" name="fields[' . $name . ']" value=""' . (($field["null"] ? isset($value) : strlen($value)) || isset($_GET["select"]) ? '' : ' checked="checked"') . ' />' . ($field["null"] ? '<em>NULL</em>' : '') . '</label>';
|
echo ' <label><input type="radio" name="fields[' . $name . ']" value=""' . (($field["null"] ? isset($value) : strlen($value)) || isset($_GET["select"]) ? '' : ' checked="checked"') . ' />' . ($field["null"] ? '<em>NULL</em>' : '') . '</label>';
|
||||||
}
|
}
|
||||||
|
@ -33,9 +32,7 @@ function input($name, $field, $value) {
|
||||||
if ($field["null"] || isset($_GET["default"])) {
|
if ($field["null"] || isset($_GET["default"])) {
|
||||||
array_unshift($options, "NULL");
|
array_unshift($options, "NULL");
|
||||||
}
|
}
|
||||||
if (count($options) > 1 || isset($_GET["select"])) {
|
echo (count($options) > 1 || isset($_GET["select"]) ? '<select name="function[' . $name . ']" tabindex="1">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, (isset($value) ? (string) $_POST["function"][$name] : null)) . '</select>' : "") . $separator;
|
||||||
echo '<select name="function[' . $name . ']">' . (isset($_GET["select"]) ? '<option value="orig">' . lang('original') . '</option>' : '') . optionlist($options, (isset($value) ? (string) $_POST["function"][$name] : null)) . '</select>';
|
|
||||||
}
|
|
||||||
if ($field["type"] == "set") { //! 64 bits
|
if ($field["type"] == "set") { //! 64 bits
|
||||||
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
|
preg_match_all("~'((?:[^']+|'')*)'~", $field["length"], $matches);
|
||||||
foreach ($matches[1] as $i => $val) {
|
foreach ($matches[1] as $i => $val) {
|
||||||
|
|
Loading…
Reference in a new issue