mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 13:45:56 +00:00
add mail and share plugins
This commit is contained in:
61
js/mail_button.js
Normal file
61
js/mail_button.js
Normal file
@@ -0,0 +1,61 @@
|
||||
function emailArticle(id) {
|
||||
try {
|
||||
if (!id) {
|
||||
var ids = getSelectedArticleIds2();
|
||||
|
||||
if (ids.length == 0) {
|
||||
alert(__("No articles are selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
id = ids.toString();
|
||||
}
|
||||
|
||||
if (dijit.byId("emailArticleDlg"))
|
||||
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||
|
||||
var query = "backend.php?op=rpc&method=buttonPlugin&plugin=mail&plugin_method=emailArticle¶m=" + param_escape(id);
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
id: "emailArticleDlg",
|
||||
title: __("Forward article by email"),
|
||||
style: "width: 600px",
|
||||
execute: function() {
|
||||
if (this.validate()) {
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: dojo.objectToQuery(this.attr('value')),
|
||||
onComplete: function(transport) {
|
||||
|
||||
var reply = JSON.parse(transport.responseText);
|
||||
|
||||
var 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=rpc&method=buttonPlugin&plugin=mail&plugin_method=completeEmails",
|
||||
{ tokens: '', paramName: "search" });
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("emailArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
21
js/share_button.js
Normal file
21
js/share_button.js
Normal file
@@ -0,0 +1,21 @@
|
||||
function shareArticle(id) {
|
||||
try {
|
||||
if (dijit.byId("shareArticleDlg"))
|
||||
dijit.byId("shareArticleDlg").destroyRecursive();
|
||||
|
||||
var query = "backend.php?op=rpc&method=buttonPlugin&plugin=share&plugin_method=shareArticle¶m=" + param_escape(id);
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
id: "shareArticleDlg",
|
||||
title: __("Share article by URL"),
|
||||
style: "width: 600px",
|
||||
href: query});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("emailArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1498,76 +1498,6 @@ function show_labels_in_headlines(transport) {
|
||||
}
|
||||
} */
|
||||
|
||||
function emailArticle(id) {
|
||||
try {
|
||||
if (!id) {
|
||||
var ids = getSelectedArticleIds2();
|
||||
|
||||
if (ids.length == 0) {
|
||||
alert(__("No articles are selected."));
|
||||
return;
|
||||
}
|
||||
|
||||
id = ids.toString();
|
||||
}
|
||||
|
||||
if (dijit.byId("emailArticleDlg"))
|
||||
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||
|
||||
var query = "backend.php?op=dlg&method=emailArticle¶m=" + param_escape(id);
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
id: "emailArticleDlg",
|
||||
title: __("Forward article by email"),
|
||||
style: "width: 600px",
|
||||
execute: function() {
|
||||
if (this.validate()) {
|
||||
|
||||
new Ajax.Request("backend.php", {
|
||||
parameters: dojo.objectToQuery(this.attr('value')),
|
||||
onComplete: function(transport) {
|
||||
|
||||
var reply = JSON.parse(transport.responseText);
|
||||
|
||||
var 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=rpc&method=completeEmails",
|
||||
{ tokens: '', paramName: "search" });
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
|
||||
/* displayDlg('emailArticle', id,
|
||||
function () {
|
||||
document.forms['article_email_form'].destination.focus();
|
||||
|
||||
new Ajax.Autocompleter('destination', 'destination_choices',
|
||||
"backend.php?op=rpc&method=completeEmails",
|
||||
{ tokens: '', paramName: "search" });
|
||||
|
||||
}); */
|
||||
|
||||
} catch (e) {
|
||||
exception_error("emailArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
function dismissArticle(id) {
|
||||
try {
|
||||
var elem = $("RROW-" + id);
|
||||
@@ -2191,24 +2121,4 @@ function precache_headlines() {
|
||||
}
|
||||
}
|
||||
|
||||
function shareArticle(id) {
|
||||
try {
|
||||
if (dijit.byId("shareArticleDlg"))
|
||||
dijit.byId("shareArticleDlg").destroyRecursive();
|
||||
|
||||
var query = "backend.php?op=dlg&method=shareArticle¶m=" + param_escape(id);
|
||||
|
||||
dialog = new dijit.Dialog({
|
||||
id: "shareArticleDlg",
|
||||
title: __("Share article by URL"),
|
||||
style: "width: 600px",
|
||||
href: query});
|
||||
|
||||
dialog.show();
|
||||
|
||||
} catch (e) {
|
||||
exception_error("emailArticle", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user