Move inline event handlers to <script>
This commit is contained in:
parent
fc559a1cf6
commit
d39a6e59c7
|
@ -28,12 +28,19 @@ class AdminerEmailTable {
|
||||||
function selectEmailPrint($emailFields, $columns) {
|
function selectEmailPrint($emailFields, $columns) {
|
||||||
if ($emailFields) {
|
if ($emailFields) {
|
||||||
print_fieldset("email", ('E-mail'));
|
print_fieldset("email", ('E-mail'));
|
||||||
echo "<div onkeydown=\"return bodyKeydown(event, 'email');\">\n";
|
echo "<div>\n";
|
||||||
|
echo script("qsl('div').onkeydown = partial(bodyKeydown, 'email');");
|
||||||
echo "<p>" . ('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
|
echo "<p>" . ('From') . ": <input name='email_from' value='" . h($_POST ? $_POST["email_from"] : $_COOKIE["adminer_email"]) . "'>\n";
|
||||||
echo ('Subject') . ": <select name='email_id'><option>" . optionlist(get_key_vals("SELECT $this->id, $this->title FROM $this->table ORDER BY $this->title"), $_POST["email_id"], true) . "</select>\n";
|
echo ('Subject') . ": <select name='email_id'><option>" . optionlist(get_key_vals("SELECT $this->id, $this->title FROM $this->table ORDER BY $this->title"), $_POST["email_id"], true) . "</select>\n";
|
||||||
echo "<p>" . ('Attachments') . ": <input type='file' name='email_files[]' onchange=\"this.onchange = function () { }; var el = this.cloneNode(true); el.value = ''; this.parentNode.appendChild(el);\">";
|
echo "<p>" . ('Attachments') . ": <input type='file' name='email_files[]'>";
|
||||||
|
echo script("qsl('input').onchange = function () {
|
||||||
|
this.onchange = function () { };
|
||||||
|
var el = this.cloneNode(true);
|
||||||
|
el.value = '';
|
||||||
|
this.parentNode.appendChild(el);
|
||||||
|
};");
|
||||||
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
|
echo "<p>" . (count($emailFields) == 1 ? '<input type="hidden" name="email_field" value="' . h(key($emailFields)) . '">' : html_select("email_field", $emailFields));
|
||||||
echo "<input type='submit' name='email' value='" . ('Send') . "' onclick=\"return this.form['delete'].onclick();\">\n";
|
echo "<input type='submit' name='email' value='" . ('Send') . "'>" . confirm();
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
echo "</div></fieldset>\n";
|
echo "</div></fieldset>\n";
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -34,7 +34,16 @@ class AdminerSlugify {
|
||||||
}
|
}
|
||||||
$slug = $slugify[$field["field"]];
|
$slug = $slugify[$field["field"]];
|
||||||
if ($slug !== null) {
|
if ($slug !== null) {
|
||||||
return "<input value='" . h($value) . "' maxlength='$field[length]' size='40'$attrs onchange=\"var find = '$this->from'; var repl = '$this->to'; this.form['fields[$slug]'].value = this.value.toLowerCase().replace(new RegExp('[' + find + ']', 'g'), function (str) { return repl[find.indexOf(str)]; }).replace(/[^a-z0-9_]+/g, '-').replace(/^-|-\$/g, '').substr(0, $field[length]);\">";
|
return "<input value='" . h($value) . "' maxlength='$field[length]' size='40'$attrs>"
|
||||||
|
. script("qsl('input').onchange = function () {
|
||||||
|
var find = '$this->from';
|
||||||
|
var repl = '$this->to';
|
||||||
|
this.form['fields[$slug]'].value = this.value.toLowerCase()
|
||||||
|
.replace(new RegExp('[' + find + ']', 'g'), function (str) { return repl[find.indexOf(str)]; })
|
||||||
|
.replace(/[^a-z0-9_]+/g, '-')
|
||||||
|
.replace(/^-|-\$/g, '')
|
||||||
|
.substr(0, $field[length]);
|
||||||
|
};");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,9 +8,10 @@
|
||||||
*/
|
*/
|
||||||
class AdminerTablesFilter {
|
class AdminerTablesFilter {
|
||||||
function tablesPrint($tables) { ?>
|
function tablesPrint($tables) { ?>
|
||||||
<p class="jsonly"><input id="filter-field" oninput="tablesFilterInput();" autocomplete="off">
|
<p class="jsonly"><input id="filter-field" autocomplete="off"><?php echo script("qs('#filter-field').oninput = tablesFilterInput;"); ?>
|
||||||
<ul id='tables' onmouseover='menuOver.call(this, event);' onmouseout='menuOut.call(this);'>
|
<ul id='tables'>
|
||||||
<?php
|
<?php
|
||||||
|
echo script("mixin(qs('#tables'), {onmouseover: menuOver, onmouseout: menuOut});");
|
||||||
foreach ($tables as $table => $status) {
|
foreach ($tables as $table => $status) {
|
||||||
echo '<li data-table-name="' . h($table) . '"><a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table, "select") . ">" . lang('select') . "</a> ";
|
echo '<li data-table-name="' . h($table) . '"><a href="' . h(ME) . 'select=' . urlencode($table) . '"' . bold($_GET["select"] == $table || $_GET["edit"] == $table, "select") . ">" . lang('select') . "</a> ";
|
||||||
$name = h($status["Name"]);
|
$name = h($status["Name"]);
|
||||||
|
|
Loading…
Reference in a new issue