Permalink
Browse files

Unselect original after value input

git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@935 7c3ca157-0c34-0410-bff1-cbf682f78f5c
  • Loading branch information...
jakubvrana
jakubvrana committed Jul 28, 2009
1 parent d31d4e9 commit 9fc052b77f88f81781dfd7c11332ffa1a765d21f
Showing with 7 additions and 7 deletions.
  1. +1 −1 adminer/include/adminer.inc.php
  2. +5 −5 adminer/include/functions.inc.php
  3. +1 −1 editor/include/adminer.inc.php
@@ -371,7 +371,7 @@ function editFunctions($field) {
if ($field["null"] || isset($_GET["default"])) {
array_unshift($return, "NULL");
}
- return (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $return;
+ return $return;
}
/** Get options to display edit field
@@ -303,8 +303,8 @@ function input($field, $value, $function) {
echo ' <label><input type="radio" name="fields[' . $name . ']" value="' . (isset($_GET["default"]) ? (strlen($val) ? htmlspecialchars($val) : " ") : $i+1) . '"' . ($checked ? ' checked="checked"' : '') . '>' . htmlspecialchars($val) . '</label>';
}
} else {
- $functions = $adminer->editFunctions($field);
- $first = array_search("", $functions);
+ $functions = (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + $adminer->editFunctions($field);
+ $first = array_search("", $functions) + (isset($_GET["select"]) ? 1 : 0);
$onchange = ($first ? ' onchange="var f = this.form[\'function[' . addcslashes($name, "\r\n'\\") . ']\']; if (' . $first . ' > f.selectedIndex) f.selectedIndex = ' . $first . ';"' : '');
echo (count($functions) > 1 ? '<select name="function[' . $name . ']">' . optionlist($functions, $function) . '</select>' : "&nbsp;") . '<td>';
$input = $adminer->editInput($_GET["edit"], $field, ' name="fields[' . $name . ']"' . $onchange, $value); // usage in call is without a table
@@ -315,12 +315,12 @@ function input($field, $value, $function) {
foreach ($matches[1] as $i => $val) {
$val = stripcslashes(str_replace("''", "'", $val));
$checked = (is_int($value) ? ($value >> $i) & 1 : in_array($val, explode(",", $value), true));
- echo ' <label><input type="checkbox" name="fields[' . $name . '][' . $i . ']" value="' . (isset($_GET["default"]) ? htmlspecialchars($val) : 1 << $i) . '"' . ($checked ? ' checked="checked"' : '') . $onchange . '>' . htmlspecialchars($val) . '</label>';
+ echo ' <label><input type="checkbox" name="fields[' . $name . '][' . $i . ']" value="' . (isset($_GET["default"]) ? htmlspecialchars($val) : 1 << $i) . '"' . ($checked ? ' checked="checked"' : '') . "$onchange>" . htmlspecialchars($val) . '</label>';
}
} elseif (strpos($field["type"], "text") !== false) {
- echo '<textarea name="fields[' . $name . ']" cols="50" rows="12"' . $onchange . '>' . htmlspecialchars($value) . '</textarea>';
+ echo '<textarea name="fields[' . $name . ']" cols="50" rows="12"' . "$onchange>" . htmlspecialchars($value) . '</textarea>';
} elseif (ereg('binary|blob', $field["type"])) {
- echo (ini_get("file_uploads") ? '<input type="file" name="' . $name . '"' . $onchange . '>' : lang('File uploads are disabled.'));
+ echo (ini_get("file_uploads") ? '<input type="file" name="' . $name . '"' . "$onchange>" : lang('File uploads are disabled.'));
} else {
// int(3) is only a display hint
$maxlength = (!ereg('int', $field["type"]) && preg_match('~^([0-9]+)(,([0-9]+))?$~', $field["length"], $match) ? ($match[1] + ($match[3] ? 1 : 0) + ($match[2] && !$field["unsigned"] ? 1 : 0)) : ($types[$field["type"]] ? $types[$field["type"]] + ($field["unsigned"] ? 0 : 1) : 0));
@@ -285,7 +285,7 @@ function messageQuery($query) {
}
function editFunctions($field) {
- return (isset($_GET["select"]) ? array("orig" => lang('original')) : array()) + array("");
+ return array("");
}
function editInput($table, $field, $attrs, $value) {

0 comments on commit 9fc052b

Please sign in to comment.