File: mail.js

package info (click to toggle)
tt-rss 21~git20210204.b4cbc79%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 12,436 kB
  • sloc: php: 29,355; javascript: 13,884; sql: 2,341; sh: 315; makefile: 81; perl: 9
file content (56 lines) | stat: -rw-r--r-- 1,318 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
Plugins.Mail = {
	send: function(id) {
		if (!id) {
			let ids = Headlines.getSelected();

			if (ids.length == 0) {
				alert(__("No articles selected."));
				return;
			}

			id = ids.toString();
		}

		if (dijit.byId("emailArticleDlg"))
			dijit.byId("emailArticleDlg").destroyRecursive();

		const query = "backend.php?op=pluginhandler&plugin=mail&method=emailArticle&param=" + encodeURIComponent(id);

		const dialog = new dijit.Dialog({
			id: "emailArticleDlg",
			title: __("Forward article by email"),
			style: "width: 600px",
			execute: function () {
				if (this.validate()) {
					xhrJson("backend.php", this.attr('value'), (reply) => {
						if (reply) {
							const error = reply['error'];

							if (error) {
								alert(__('Error sending email:') + ' ' + error);
							} else {
								Notify.info('Your message has been sent.');
								dialog.hide();
							}

						}
					});
				}
			},
			href: query
		});

		/* var tmph = dojo.connect(dialog, 'onLoad', function() {
		dojo.disconnect(tmph);

		   new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices',
			   "backend.php?op=pluginhandler&plugin=mail&method=completeEmails",
			   { tokens: '', paramName: "search" });
		}); */

		dialog.show();
	},
	onHotkey: function(id) {
		Plugins.Mail.send(id);
	}
};