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