]>
Commit | Line | Data |
---|---|---|
1baac280 AD |
1 | function emailArticle(id) { |
2 | try { | |
3 | if (!id) { | |
4 | var ids = getSelectedArticleIds2(); | |
5 | ||
6 | if (ids.length == 0) { | |
7 | alert(__("No articles are selected.")); | |
8 | return; | |
9 | } | |
10 | ||
11 | id = ids.toString(); | |
12 | } | |
13 | ||
14 | if (dijit.byId("emailArticleDlg")) | |
15 | dijit.byId("emailArticleDlg").destroyRecursive(); | |
16 | ||
17 | var query = "backend.php?op=rpc&method=buttonPlugin&plugin=mail&plugin_method=emailArticle¶m=" + param_escape(id); | |
18 | ||
19 | dialog = new dijit.Dialog({ | |
20 | id: "emailArticleDlg", | |
21 | title: __("Forward article by email"), | |
22 | style: "width: 600px", | |
23 | execute: function() { | |
24 | if (this.validate()) { | |
25 | ||
26 | new Ajax.Request("backend.php", { | |
27 | parameters: dojo.objectToQuery(this.attr('value')), | |
28 | onComplete: function(transport) { | |
29 | ||
30 | var reply = JSON.parse(transport.responseText); | |
31 | ||
32 | var error = reply['error']; | |
33 | ||
34 | if (error) { | |
35 | alert(__('Error sending email:') + ' ' + error); | |
36 | } else { | |
37 | notify_info('Your message has been sent.'); | |
38 | dialog.hide(); | |
39 | } | |
40 | ||
41 | } }); | |
42 | } | |
43 | }, | |
44 | href: query}); | |
45 | ||
46 | var tmph = dojo.connect(dialog, 'onLoad', function() { | |
47 | dojo.disconnect(tmph); | |
48 | ||
49 | new Ajax.Autocompleter('emailArticleDlg_destination', 'emailArticleDlg_dst_choices', | |
50 | "backend.php?op=rpc&method=buttonPlugin&plugin=mail&plugin_method=completeEmails", | |
51 | { tokens: '', paramName: "search" }); | |
52 | }); | |
53 | ||
54 | dialog.show(); | |
55 | ||
56 | } catch (e) { | |
57 | exception_error("emailArticle", e); | |
58 | } | |
59 | } | |
60 | ||
61 |