1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-30 17:50:00 +02:00

Full width design for database select box

This commit is contained in:
Peter Knut
2024-10-06 00:43:49 +02:00
parent 279337aa65
commit e5a7f75807
2 changed files with 30 additions and 22 deletions

View File

@@ -1069,42 +1069,50 @@ bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '
}
}
/** Prints databases list in menu
* @param string
* @return null
*/
/**
* Prints databases select in menu.
*
* @param $missing string
* @return null
*/
function databasesPrint($missing) {
global $adminer, $connection;
$databases = $this->databases();
if (DB && $databases && !in_array(DB, $databases)) {
array_unshift($databases, DB);
}
?>
<form action="">
<p id="dbs">
<?php
echo "<form action=''><p id='dbs'>";
hidden_fields_get();
$db_events = script("mixin(qsl('select'), {onmousedown: dbMouseDown, onchange: dbChange});");
echo "<span title='" . lang('database') . "'>" . lang('DB') . "</span>: " . ($databases
? "<select name='db'>" . optionlist(array("" => "") + $databases, DB) . "</select>$db_events"
: "<input name='db' value='" . h(DB) . "' autocapitalize='off'>\n"
);
if ($databases) {
echo "<select id='database-select' name='db'>" . optionlist(["" => lang('Database')] + $databases, DB) . "</select>"
. script("mixin(qs('#database-select'), {onmousedown: dbMouseDown, onchange: dbChange});");
} else {
echo "<input id='database-select' name='db' value='" . h(DB) . "' autocapitalize='off'>\n";
}
echo "<input type='submit' value='" . lang('Use') . "'" . ($databases ? " class='hidden'" : "") . ">\n";
if (support("scheme")) {
if ($missing != "db" && DB != "" && $connection->select_db(DB)) {
echo "<br>" . lang('Schema') . ": <select name='ns'>" . optionlist(array("" => "") + $adminer->schemas(), $_GET["ns"]) . "</select>$db_events";
if ($_GET["ns"] != "") {
set_schema($_GET["ns"]);
}
if (support("scheme") && $missing != "db" && DB != "" && $connection->select_db(DB)) {
echo "<br><select id='scheme-select' name='ns'>" . optionlist(["" => lang('Schema')] + $adminer->schemas(), $_GET["ns"]) . "</select>"
. script("mixin(qs('#scheme-select'), {onmousedown: dbMouseDown, onchange: dbChange});");
if ($_GET["ns"] != "") {
set_schema($_GET["ns"]);
}
}
foreach (array("import", "sql", "schema", "dump", "privileges") as $val) {
foreach (["import", "sql", "schema", "dump", "privileges"] as $val) {
if (isset($_GET[$val])) {
echo "<input type='hidden' name='$val' value=''>";
break;
}
}
echo "</p></form>\n";
return null;
}
function printTablesFilter()

View File

@@ -25,7 +25,7 @@ pre { margin: 1em 0 0; }
pre code { display: block; font-size: 100%; }
pre, textarea { font: 110%/1.25 monospace; }
pre.jush { background: #fff; }
input, textarea { box-sizing: border-box; }
input, textarea, select { box-sizing: border-box; }
input, select { vertical-align: middle; }
input.default { box-shadow: 1px 1px 1px #777; }
input.required { box-shadow: 1px 1px 1px red; }
@@ -85,7 +85,7 @@ input::placeholder { color: #000; opacity: 0.4; }
#schema { margin-left: 60px; position: relative; -moz-user-select: none; -webkit-user-select: none; }
#schema .table { border: 1px solid silver; padding: 0 2px; cursor: move; position: absolute; }
#schema .references { position: absolute; }
#tables-filter { width: 100%; }
#tables-filter, #database-select, #scheme-select { width: 100%; }
#help { position: absolute; border: 1px solid #999; background: #eee; padding: 5px; font-family: monospace; z-index: 1; }
.rtl h2 { margin: 0 -18px 20px 0; }