From 3e0f2090bfe90756b6a0a8f803ec5c407b50c41e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 2 Jul 2014 10:38:59 +0400 Subject: mail plugin: cleanup disabled completion, add configurable destination email list --- plugins/mail/init.php | 68 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 8 deletions(-) (limited to 'plugins/mail/init.php') diff --git a/plugins/mail/init.php b/plugins/mail/init.php index 5fcdf32af..b2d73d4eb 100644 --- a/plugins/mail/init.php +++ b/plugins/mail/init.php @@ -13,12 +13,61 @@ class Mail extends Plugin { $this->host = $host; $host->add_hook($host::HOOK_ARTICLE_BUTTON, $this); + $host->add_hook($host::HOOK_PREFS_TAB, $this); } function get_js() { return file_get_contents(dirname(__FILE__) . "/mail.js"); } + function save() { + $addresslist = db_escape_string($_POST["addresslist"]); + + $this->host->set($this, "addresslist", $addresslist); + + echo __("Mail addresses saved."); + } + + function hook_prefs_tab($args) { + if ($args != "prefPrefs") return; + + print "
"; + + print "

" . __("You can set predefined email addressed here (comma-separated list):") . "

"; + + print "
"; + + print ""; + + print ""; + print ""; + print ""; + + $addresslist = $this->host->get($this, "addresslist"); + + print ""; + + print "

"; + + print "

"; + + print "
"; + } + function hook_article_button($line) { return "readTemplateFromFile("templates/email_article_template.txt"); @@ -96,16 +144,20 @@ class Mail extends Plugin { print ""; + $addresslist = explode(",", $this->host->get($this, "addresslist")); + print __('To:'); print ""; - print ""; + name=\"destination\" id=\"emailArticleDlg_destination\">"; */ - print "
"; + print_select("destination", "", $addresslist, 'dojoType="dijit.form.FilteringSelect"'); + +/* print "
"; */ print ""; @@ -155,14 +207,14 @@ class Mail extends Plugin { if (!$rc) { $reply['error'] = $mail->ErrorInfo; } else { - save_email_address(db_escape_string($destination)); + //save_email_address(db_escape_string($destination)); $reply['message'] = "UPDATE_COUNTERS"; } print json_encode($reply); } - function completeEmails() { + /* function completeEmails() { $search = db_escape_string($_REQUEST["search"]); print ""; - } + } */ function api_version() { return 2; -- cgit v1.2.3