Display help in tooltip
Also rename Analyze to Vacuum outside MySQL
This commit is contained in:
parent
b8ece2fb5d
commit
a338f9bf58
|
@ -114,17 +114,17 @@ if ($adminer->homepage()) {
|
|||
|
||||
echo "</table>\n";
|
||||
if (!information_schema(DB)) {
|
||||
$analyze = "<input type='submit' value='" . lang('Analyze') . "'>";
|
||||
$optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'>";
|
||||
$vacuum = "<input type='submit' value='" . lang('Vacuum') . "'" . on_help("VACUUM") . "> ";
|
||||
$optimize = "<input type='submit' name='optimize' value='" . lang('Optimize') . "'" . on_help($jush == "sql" ? "OPTIMIZE TABLE" : "VACUUM OPTIMIZE") . "> ";
|
||||
echo "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>"
|
||||
. ($jush == "sqlite" ? $optimize . doc_command("vacuum") . " "
|
||||
: ($jush == "pgsql" ? $analyze . doc_command("vacuum") . " $optimize" . doc_command("vacuum") . " "
|
||||
: ($jush == "sql" ? $analyze . doc_command("analyze-table") . " $optimize" . doc_command("optimize-table") . " "
|
||||
. "<input type='submit' name='check' value='" . lang('Check') . "'>" . doc_command("check-table") . " "
|
||||
. "<input type='submit' name='repair' value='" . lang('Repair') . "'>" . doc_command("repair-table") . " "
|
||||
. ($jush == "sqlite" ? $vacuum
|
||||
: ($jush == "pgsql" ? $vacuum . $optimize
|
||||
: ($jush == "sql" ? "<input type='submit' value='" . lang('Analyze') . "'" . on_help("ANALYZE TABLE") . "> " . $optimize
|
||||
. "<input type='submit' name='check' value='" . lang('Check') . "'" . on_help("CHECK TABLE") . "> "
|
||||
. "<input type='submit' name='repair' value='" . lang('Repair') . "'" . on_help("REPAIR TABLE") . "> "
|
||||
: "")))
|
||||
. (support("table") ? "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . ">" . doc_command($jush == "sqlite" ? "delete" : "truncate" . ($jush == "pgsql" ? "" : "-table")) . " " : "")
|
||||
. "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">" . doc_command("drop-table") . "\n";
|
||||
. (support("table") ? "<input type='submit' name='truncate' value='" . lang('Truncate') . "'" . confirm() . "" . on_help($jush == "sqlite" ? "DELETE" : "TRUNCATE" . ($jush == "pgsql" ? "" : " TABLE")) . "> " : "")
|
||||
. "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . "" . on_help("DROP TABLE") . ">\n";
|
||||
$databases = (support("scheme") ? schemas() : $adminer->databases());
|
||||
if (count($databases) != 1 && $jush != "sqlite") {
|
||||
$db = (isset($_POST["target"]) ? $_POST["target"] : (support("scheme") ? $_GET["ns"] : DB));
|
||||
|
|
|
@ -233,14 +233,13 @@ username.form['auth[driver]'].onchange();
|
|||
print_fieldset("select", lang('Select'), $select);
|
||||
$i = 0;
|
||||
$fun_group = array_filter(array(lang('Functions') => $functions, lang('Aggregation') => $grouping));
|
||||
$select[""] = array();
|
||||
foreach ($select as $key => $val) {
|
||||
$val = $_GET["columns"][$key];
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, $val["fun"]);
|
||||
echo "(" . select_input(" name='columns[$i][col]' onchange='selectFieldChange(this.form);'", $columns, $val["col"]) . ")</div>\n";
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, $val["fun"], ($key !== "" ? "" : " this.nextSibling.nextSibling.onchange();"));
|
||||
echo "(" . select_input(" name='columns[$i][col]' onchange='" . ($key !== "" ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";'", $columns, $val["col"]) . ")</div>\n";
|
||||
$i++;
|
||||
}
|
||||
echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, "", "this.nextSibling.nextSibling.onchange();");
|
||||
echo "(" . select_input(" name='columns[$i][col]' onchange='selectAddRow(this);'", $columns) . ")</div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
|
||||
|
@ -786,6 +785,7 @@ username.form['auth[driver]'].onchange();
|
|||
$links[] = preg_quote($table, '/');
|
||||
}
|
||||
echo "<script type='text/javascript'>\n";
|
||||
echo "var jushLang = '$jush';\n";
|
||||
echo "var jushLinks = { $jush: [ '" . js_escape(ME) . (support("table") ? "table=" : "select=") . "\$&', /\\b(" . implode("|", $links) . ")\\b/g ] };\n";
|
||||
foreach (array("bac", "bra", "sqlite_quo", "mssql_bra") as $val) {
|
||||
echo "jushLinks.$val = jushLinks.$jush;\n";
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
* @return null
|
||||
*/
|
||||
function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
||||
global $LANG, $adminer, $connection, $drivers;
|
||||
global $LANG, $adminer, $connection, $drivers, $jush;
|
||||
page_headers();
|
||||
$title_all = $title . ($title2 != "" ? ": $title2" : "");
|
||||
$title_page = strip_tags($title_all . (SERVER != "" && SERVER != "localhost" ? h(" - " . SERVER) : "") . " - " . $adminer->name());
|
||||
|
@ -34,6 +34,8 @@ function page_header($title, $error = "", $breadcrumb = array(), $title2 = "") {
|
|||
document.body.className = document.body.className.replace(/ nojs/, ' js');
|
||||
</script>
|
||||
|
||||
<div id="help" class="jush-<?php echo $jush; ?> jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout();"></div>
|
||||
|
||||
<div id="content">
|
||||
<?php
|
||||
if ($breadcrumb !== null) {
|
||||
|
|
|
@ -49,7 +49,7 @@ function select($result, $connection2 = null, $orgtables = array()) {
|
|||
}
|
||||
$types[$j] = $field->type;
|
||||
echo "<th" . ($orgtable != "" || $field->name != $orgname ? " title='" . h(($orgtable != "" ? "$orgtable." : "") . $orgname) . "'" : "") . ">" . h($name)
|
||||
. ($orgtables && $jush == "sql" ? doc_link("explain-output.html#explain_" . strtolower($name)) : "")
|
||||
. ($orgtables ? doc_link("explain-output.html#explain_" . strtolower($name)) : "")
|
||||
;
|
||||
}
|
||||
echo "</thead>\n";
|
||||
|
@ -458,35 +458,21 @@ function doc_link($path) {
|
|||
global $jush, $connection;
|
||||
$urls = array(
|
||||
'sql' => "http://dev.mysql.com/doc/refman/" . substr($connection->server_info, 0, 3) . "/en/",
|
||||
/* not used:
|
||||
'sqlite' => "http://www.sqlite.org/",
|
||||
'pgsql' => "http://www.postgresql.org/docs/" . substr($connection->server_info, 0, 3) . "/static/",
|
||||
'mssql' => "http://msdn.microsoft.com/library/",
|
||||
'oracle' => "http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/",
|
||||
*/
|
||||
);
|
||||
return ($urls[$jush] ? "<a href='$urls[$jush]$path' target='_blank' rel='noreferrer'><sup>?</sup></a>" : "");
|
||||
}
|
||||
|
||||
/** Create link to documentation of database command
|
||||
* @param string lower-case
|
||||
* @return string HTML code
|
||||
/** Return events to display help on mouse over
|
||||
* @param string
|
||||
* @param bool
|
||||
* @return string
|
||||
*/
|
||||
function doc_command($command) {
|
||||
global $jush;
|
||||
switch ($jush) {
|
||||
case 'sql': return doc_link("$command.html");
|
||||
case 'sqlite': return doc_link("lang_" . str_replace("-", "", $command) . ".html");
|
||||
case 'pgsql': return doc_link("sql-" . str_replace("-", "", $command) . ".html");
|
||||
case 'mssql':
|
||||
$links = array(
|
||||
'drop-table' => 'ms173790',
|
||||
'truncate-table' => 'ms177570',
|
||||
);
|
||||
return doc_link("$links[$command].aspx");
|
||||
case 'oracle':
|
||||
$links = array(
|
||||
'drop-table' => 'statements_9003.htm',
|
||||
'truncate-table' => 'statements_10006.htm',
|
||||
);
|
||||
return doc_link($links[$command]);
|
||||
}
|
||||
function on_help($command, $right = 0) {
|
||||
return " onmouseover=\"helpMouseover(this, '" . js_escape($command) . "', $right);\" onmouseout='helpMouseout();'";
|
||||
}
|
||||
|
|
|
@ -799,7 +799,10 @@ function input($field, $value, $function) {
|
|||
}
|
||||
$onchange = ($first ? " onchange=\"var f = this.form['function[" . h(js_escape(bracket_escape($field["field"]))) . "]']; if ($first > f.selectedIndex) f.selectedIndex = $first;\"" : "");
|
||||
$attrs .= $onchange;
|
||||
echo (count($functions) > 1 ? html_select("function[$name]", $functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);") : nbsp(reset($functions))) . '<td>';
|
||||
echo (count($functions) > 1
|
||||
? html_select("function[$name]", $functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "", "functionChange(this);")
|
||||
: nbsp(reset($functions))
|
||||
) . '<td>';
|
||||
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
|
||||
if ($input != "") {
|
||||
echo $input;
|
||||
|
|
|
@ -104,6 +104,7 @@ $translations = array(
|
|||
'%d in total' => '%d celkem',
|
||||
'Analyze' => 'Analyzovat',
|
||||
'Optimize' => 'Optimalizovat',
|
||||
'Vacuum' => 'Vyčistit',
|
||||
'Check' => 'Zkontrolovat',
|
||||
'Repair' => 'Opravit',
|
||||
'Truncate' => 'Vyprázdnit',
|
||||
|
|
|
@ -104,6 +104,7 @@ $translations = array(
|
|||
'%d in total' => 'xx',
|
||||
'Analyze' => 'xx',
|
||||
'Optimize' => 'xx',
|
||||
'Vacuum' => 'xx',
|
||||
'Check' => 'xx',
|
||||
'Repair' => 'xx',
|
||||
'Truncate' => 'xx',
|
||||
|
|
|
@ -22,9 +22,7 @@ foreach (process_list() as $i => $row) {
|
|||
if (!$i) {
|
||||
echo "<thead><tr lang='en'>" . (support("kill") ? "<th> " : "");
|
||||
foreach ($row as $key => $val) {
|
||||
echo "<th>$key"
|
||||
. ($jush == "sql" ? doc_link("show-processlist.html#processlist_" . strtolower($key)) : "")
|
||||
;
|
||||
echo "<th>$key" . doc_link("show-processlist.html#processlist_" . strtolower($key));
|
||||
}
|
||||
echo "</thead>\n";
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ input.required { box-shadow: 1px 1px 1px red; }
|
|||
#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; }
|
||||
#help { position: absolute; border: 1px solid #999; background: #eee; padding: 5px; font-family: monospace; z-index: 1; }
|
||||
|
||||
.rtl h2 { margin: 0 -18px 20px 0; }
|
||||
.rtl p, .rtl table, .rtl .error, .rtl .message { margin: 1em 0 0 20px; }
|
||||
|
|
|
@ -612,3 +612,35 @@ function schemaMouseup(ev, db) {
|
|||
cookie('adminer_schema-' + db + '=' + s, 30); //! special chars in db
|
||||
}
|
||||
}
|
||||
|
||||
var helpOpen;
|
||||
|
||||
function helpMouseover(el, text, right) {
|
||||
if (window.jush) {
|
||||
helpOpen = 1;
|
||||
var help = document.getElementById('help');
|
||||
help.innerHTML = text;
|
||||
jush.highlight_tag([ help ]);
|
||||
alterClass(help, 'hidden');
|
||||
var top = 0, left = 0, parent = el;
|
||||
do {
|
||||
top += parent.offsetTop;
|
||||
left += parent.offsetLeft;
|
||||
} while (parent = parent.offsetParent);
|
||||
help.style.top = (top - (right ? (help.offsetHeight - el.offsetHeight) / 2 : help.offsetHeight)) + 'px';
|
||||
help.style.left = (left + (right ? el.offsetWidth : (el.offsetWidth - help.offsetWidth) / 2)) + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
function helpMouseout() {
|
||||
helpOpen = 0;
|
||||
setTimeout(function () {
|
||||
if (!helpOpen) {
|
||||
helpClose();
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function helpClose() {
|
||||
alterClass(document.getElementById('help'), 'hidden', true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue