mirror of
https://github.com/vrana/adminer.git
synced 2025-08-17 20:01:25 +02:00
Utilize html_select
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@1162 7c3ca157-0c34-0410-bff1-cbf682f78f5c
This commit is contained in:
@@ -162,11 +162,11 @@ class Adminer {
|
||||
$fun_group = array(lang('Functions') => $this->functions, lang('Aggregation') => $this->grouping);
|
||||
foreach ($select as $key => $val) {
|
||||
$val = $_GET["columns"][$key];
|
||||
echo "<div><select name='columns[$i][fun]'><option>" . optionlist($fun_group, $val["fun"]) . "</select>";
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, $val["fun"]);
|
||||
echo "<select name='columns[$i][col]'><option>" . optionlist($columns, $val["col"], true) . "</select></div>\n";
|
||||
$i++;
|
||||
}
|
||||
echo "<div><select name='columns[$i][fun]' onchange='this.nextSibling.onchange();'><option>" . optionlist($fun_group) . "</select>";
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, "", "this.nextSibling.onchange();");
|
||||
echo "<select name='columns[$i][col]' onchange='select_add_row(this);'><option>" . optionlist($columns, null, true) . "</select></div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
@@ -191,13 +191,13 @@ class Adminer {
|
||||
foreach ((array) $_GET["where"] as $val) {
|
||||
if (strlen("$val[col]$val[val]") && in_array($val["op"], $this->operators)) {
|
||||
echo "<div><select name='where[$i][col]'><option value=''>" . lang('(anywhere)') . optionlist($columns, $val["col"], true) . "</select>";
|
||||
echo "<select name='where[$i][op]'>" . optionlist($this->operators, $val["op"]) . "</select>";
|
||||
echo html_select("where[$i][op]", $this->operators, $val["op"]);
|
||||
echo "<input name='where[$i][val]' value='" . h($val["val"]) . "'></div>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
echo "<div><select name='where[$i][col]' onchange='select_add_row(this);'><option value=''>" . lang('(anywhere)') . optionlist($columns, null, true) . "</select>";
|
||||
echo "<select name='where[$i][op]'>" . optionlist($this->operators) . "</select>";
|
||||
echo html_select("where[$i][op]", $this->operators);
|
||||
echo "<input name='where[$i][val]'></div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
@@ -482,11 +482,7 @@ class Adminer {
|
||||
<p>
|
||||
<?php if (SID) { ?><input type="hidden" name="<?php echo session_name(); ?>" value="<?php echo h(session_id()); ?>"><?php } ?>
|
||||
<?php if (strlen($_GET["server"])) { ?><input type="hidden" name="server" value="<?php echo h($_GET["server"]); ?>"><?php } ?>
|
||||
<?php if ($databases) { ?>
|
||||
<select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)<?php echo optionlist($databases, DB); ?></select>
|
||||
<?php } else { ?>
|
||||
<input name="db" value="<?php echo h(DB); ?>">
|
||||
<?php } ?>
|
||||
<?php echo ($databases ? html_select("db", array("" => "(" . lang('database') . ")") + $databases, DB, "this.form.submit();") : '<input name="db" value="' . h(DB) . '">'); ?>
|
||||
<?php if (isset($_GET["sql"])) { ?><input type="hidden" name="sql" value=""><?php } ?>
|
||||
<?php if (isset($_GET["schema"])) { ?><input type="hidden" name="schema" value=""><?php } ?>
|
||||
<?php if (isset($_GET["dump"])) { ?><input type="hidden" name="dump" value=""><?php } ?>
|
||||
|
@@ -97,7 +97,7 @@ function referencable_primary($self) {
|
||||
function edit_type($key, $field, $collations, $foreign_keys = array()) {
|
||||
global $structured_types, $unsigned, $inout;
|
||||
?>
|
||||
<td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); // foreign keys can be wide but style="width: 15ex;" narrows expanded optionlist in IE too ?></select>
|
||||
<td><select name="<?php echo $key; ?>[type]" class="type" onchange="editing_type_change(this);"><?php echo optionlist($structured_types + ($foreign_keys ? array(lang('Foreign keys') => $foreign_keys) : array()), $field["type"]); ?></select>
|
||||
<td><input name="<?php echo $key; ?>[length]" value="<?php echo h($field["length"]); ?>" size="3">
|
||||
<td><?php
|
||||
echo "<select name='$key" . "[collation]'" . (ereg('(char|text|enum|set)$', $field["type"]) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
||||
@@ -172,7 +172,11 @@ function edit_fields($fields, $collations, $type = "TABLE", $allowed = 0, $forei
|
||||
$display = (isset($_POST["add"][$i-1]) || (isset($field["field"]) && !$_POST["drop_col"][$i]));
|
||||
?>
|
||||
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
|
||||
<?php if ($type == "PROCEDURE") { ?><td><select name="fields[<?php echo $i; ?>][inout]"><?php echo optionlist($inout, $field["inout"]); ?></select><?php } ?>
|
||||
<?php
|
||||
if ($type == "PROCEDURE") {
|
||||
echo "<td>" . html_select("fields[$i][inout]", $inout, $field["inout"]);
|
||||
}
|
||||
?>
|
||||
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="<?php echo (strlen($field["field"]) || count($fields) > 1 ? "" : "editing_add_row(this, $allowed); "); ?>editing_name_change(this);" maxlength="64"><?php } ?><input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($field[($_POST ? "orig" : "field")]); ?>">
|
||||
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
|
||||
<?php if ($type == "TABLE") { ?>
|
||||
|
@@ -78,12 +78,12 @@ function checkbox($name, $value, $checked, $label = "", $onclick = "") {
|
||||
* @param string
|
||||
* @param array
|
||||
* @param string
|
||||
* @param bool generate select (otherwise radio)
|
||||
* @param string true for no onchange, false for radio
|
||||
* @return string
|
||||
*/
|
||||
function html_select($name, $options, $value, $select = true) {
|
||||
if ($select) {
|
||||
return "<select name='" . h($name) . "'>" . optionlist($options, $value) . "</select>";
|
||||
function html_select($name, $options, $value = "", $onchange = true) {
|
||||
if ($onchange) {
|
||||
return "<select name='" . h($name) . "'" . (is_string($onchange) ? " onchange=\"$onchange\"" : "") . ">" . optionlist($options, $value) . "</select>";
|
||||
}
|
||||
$return = "";
|
||||
foreach ($options as $key => $val) {
|
||||
@@ -418,7 +418,7 @@ function input($field, $value, $function) {
|
||||
$first++;
|
||||
}
|
||||
$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, !isset($function) || in_array($function, $functions) ? $function : "") . "</select>" : nbsp(reset($functions))) . '<td>';
|
||||
echo (count($functions) > 1 ? html_select("function[$name]", $functions, !isset($function) || in_array($function, $functions) ? $function : "") : nbsp(reset($functions))) . '<td>';
|
||||
$input = $adminer->editInput($_GET["edit"], $field, " name='fields[$name]'$onchange", $value); // usage in call is without a table
|
||||
if (strlen($input)) {
|
||||
echo $input;
|
||||
|
@@ -32,9 +32,9 @@ function switch_lang() {
|
||||
global $LANG, $langs;
|
||||
echo "<form action=''>\n<div id='lang'>";
|
||||
hidden_fields($_GET, array('lang'));
|
||||
echo lang('Language') . ": <select name='lang' onchange='this.form.submit();'>";
|
||||
echo optionlist($langs, $LANG);
|
||||
echo "</select>\n<noscript><div style='display: inline;'><input type='submit' value='" . lang('Use') . "'></div></noscript>\n</div>\n</form>\n";
|
||||
echo lang('Language') . ": " . html_select("lang", $langs, $LANG, "this.form.submit();");
|
||||
echo "<noscript><div style='display: inline;'><input type='submit' value='" . lang('Use') . "'></div></noscript>\n";
|
||||
echo "</div>\n</form>\n";
|
||||
}
|
||||
|
||||
if (isset($_GET["lang"])) {
|
||||
|
Reference in New Issue
Block a user