]> git.joonet.de Git - adminer.git/commitdiff
Move inline event handlers to <script>
authorJakub Vrana <jakub@vrana.cz>
Fri, 12 Jan 2018 15:05:14 +0000 (16:05 +0100)
committerJakub Vrana <jakub@vrana.cz>
Fri, 12 Jan 2018 16:11:29 +0000 (17:11 +0100)
adminer/create.inc.php
adminer/static/editing.js

index fe9ee68c11e3fc177fe72cbcce95a54d76b4672c..187addcef7ecab78e28d8b99292e2f182dce4dbf 100644 (file)
@@ -164,7 +164,7 @@ foreach ($engines as $engine) {
 <?php if (support("columns") || $TABLE == "") { ?>
 <?php echo lang('Table name'); ?>: <input name="name" maxlength="64" value="<?php echo h($row["name"]); ?>" autocapitalize="off">
 <?php if ($TABLE == "" && !$_POST) { echo script("focus(qs('#form')['name']);"); } ?>
-<?php echo ($engines ? "<select name='Engine' onchange='helpClose();'" . on_help("getTarget(event).value", 1) . ">" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" : ""); ?>
+<?php echo ($engines ? "<select name='Engine'" . on_help("getTarget(event).value", 1) . ">" . optionlist(array("" => "(" . lang('engine') . ")") + $engines, $row["Engine"]) . "</select>" . script("qsl('select').onchange = helpClose;") : ""); ?>
  <?php echo ($collations && !preg_match("~sqlite|mssql~", $jush) ? html_select("Collation", array("" => "(" . lang('collation') . ")") + $collations, $row["Collation"]) : ""); ?>
  <input type="submit" value="<?php echo lang('Save'); ?>">
 <?php } ?>
@@ -189,7 +189,8 @@ edit_fields($row["fields"], $collations, "TABLE", $foreign_keys, $comments);
 <?php echo checkbox("defaults", 1, true, lang('Default values'), "columnShow(this.checked, 5)", "jsonly"); ?>
 <?php if (!$_POST["defaults"]) { echo script("editingHideDefaults();"); } ?>
 <?php echo (support("comment")
-       ? "<label><input type='checkbox' name='comments' value='1' class='jsonly' onclick=\"columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus();\"" . ($comments ? " checked" : "") . ">" . lang('Comment') . "</label>"
+       ? "<label><input type='checkbox' name='comments' value='1' class='jsonly'" . ($comments ? " checked" : "") . ">" . lang('Comment') . "</label>"
+               . script("qsl('input').onclick = function () { columnShow(this.checked, 6); toggle('Comment'); if (this.checked) this.form['Comment'].focus(); };")
                . ' <input name="Comment" id="Comment" value="' . h($row["Comment"]) . '" maxlength="' . ($connection->server_info >= 5.5 ? 2048 : 60) . '"' . ($comments ? '' : ' class="hidden"') . '>'
        : '')
 ; ?>
@@ -204,7 +205,7 @@ if (support("partitioning")) {
        print_fieldset("partition", lang('Partition by'), $row["partition_by"]);
        ?>
 <p>
-<?php echo "<select name='partition_by' onchange='partitionByChange.call(this);'" . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . ">" . optionlist(array("" => "") + $partition_by, $row["partition_by"]) . "</select>"; ?>
+<?php echo "<select name='partition_by'" . on_help("getTarget(event).value.replace(/./, 'PARTITION BY \$&')", 1) . ">" . optionlist(array("" => "") + $partition_by, $row["partition_by"]) . "</select>" . script("qsl('select').onchange = partitionByChange;"); ?>
 (<input name="partition" value="<?php echo h($row["partition"]); ?>">)
 <?php echo lang('Partitions'); ?>: <input type="number" name="partitions" class="size<?php echo ($partition_table || !$row["partition_by"] ? " hidden" : ""); ?>" value="<?php echo h($row["partitions"]); ?>">
 <table cellspacing="0" id="partition-table"<?php echo ($partition_table ? "" : " class='hidden'"); ?>>
@@ -212,7 +213,8 @@ if (support("partitioning")) {
 <?php
 foreach ($row["partition_names"] as $key => $val) {
        echo '<tr>';
-       echo '<td><input name="partition_names[]" value="' . h($val) . '"' . ($key == count($row["partition_names"]) - 1 ? ' onchange="partitionNameChange.call(this);"' : '') . ' autocapitalize="off">';
+       echo '<td><input name="partition_names[]" value="' . h($val) . '" autocapitalize="off">';
+       echo ($key == count($row["partition_names"]) - 1 ? script("qsl('input').onchange = partitionNameChange;") : '');
        echo '<td><input name="partition_values[]" value="' . h($row["partition_values"][$key]) . '">';
 }
 ?>
index 1b46a64f9b5c79841db4e040ecebe36f02f7fa80..e7cfbd48f3e947c680479aa56ea1ddce848d6aa9 100644 (file)
@@ -392,6 +392,7 @@ function partitionByChange() {
 function partitionNameChange() {
        var row = cloneNode(parentTag(this, 'tr'));
        row.firstChild.firstChild.value = '';
+       row.firstChild.firstChild.onchange = this.onchange;
        parentTag(this, 'table').appendChild(row);
        this.onchange = function () {};
 }