mirror of
https://github.com/vrana/adminer.git
synced 2025-08-18 04:11:27 +02:00
Use @this in JavaScript (prepares for removing inline event handlers)
This commit is contained in:
@@ -309,7 +309,7 @@ focus(qs('#username'));
|
||||
$select[""] = array();
|
||||
foreach ($select as $key => $val) {
|
||||
$val = $_GET["columns"][$key];
|
||||
$column = select_input(" name='columns[$i][col]' onchange='" . ($key !== "" ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";'", $columns, $val["col"]);
|
||||
$column = select_input(" name='columns[$i][col]' onchange='" . ($key !== "" ? "selectFieldChange(this.form)" : "selectAddRow.call(this)") . ";'", $columns, $val["col"]);
|
||||
echo "<div>" . ($functions || $grouping ? "<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 => "") + array_filter(array(lang('Functions') => $functions, lang('Aggregation') => $grouping)), $val["fun"]) . "</select>"
|
||||
. "($column)" : $column) . "</div>\n";
|
||||
@@ -342,7 +342,7 @@ focus(qs('#username'));
|
||||
if (!$val || ("$val[col]$val[val]" != "" && in_array($val["op"], $this->operators))) {
|
||||
echo "<div>" . select_input(" name='where[$i][col]' onchange='$change_next'", $columns, $val["col"], "(" . lang('anywhere') . ")");
|
||||
echo html_select("where[$i][op]", $this->operators, $val["op"], $change_next);
|
||||
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow(this)") . ";' onkeydown='selectSearchKeydown(this, event);' onsearch='selectSearchSearch(this);'></div>\n";
|
||||
echo "<input type='search' name='where[$i][val]' value='" . h($val["val"]) . "' onchange='" . ($val ? "selectFieldChange(this.form)" : "selectAddRow.call(this)") . ";' onkeydown='selectSearchKeydown.call(this, event);' onsearch='selectSearchSearch.call(this);'></div>\n";
|
||||
}
|
||||
}
|
||||
echo "</div></fieldset>\n";
|
||||
@@ -364,7 +364,7 @@ focus(qs('#username'));
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
echo "<div>" . select_input(" name='order[$i]' onchange='selectAddRow(this);'", $columns);
|
||||
echo "<div>" . select_input(" name='order[$i]' onchange='selectAddRow.call(this);'", $columns);
|
||||
echo checkbox("desc[$i]", 1, false, lang('descending')) . "</div>\n";
|
||||
echo "</div></fieldset>\n";
|
||||
}
|
||||
@@ -852,7 +852,7 @@ focus(qs('#username'));
|
||||
foreach ($usernames as $username => $password) {
|
||||
if ($password !== null) {
|
||||
if ($first) {
|
||||
echo "<p id='logins' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
|
||||
echo "<p id='logins' onmouseover='menuOver.call(this, event);' onmouseout='menuOut.call(this);'>\n";
|
||||
$first = false;
|
||||
}
|
||||
$dbs = $_SESSION["db"][$vendor][$server][$username];
|
||||
@@ -924,7 +924,7 @@ bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info,
|
||||
<p id="dbs">
|
||||
<?php
|
||||
hidden_fields_get();
|
||||
$db_events = " onmousedown='dbMouseDown(event, this);' onchange='dbChange(this);'";
|
||||
$db_events = " onmousedown='dbMouseDown.call(this, event);' onchange='dbChange.call(this);'";
|
||||
echo "<span title='" . lang('database') . "'>DB</span>: " . ($databases
|
||||
? "<select name='db'$db_events>" . optionlist(array("" => "") + $databases, DB) . "</select>"
|
||||
: '<input name="db" value="' . h(DB) . '" autocapitalize="off">'
|
||||
@@ -951,7 +951,7 @@ bodyLoad('<?php echo (is_object($connection) ? substr($connection->server_info,
|
||||
* @return null
|
||||
*/
|
||||
function tablesPrint($tables) {
|
||||
echo "<ul id='tables' onmouseover='menuOver(this, event);' onmouseout='menuOut(this);'>\n";
|
||||
echo "<ul id='tables' onmouseover='menuOver.call(this, event);' onmouseout='menuOut.call(this);'>\n";
|
||||
foreach ($tables as $table => $status) {
|
||||
echo '<li><a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table, "select") . ">" . lang('select') . "</a> ";
|
||||
$name = $this->tableName($status);
|
||||
|
@@ -56,7 +56,7 @@ function connect_error() {
|
||||
echo "</table>\n";
|
||||
echo (support("database")
|
||||
? "<fieldset><legend>" . lang('Selected') . " <span id='selected'></span></legend><div>\n"
|
||||
. "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked(this, /^db/));\">\n" // used by trCheck()
|
||||
. "<input type='hidden' name='all' value='' onclick=\"selectCount('selected', formChecked.call(this, /^db/));\">\n" // used by trCheck()
|
||||
. "<input type='submit' name='drop' value='" . lang('Drop') . "'" . confirm() . ">\n"
|
||||
. "</div></fieldset>\n"
|
||||
: ""
|
||||
|
@@ -39,7 +39,7 @@ document.body.className = document.body.className.replace(/ nojs/, ' js');
|
||||
var offlineMessage = '<?php echo js_escape(lang('You are offline.')); ?>';
|
||||
</script>
|
||||
|
||||
<div id="help" class="jush-<?php echo $jush; ?> jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout(this, event);"></div>
|
||||
<div id="help" class="jush-<?php echo $jush; ?> jsonly hidden" onmouseover="helpOpen = 1;" onmouseout="helpMouseout.call(this, event);"></div>
|
||||
|
||||
<div id="content">
|
||||
<?php
|
||||
|
@@ -150,7 +150,7 @@ if ($foreign_keys) {
|
||||
}
|
||||
echo optionlist($structured_types, $type);
|
||||
?></select>
|
||||
<td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus(this);"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); ?> onchange="editingLengthChange(this);" onkeyup="this.onchange();" aria-labelledby="label-length"><td class="options"><?php //! type="number" with enabled JavaScript
|
||||
<td><input name="<?php echo h($key); ?>[length]" value="<?php echo h($field["length"]); ?>" size="3" onfocus="editingLengthFocus.call(this);"<?php echo (!$field["length"] && preg_match('~var(char|binary)$~', $type) ? " class='required'" : ""); ?> onchange="editingLengthChange.call(this);" onkeyup="this.onchange();" aria-labelledby="label-length"><td class="options"><?php //! type="number" with enabled JavaScript
|
||||
echo "<select name='" . h($key) . "[collation]'" . (preg_match('~(char|text|enum|set)$~', $type) ? "" : " class='hidden'") . '><option value="">(' . lang('collation') . ')' . optionlist($collations, $field["collation"]) . '</select>';
|
||||
echo ($unsigned ? "<select name='" . h($key) . "[unsigned]'" . (!$type || preg_match('~((^|[^o])int|float|double|decimal)$~', $type) ? "" : " class='hidden'") . '><option>' . optionlist($unsigned, $field["unsigned"]) . '</select>' : '');
|
||||
echo (isset($field['on_update']) ? "<select name='" . h($key) . "[on_update]'" . (preg_match('~timestamp|datetime~', $type) ? "" : " class='hidden'") . '>' . optionlist(array("" => "(" . lang('ON UPDATE') . ")", "CURRENT_TIMESTAMP"), $field["on_update"]) . '</select>' : '');
|
||||
@@ -239,7 +239,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||
<thead><tr class="wrap">
|
||||
<?php if ($type == "PROCEDURE") { ?><td> <?php } ?>
|
||||
<th id="label-name"><?php echo ($type == "TABLE" ? lang('Column name') : lang('Parameter name')); ?>
|
||||
<td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur(this);"></textarea>
|
||||
<td id="label-type"><?php echo lang('Type'); ?><textarea id="enum-edit" rows="4" cols="12" wrap="off" style="display: none;" onblur="editingLengthBlur.call(this);"></textarea>
|
||||
<td id="label-length"><?php echo lang('Length'); ?>
|
||||
<td><?php echo lang('Options'); /* no label required, options have their own label */ ?>
|
||||
<?php if ($type == "TABLE") { ?>
|
||||
@@ -264,7 +264,7 @@ function edit_fields($fields, $collations, $type = "TABLE", $foreign_keys = arra
|
||||
?>
|
||||
<tr<?php echo ($display ? "" : " style='display: none;'"); ?>>
|
||||
<?php echo ($type == "PROCEDURE" ? "<td>" . html_select("fields[$i][inout]", explode("|", $inout), $field["inout"]) : ""); ?>
|
||||
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="editingNameChange(this);<?php echo ($field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow(this);" onkeyup="if (this.value) editingAddRow(this);'); ?>" maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php } ?>
|
||||
<th><?php if ($display) { ?><input name="fields[<?php echo $i; ?>][field]" value="<?php echo h($field["field"]); ?>" onchange="editingNameChange.call(this);<?php echo ($field["field"] != "" || count($fields) > 1 ? '' : ' editingAddRow.call(this);" onkeyup="if (this.value) editingAddRow.call(this);'); ?>" maxlength="64" autocapitalize="off" aria-labelledby="label-name"><?php } ?>
|
||||
<input type="hidden" name="fields[<?php echo $i; ?>][orig]" value="<?php echo h($orig); ?>">
|
||||
<?php edit_type("fields[$i]", $field, $collations, $foreign_keys); ?>
|
||||
<?php if ($type == "TABLE") { ?>
|
||||
@@ -276,11 +276,11 @@ echo checkbox("fields[$i][has_default]", 1, $field["has_default"], "", "", "", "
|
||||
<?php
|
||||
echo "<td>";
|
||||
echo (support("move_col") ?
|
||||
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow(this, 1);'> "
|
||||
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "' onclick='return !editingMoveRow(this, 1);'> "
|
||||
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "' onclick='return !editingMoveRow(this, 0);'> "
|
||||
"<input type='image' class='icon' name='add[$i]' src='../adminer/static/plus.gif' alt='+' title='" . lang('Add next') . "' onclick='return !editingAddRow.call(this, 1);'> "
|
||||
. "<input type='image' class='icon' name='up[$i]' src='../adminer/static/up.gif' alt='^' title='" . lang('Move up') . "' onclick='return !editingMoveRow.call(this, 1);'> "
|
||||
. "<input type='image' class='icon' name='down[$i]' src='../adminer/static/down.gif' alt='v' title='" . lang('Move down') . "' onclick='return !editingMoveRow.call(this, 0);'> "
|
||||
: "");
|
||||
echo ($orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow(this, 'fields\$1[field]');\">" : "");
|
||||
echo ($orig == "" || support("drop_col") ? "<input type='image' class='icon' name='drop_col[$i]' src='../adminer/static/cross.gif' alt='x' title='" . lang('Remove') . "' onclick=\"return !editingRemoveRow.call(this, 'fields\$1[field]');\">" : "");
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
@@ -878,7 +878,7 @@ function input($field, $value, $function) {
|
||||
$attrs .= $onchange;
|
||||
$has_function = (in_array($function, $functions) || isset($functions[$function]));
|
||||
echo (count($functions) > 1
|
||||
? "<select name='function[$name]' onchange='functionChange(this);'" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . ">" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>"
|
||||
? "<select name='function[$name]' onchange='functionChange.call(this);'" . on_help("getTarget(event).value.replace(/^SQL\$/, '')", 1) . ">" . optionlist($functions, $function === null || $has_function ? $function : "") . "</select>"
|
||||
: nbsp(reset($functions))
|
||||
) . '<td>';
|
||||
$input = $adminer->editInput($_GET["edit"], $field, $attrs, $value); // usage in call is without a table
|
||||
@@ -1296,7 +1296,7 @@ function lzw_decompress($binary) {
|
||||
* @return string
|
||||
*/
|
||||
function on_help($command, $side = 0) {
|
||||
return " onmouseover='helpMouseover(this, event, " . h($command) . ", $side);' onmouseout='helpMouseout(this, event);'";
|
||||
return " onmouseover='helpMouseover.call(this, event, " . h($command) . ", $side);' onmouseout='helpMouseout.call(this, event);'";
|
||||
}
|
||||
|
||||
/** Print edit data form
|
||||
@@ -1364,7 +1364,7 @@ function edit_form($TABLE, $fields, $row, $update) {
|
||||
}
|
||||
if (!support("table")) {
|
||||
echo "<tr>"
|
||||
. "<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange(this);' value=''>" // needs empty value for keyupChange()
|
||||
. "<th><input name='field_keys[]' onkeyup='keyupChange.call(this);' onchange='fieldChange.call(this);' value=''>" // needs empty value for keyupChange()
|
||||
. "<td class='function'>" . html_select("field_funs[]", $adminer->editFunctions(array("null" => isset($_GET["select"]))))
|
||||
. "<td><input name='field_vals[]'>"
|
||||
. "\n"
|
||||
|
Reference in New Issue
Block a user