mail, mailto: cleanup markup
This commit is contained in:
parent
7be1e3ed38
commit
2ac6508fe6
|
@ -37,42 +37,44 @@ class Mail extends Plugin {
|
|||
function hook_prefs_tab($args) {
|
||||
if ($args != "prefPrefs") return;
|
||||
|
||||
print "<div dojoType=\"dijit.layout.AccordionPane\"
|
||||
title=\"<i class='material-icons'>mail</i> ".__('Mail plugin')."\">";
|
||||
$addresslist = $this->host->get($this, "addresslist");
|
||||
|
||||
print "<p>" . __("You can set predefined email addressed here (comma-separated list):") . "</p>";
|
||||
?>
|
||||
|
||||
print "<form dojoType=\"dijit.form.Form\">";
|
||||
<div dojoType="dijit.layout.AccordionPane"
|
||||
title="<i class='material-icons'>mail</i> <?= __('Mail plugin') ?>">
|
||||
|
||||
print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
|
||||
evt.preventDefault();
|
||||
if (this.validate()) {
|
||||
console.log(dojo.objectToQuery(this.getValues()));
|
||||
new Ajax.Request('backend.php', {
|
||||
parameters: dojo.objectToQuery(this.getValues()),
|
||||
onComplete: function(transport) {
|
||||
Notify.info(transport.responseText);
|
||||
<form dojoType="dijit.form.Form">
|
||||
<?= \Controls\hidden_tag("op", "pluginhandler") ?>
|
||||
<?= \Controls\hidden_tag("method", "save") ?>
|
||||
<?= \Controls\hidden_tag("plugin", "mail") ?>
|
||||
|
||||
<script type="dojo/method" event="onSubmit" args="evt">
|
||||
evt.preventDefault();
|
||||
if (this.validate()) {
|
||||
console.log(dojo.objectToQuery(this.getValues()));
|
||||
new Ajax.Request('backend.php', {
|
||||
parameters: dojo.objectToQuery(this.getValues()),
|
||||
onComplete: function(transport) {
|
||||
Notify.info(transport.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
//this.reset();
|
||||
}
|
||||
</script>";
|
||||
</script>
|
||||
|
||||
print \Controls\hidden_tag("op", "pluginhandler");
|
||||
print \Controls\hidden_tag("method", "save");
|
||||
print \Controls\hidden_tag("plugin", "mail");
|
||||
<header><?= __("You can set predefined email addressed here (comma-separated list):") ?></header>
|
||||
|
||||
$addresslist = $this->host->get($this, "addresslist");
|
||||
<textarea dojoType="dijit.form.SimpleTextarea" style='font-size : 12px; width : 50%' rows="3"
|
||||
name='addresslist'><?= $addresslist ?></textarea>
|
||||
|
||||
print "<textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 50%' rows=\"3\"
|
||||
name='addresslist'>$addresslist</textarea>";
|
||||
<hr/>
|
||||
|
||||
print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
|
||||
__("Save")."</button>";
|
||||
<?= \Controls\submit_tag(__("Save")) ?>
|
||||
|
||||
print "</form>";
|
||||
</form>
|
||||
|
||||
print "</div>";
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function hook_article_button($line) {
|
||||
|
@ -86,11 +88,6 @@ class Mail extends Plugin {
|
|||
$ids = explode(",", clean($_REQUEST['ids']));
|
||||
$ids_qmarks = arr_qmarks($ids);
|
||||
|
||||
print "<form onsubmit=\"return false\">";
|
||||
|
||||
print \Controls\hidden_tag("op", "pluginhandler");
|
||||
print \Controls\hidden_tag("plugin", "mail");
|
||||
print \Controls\hidden_tag("method", "sendEmail");
|
||||
|
||||
$sth = $this->pdo->prepare("SELECT email, full_name FROM ttrss_users WHERE
|
||||
id = ?");
|
||||
|
@ -107,9 +104,6 @@ class Mail extends Plugin {
|
|||
if (!$user_name)
|
||||
$user_name = $_SESSION['name'];
|
||||
|
||||
print \Controls\hidden_tag("from_email", "$user_email");
|
||||
print \Controls\hidden_tag("from_name", "$user_name");
|
||||
|
||||
$tpl = new Templator();
|
||||
|
||||
$tpl->readTemplateFromFile("email_article_template.txt");
|
||||
|
@ -150,40 +144,58 @@ class Mail extends Plugin {
|
|||
$content = "";
|
||||
$tpl->generateOutputToString($content);
|
||||
|
||||
print "<table width='100%'><tr><td>";
|
||||
|
||||
$addresslist = explode(",", $this->host->get($this, "addresslist"));
|
||||
|
||||
print __('To:');
|
||||
?>
|
||||
|
||||
print "</td><td>";
|
||||
<form dojoType='dijit.form.Form'>
|
||||
|
||||
print \Controls\select_tag("destination", "", $addresslist,
|
||||
["style" => "width: 30em", "required" => 1, "dojoType" => "dijit.form.ComboBox"]);
|
||||
<?= \Controls\hidden_tag("op", "pluginhandler") ?>
|
||||
<?= \Controls\hidden_tag("plugin", "mail") ?>
|
||||
<?= \Controls\hidden_tag("method", "sendEmail") ?>
|
||||
|
||||
print "</td></tr><tr><td>";
|
||||
<?= \Controls\hidden_tag("from_email", "$user_email") ?>
|
||||
<?= \Controls\hidden_tag("from_name", "$user_name") ?>
|
||||
|
||||
print __('Subject:');
|
||||
<script type='dojo/method' event='onSubmit' args='evt'>
|
||||
evt.preventDefault();
|
||||
if (this.validate()) {
|
||||
xhrJson("backend.php", this.getValues(), (reply) => {
|
||||
if (reply && reply.error)
|
||||
Notify.error(reply.error);
|
||||
else
|
||||
this.hide();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
print "</td><td>";
|
||||
<section>
|
||||
<fieldset class='narrow'>
|
||||
<label><?= __('To:') ?></label>
|
||||
<?= \Controls\select_tag("destination", "", $addresslist,
|
||||
["style" => "width: 380px", "required" => 1, "dojoType" => "dijit.form.ComboBox"]) ?>
|
||||
</fieldset>
|
||||
</section>
|
||||
|
||||
print "<input dojoType='dijit.form.ValidationTextBox' required='true'
|
||||
style='width : 30em;' name='subject' value=\"$subject\" id='subject'>";
|
||||
<section>
|
||||
<fieldset class='narrow'>
|
||||
<label><?= __('Subject:') ?></label>
|
||||
<input dojoType='dijit.form.ValidationTextBox' required='true'
|
||||
style='width : 380px' name='subject' value="<?= htmlspecialchars($subject) ?>" id='subject'>
|
||||
</fieldset>
|
||||
</section>
|
||||
|
||||
print "</td></tr>";
|
||||
<textarea dojoType='dijit.form.SimpleTextarea'
|
||||
style='height : 200px; font-size : 12px; width : 98%' rows="20"
|
||||
name='content'><?= $content ?></textarea>
|
||||
|
||||
print "<tr><td colspan='2'><textarea dojoType='dijit.form.SimpleTextarea'
|
||||
style='height : 200px; font-size : 12px; width : 98%' rows=\"20\"
|
||||
name='content'>$content</textarea>";
|
||||
<footer>
|
||||
<?= \Controls\submit_tag(__('Send email')) ?>
|
||||
<?= \Controls\cancel_dialog_tag(__('Cancel')) ?>
|
||||
</footer>
|
||||
|
||||
print "</td></tr></table>";
|
||||
|
||||
print "<footer>";
|
||||
print \Controls\submit_tag(__('Send email'));
|
||||
print \Controls\cancel_dialog_tag(__('Cancel'));
|
||||
print "</footer>";
|
||||
|
||||
print "</form>";
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
function sendEmail() {
|
||||
|
|
|
@ -14,7 +14,7 @@ Plugins.Mailto = {
|
|||
}
|
||||
|
||||
const dialog = new fox.SingleUseDialog({
|
||||
title: __("Forward article by email"),
|
||||
title: __("Forward article by email (mailto:)"),
|
||||
content: __("Loading, please wait...")
|
||||
});
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class MailTo extends Plugin {
|
|||
}
|
||||
|
||||
function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) {
|
||||
return "<div dojoType='dijit.MenuItem' onclick='Plugins.Mailto.send()'>".__('Forward by email')."</div>";
|
||||
return "<div dojoType='dijit.MenuItem' onclick='Plugins.Mailto.send()'>".__('Forward by email (mailto:)')."</div>";
|
||||
}
|
||||
|
||||
function get_js() {
|
||||
|
@ -26,7 +26,7 @@ class MailTo extends Plugin {
|
|||
function hook_article_button($line) {
|
||||
return "<i class='material-icons' style=\"cursor : pointer\"
|
||||
onclick=\"Plugins.Mailto.send(".$line["id"].")\"
|
||||
title='".__('Forward by email')."'>mail_outline</i>";
|
||||
title='".__('Forward by email (mailto:)')."'>mail_outline</i>";
|
||||
}
|
||||
|
||||
function emailArticle() {
|
||||
|
@ -42,7 +42,6 @@ class MailTo extends Plugin {
|
|||
//$tpl->setVariable('USER_EMAIL', $user_email, true);
|
||||
$tpl->setVariable('TTRSS_HOST', $_SERVER["HTTP_HOST"], true);
|
||||
|
||||
|
||||
$sth = $this->pdo->prepare("SELECT DISTINCT link, content, title
|
||||
FROM ttrss_user_entries, ttrss_entries WHERE id = ref_id AND
|
||||
id IN ($ids_qmarks) AND owner_uid = ?");
|
||||
|
@ -70,25 +69,23 @@ class MailTo extends Plugin {
|
|||
$content = "";
|
||||
$tpl->generateOutputToString($content);
|
||||
|
||||
$mailto_link = htmlspecialchars("mailto:?subject=".rawurlencode($subject).
|
||||
"&body=".rawurlencode($content));
|
||||
$mailto_link = "mailto:?subject=".rawurlencode($subject)."&body=".rawurlencode($content);
|
||||
|
||||
print __("Clicking the following link to invoke your mail client:");
|
||||
?>
|
||||
|
||||
print "<div class='panel text-center'>";
|
||||
print "<a target=\"_blank\" href=\"$mailto_link\">".
|
||||
__("Forward selected article(s) by email.")."</a>";
|
||||
print "</div>";
|
||||
<section>
|
||||
<div class='panel text-center'>
|
||||
<a target="_blank" href="<?= htmlspecialchars($mailto_link) ?>">
|
||||
<?= __("Click to open your mail client") ?>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
print __("You should be able to edit the message before sending in your mail client.");
|
||||
<footer class='text-center'>
|
||||
<?= \Controls\submit_tag(__('Close this dialog')) ?>
|
||||
</footer>
|
||||
|
||||
print "<p>";
|
||||
|
||||
print "<footer class='text-center'>";
|
||||
print \Controls\submit_tag(__('Close this dialog'));
|
||||
print "</footer>";
|
||||
|
||||
//return;
|
||||
<?php
|
||||
}
|
||||
|
||||
function api_version() {
|
||||
|
|
Loading…
Reference in New Issue