]> git.joonet.de Git - adminer.git/commitdiff
Display help for functions and MySQL engines
authorJakub Vrana <jakub@vrana.cz>
Fri, 19 Jul 2013 18:55:49 +0000 (11:55 -0700)
committerJakub Vrana <jakub@vrana.cz>
Fri, 19 Jul 2013 18:56:45 +0000 (11:56 -0700)
adminer/create.inc.php
adminer/db.inc.php
adminer/include/adminer.inc.php
adminer/include/editing.inc.php
adminer/include/functions.inc.php
adminer/static/editing.js
adminer/static/functions.js
externals/jush

index dc099216830c6324380beb0fb63ea06f258d79f5..88c0e05905452edd8d60e5a4d4f838224fba38e5 100644 (file)
@@ -157,7 +157,7 @@ foreach ($engines as $engine) {
 <?php if (support("table") || $TABLE == "") { ?>
 <?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
 <?php if ($TABLE == "" && !$_POST) { ?><script type='text/javascript'>focus(document.getElementById('form')['name']);</script><?php } ?>
-<?php echo ($engines ? html_select("Engine", array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) : ""); ?>
+<?php echo ($engines ? "<select name='Engine' onchange='helpClose();'" . on_help("getTarget(event).value", 1) . ">" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" : ""); ?>
  <?php echo ($collations && !ereg("sqlite|mssql", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
  <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php } ?>
index c5e4c873ae6d6f16de2a71be696e01202459cf0a..d3b9d26324e6d7ab232b5dbb015d90367aae69a7 100644 (file)
@@ -114,17 +114,17 @@ if ($adminer->homepage()) {
                        
                        echo "</table>\n";
                        if (!information_schema(DB)) {
-                               $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") . "> ";
+                               $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" ? $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") . "> "
+                               : ($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() . "" . on_help($jush == "sqlite" ? "DELETE" : "TRUNCATE" . ($jush == "pgsql" ? "" : " TABLE")) . "> " : "")
-                               . "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . "" . on_help("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));
index edadec9ac276fb01310a7cc8477d4361adefadbb..3b2837005a09e2c2e626de608a5f6c0ada0a9457 100644 (file)
@@ -236,7 +236,8 @@ username.form['auth[driver]'].onchange();
                $select[""] = array();
                foreach ($select as $key => $val) {
                        $val = $_GET["columns"][$key];
-                       echo "<div>" . html_select("columns[$i][fun]", array(-1 => "") + $fun_group, $val["fun"], ($key !== "" ? "" : " this.nextSibling.nextSibling.onchange();"));
+                       echo "<div><select name='columns[$i][fun]' onchange='helpClose();" . ($key !== "" ? "" : " this.nextSibling.nextSibling.onchange();") . "'"
+                               . on_help("getTarget(event).value && getTarget(event).value.replace(/ |\$/, '(') + ')'", 1) . ">" . optionlist(array(-1 => "") + $fun_group, $val["fun"]) . "</select>";
                        echo "(" . select_input(" name='columns[$i][col]' onchange='" . ($key !== ""  ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";'", $columns, $val["col"]) . ")</div>\n";
                        $i++;
                }
index 32b35a4755782f598e1e38d0fdfa455edd089f6a..bb22c20e93a3f85f4b327150d429a2374ffd1a5c 100644 (file)
@@ -469,10 +469,10 @@ function doc_link($path) {
 }
 
 /** Return events to display help on mouse over
-* @param string
-* @param bool
+* @param string JS expression
+* @param bool JS expression
 * @return string
 */
-function on_help($command, $right = 0) {
-       return " onmouseover=\"helpMouseover(this, '" . js_escape($command) . "', $right);\" onmouseout='helpMouseout();'";
+function on_help($command, $side = 0) {
+       return " onmouseover='helpMouseover(getTarget(event), " . h($command) . ", $side);' onmouseout='helpMouseout();'";
 }
index 0f9a7ba410c49926fc3a9524ba5477069ab443b8..920756d4a044c202b0580cf2ce01bef252be64dd 100644 (file)
@@ -800,7 +800,7 @@ 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);")
+                       ? "<select name='function[$name]' onchange='functionChange(this);'" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . ">" . optionlist($functions, $function === null || in_array($function, $functions) || isset($functions[$function]) ? $function : "") . "</select>"
                        : nbsp(reset($functions))
                ) . '<td>';
                $input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
index da11bdd014cff153146d6e38ca5731b8aaa49bf0..6ed4e7174e1245fc953bfa6db2f870af0d2456ad 100644 (file)
@@ -615,8 +615,15 @@ function schemaMouseup(ev, db) {
 
 var helpOpen;
 
-function helpMouseover(el, text, right) {
-       if (window.jush) {
+/** Display help
+* @param HTMLElement
+* @param string
+* @param bool display on left side (otherwise on top)
+*/
+function helpMouseover(el, text, side) {
+       if (!text) {
+               helpClose();
+       } else if (window.jush) {
                helpOpen = 1;
                var help = document.getElementById('help');
                help.innerHTML = text;
@@ -627,11 +634,13 @@ function helpMouseover(el, text, right) {
                        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';
+               help.style.top = (top - (side ? (help.offsetHeight - el.offsetHeight) / 2 : help.offsetHeight)) + 'px';
+               help.style.left = (left - (side ? help.offsetWidth : (help.offsetWidth - el.offsetWidth) / 2)) + 'px';
        }
 }
 
+/** Close help after timeout
+*/
 function helpMouseout() {
        helpOpen = 0;
        setTimeout(function () {
@@ -641,6 +650,8 @@ function helpMouseout() {
        }, 200);
 }
 
+/** Close help
+*/
 function helpClose() {
        alterClass(document.getElementById('help'), 'hidden', true);
 }
index 03800a21fc6e2f373fc8efa686294d30ffb04222..3e8c06832e98f080ba14178af41b328416d0b72a 100644 (file)
@@ -351,7 +351,7 @@ function isCtrl(event) {
 
 /** Return event target
 * @param Event
-* @return HtmlElement
+* @return HTMLElement
 */
 function getTarget(event) {
        return event.target || event.srcElement;
@@ -429,6 +429,7 @@ function functionChange(select) {
        } else if (input.origMaxLength >= 0) {
                input.maxLength = input.origMaxLength;
        }
+       helpClose();
 }
 
 
index 85b6e1e9734eb01ebf4364d7f4ffdd18a8545d4d..7df46998eca7ae1fd56f6ec48d7bf08dea09127d 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 85b6e1e9734eb01ebf4364d7f4ffdd18a8545d4d
+Subproject commit 7df46998eca7ae1fd56f6ec48d7bf08dea09127d