Display help for functions and MySQL engines
This commit is contained in:
parent
f8453fe65c
commit
3b3d169c72
|
@ -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 } ?>
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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();'";
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
|
2
externals/jush
vendored
2
externals/jush
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 85b6e1e9734eb01ebf4364d7f4ffdd18a8545d4d
|
||||
Subproject commit 7df46998eca7ae1fd56f6ec48d7bf08dea09127d
|
Loading…
Reference in a new issue