1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-19 04:41:25 +02:00

Display help in tooltip

Also rename Analyze to Vacuum outside MySQL
This commit is contained in:
Jakub Vrana
2013-07-19 10:35:31 -07:00
parent b8ece2fb5d
commit a338f9bf58
10 changed files with 65 additions and 41 deletions

View File

@@ -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";

View File

@@ -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) {

View File

@@ -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();'";
}

View File

@@ -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;