1
0
mirror of https://github.com/vrana/adminer.git synced 2025-08-13 10:04:07 +02:00

Move inline event handlers to <script>

This commit is contained in:
Jakub Vrana
2018-01-13 09:34:01 +01:00
parent fc559a1cf6
commit d39a6e59c7
3 changed files with 23 additions and 6 deletions

View File

@@ -28,12 +28,19 @@ class AdminerEmailTable {
function selectEmailPrint($emailFields, $columns) {
if ($emailFields) {
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 ('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 "<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></fieldset>\n";
return true;