summaryrefslogtreecommitdiff
path: root/plugins/mailto
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mailto')
-rw-r--r--plugins/mailto/init.js19
-rw-r--r--plugins/mailto/init.php40
-rw-r--r--plugins/mailto/mail.pngbin821 -> 0 bytes
3 files changed, 34 insertions, 25 deletions
diff --git a/plugins/mailto/init.js b/plugins/mailto/init.js
index ae68bf49b..4a9557249 100644
--- a/plugins/mailto/init.js
+++ b/plugins/mailto/init.js
@@ -1,4 +1,4 @@
-/* global Plugins, Headlines, fox, __ */
+/* global Plugins, Headlines, xhr, dojo, fox, __ */
Plugins.Mailto = {
send: function (id) {
@@ -13,12 +13,19 @@ Plugins.Mailto = {
id = ids.toString();
}
- const query = "backend.php?op=pluginhandler&plugin=mailto&method=emailArticle&param=" + encodeURIComponent(id);
-
const dialog = new fox.SingleUseDialog({
- id: "emailArticleDlg",
- title: __("Forward article by email"),
- href: query});
+ title: __("Forward article by email (mailto:)"),
+ content: __("Loading, please wait...")
+ });
+
+ const tmph = dojo.connect(dialog, 'onShow', function () {
+ dojo.disconnect(tmph);
+
+ xhr.post("backend.php", App.getPhArgs("mailto", "emailArticle", {ids: id}), (reply) => {
+ dialog.attr('content', reply);
+ });
+ });
+
dialog.show();
}
diff --git a/plugins/mailto/init.php b/plugins/mailto/init.php
index 390984b71..c34b400ce 100644
--- a/plugins/mailto/init.php
+++ b/plugins/mailto/init.php
@@ -12,21 +12,26 @@ class MailTo extends Plugin {
$this->host = $host;
$host->add_hook($host::HOOK_ARTICLE_BUTTON, $this);
+ $host->add_hook($host::HOOK_HEADLINE_TOOLBAR_SELECT_MENU_ITEM, $this);
+ }
+
+ function hook_headline_toolbar_select_menu_item($feed_id, $is_cat) {
+ return "<div dojoType='dijit.MenuItem' onclick='Plugins.Mailto.send()'>".__('Forward by email (mailto:)')."</div>";
}
function get_js() {
- return file_get_contents(dirname(__FILE__) . "/init.js");
+ return file_get_contents(__DIR__ . "/init.js");
}
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() {
- $ids = explode(",", $_REQUEST['param']);
+ $ids = explode(",", clean($_REQUEST['ids']));
$ids_qmarks = arr_qmarks($ids);
$tpl = new Templator();
@@ -37,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 = ?");
@@ -65,25 +69,23 @@ class MailTo extends Plugin {
$content = "";
$tpl->generateOutputToString($content);
- $mailto_link = htmlspecialchars("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>";
+ $mailto_link = "mailto:?subject=".rawurlencode($subject)."&body=".rawurlencode($content);
- print __("You should be able to edit the message before sending in your mail client.");
+ ?>
- print "<p>";
+ <section>
+ <div class='panel text-center'>
+ <a target="_blank" href="<?= htmlspecialchars($mailto_link) ?>">
+ <?= __("Click to open your mail client") ?>
+ </a>
+ </div>
+ </section>
- print "<footer class='text-center'>";
- print "<button dojoType='dijit.form.Button' onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Close this dialog')."</button>";
- print "</footer>";
+ <footer class='text-center'>
+ <?= \Controls\submit_tag(__('Close this dialog')) ?>
+ </footer>
- //return;
+ <?php
}
function api_version() {
diff --git a/plugins/mailto/mail.png b/plugins/mailto/mail.png
deleted file mode 100644
index 2c49f78a6..000000000
--- a/plugins/mailto/mail.png
+++ /dev/null
Binary files differ