rework email article dialog
This commit is contained in:
parent
6080730067
commit
186068077b
|
@ -177,10 +177,10 @@
|
||||||
|
|
||||||
print "<div align='center'>";
|
print "<div align='center'>";
|
||||||
|
|
||||||
print "<button onclick=\"return opmlRegenKey()\">".
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return opmlRegenKey()\">".
|
||||||
__('Generate new URL')."</button> ";
|
__('Generate new URL')."</button> ";
|
||||||
|
|
||||||
print "<button onclick=\"return closeInfoBox()\">".
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
|
||||||
__('Close this window')."</button>";
|
__('Close this window')."</button>";
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
@ -638,18 +638,13 @@
|
||||||
|
|
||||||
if ($id == "emailArticle") {
|
if ($id == "emailArticle") {
|
||||||
|
|
||||||
print "<title>".__('Forward article by email')."</title>";
|
|
||||||
print "<content><![CDATA[";
|
|
||||||
|
|
||||||
print "<form id=\"article_email_form\" onsubmit='return false'>";
|
|
||||||
|
|
||||||
$secretkey = sha1(uniqid(rand(), true));
|
$secretkey = sha1(uniqid(rand(), true));
|
||||||
|
|
||||||
$_SESSION['email_secretkey'] = $secretkey;
|
$_SESSION['email_secretkey'] = $secretkey;
|
||||||
|
|
||||||
print "<input type=\"hidden\" name=\"secretkey\" value=\"$secretkey\">";
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"secretkey\" value=\"$secretkey\">";
|
||||||
print "<input type=\"hidden\" name=\"op\" value=\"rpc\">";
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"rpc\">";
|
||||||
print "<input type=\"hidden\" name=\"subop\" value=\"sendEmail\">";
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"sendEmail\">";
|
||||||
|
|
||||||
$result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE
|
$result = db_query($link, "SELECT email, full_name FROM ttrss_users WHERE
|
||||||
id = " . $_SESSION["uid"]);
|
id = " . $_SESSION["uid"]);
|
||||||
|
@ -705,8 +700,7 @@
|
||||||
|
|
||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
|
|
||||||
print "<input size=\"40\" disabled
|
print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"
|
||||||
onkeypress=\"return filterCR(event, false)\"
|
|
||||||
value=\"$user_name <$user_email>\">";
|
value=\"$user_name <$user_email>\">";
|
||||||
|
|
||||||
print "</td></tr><tr><td>";
|
print "</td></tr><tr><td>";
|
||||||
|
@ -715,12 +709,12 @@
|
||||||
|
|
||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
|
|
||||||
print "<input size=\"40\"
|
print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
|
||||||
onkeypress=\"return filterCR(event, false)\"
|
style=\"width : 30em;\"
|
||||||
name=\"destination\" id=\"destination\">";
|
name=\"destination\" id=\"emailArticleDlg_destination\">";
|
||||||
|
|
||||||
print "<div class=\"autocomplete\" id=\"destination_choices\"
|
print "<div class=\"autocomplete\" id=\"emailArticleDlg_dst_choices\"
|
||||||
style=\"display:none\"></div>";
|
style=\"z-index: 30; display : none\"></div>";
|
||||||
|
|
||||||
print "</td></tr><tr><td>";
|
print "</td></tr><tr><td>";
|
||||||
|
|
||||||
|
@ -728,23 +722,21 @@
|
||||||
|
|
||||||
print "</td><td>";
|
print "</td><td>";
|
||||||
|
|
||||||
print "<input size=\"60\" class=\"iedit\"
|
print "<input dojoType=\"dijit.form.ValidationTextBox\" required=\"true\"
|
||||||
onkeypress=\"return filterCR(event, false)\"
|
style=\"width : 30em;\"
|
||||||
name=\"subject\" value=\"$subject\" id=\"subject\">";
|
name=\"subject\" value=\"$subject\" id=\"subject\">";
|
||||||
|
|
||||||
|
print "</td></tr>";
|
||||||
|
|
||||||
|
print "<tr><td colspan='2'><textarea dojoType=\"dijit.form.SimpleTextarea\" style='font-size : 12px; width : 100%' rows=\"20\"
|
||||||
|
name='content'>$content</textarea>";
|
||||||
|
|
||||||
print "</td></tr></table>";
|
print "</td></tr></table>";
|
||||||
|
|
||||||
print "<textarea rows='10' class='iedit' style='font-size : small'
|
|
||||||
name='content'>$content</textarea>";
|
|
||||||
|
|
||||||
print "</form>";
|
|
||||||
|
|
||||||
print "<div class='dlgButtons'>";
|
print "<div class='dlgButtons'>";
|
||||||
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').execute()\">".__('Send e-mail')."</button> ";
|
||||||
print "<button onclick=\"return emailArticleDo()\">".__('Send e-mail')."</button> ";
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"dijit.byId('emailArticleDlg').hide()\">".__('Cancel')."</button>";
|
||||||
print "<button onclick=\"return closeInfoBox()\">".__('Cancel')."</button>";
|
print "</div>";
|
||||||
|
|
||||||
print "]]></content>";
|
|
||||||
|
|
||||||
//return;
|
//return;
|
||||||
}
|
}
|
||||||
|
@ -770,10 +762,10 @@
|
||||||
|
|
||||||
print "<div align='center'>";
|
print "<div align='center'>";
|
||||||
|
|
||||||
print "<button onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return genUrlChangeKey('$feed_id', '$is_cat')\">".
|
||||||
__('Generate new URL')."</button> ";
|
__('Generate new URL')."</button> ";
|
||||||
|
|
||||||
print "<button onclick=\"return closeInfoBox()\">".
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return closeInfoBox()\">".
|
||||||
__('Close this window')."</button>";
|
__('Close this window')."</button>";
|
||||||
|
|
||||||
print "</div>";
|
print "</div>";
|
||||||
|
|
2
prefs.js
2
prefs.js
|
@ -1027,6 +1027,8 @@ function validatePrefsReset() {
|
||||||
function pref_hotkey_handler(e) {
|
function pref_hotkey_handler(e) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if (dijit.getEnclosingWidget(e.target)) return;
|
||||||
|
|
||||||
var keycode;
|
var keycode;
|
||||||
var shift_key = false;
|
var shift_key = false;
|
||||||
|
|
||||||
|
|
|
@ -280,6 +280,7 @@ function init() {
|
||||||
dojo.require("dijit.form.ValidationTextBox");
|
dojo.require("dijit.form.ValidationTextBox");
|
||||||
dojo.require("dijit.form.FilteringSelect");
|
dojo.require("dijit.form.FilteringSelect");
|
||||||
dojo.require("dijit.form.CheckBox");
|
dojo.require("dijit.form.CheckBox");
|
||||||
|
dojo.require("dijit.form.SimpleTextarea");
|
||||||
dojo.require("dijit.Toolbar");
|
dojo.require("dijit.Toolbar");
|
||||||
dojo.require("dijit.ProgressBar");
|
dojo.require("dijit.ProgressBar");
|
||||||
dojo.require("dijit.Menu");
|
dojo.require("dijit.Menu");
|
||||||
|
@ -623,6 +624,9 @@ function hotkey_handler(e) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
var widget = dijit.getEnclosingWidget(e.target);
|
||||||
|
if (widget && Element.visible(widget.domNode)) return;
|
||||||
|
|
||||||
var keycode;
|
var keycode;
|
||||||
var shift_key = false;
|
var shift_key = false;
|
||||||
|
|
||||||
|
|
87
viewfeed.js
87
viewfeed.js
|
@ -1869,7 +1869,47 @@ function emailArticle(id) {
|
||||||
id = ids.toString();
|
id = ids.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
displayDlg('emailArticle', id,
|
if (dijit.byId("emailArticleDlg"))
|
||||||
|
dijit.byId("emailArticleDlg").destroyRecursive();
|
||||||
|
|
||||||
|
var query = "backend.php?op=dlg&id=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 error = transport.responseXML.getElementsByTagName('error')[0];
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
alert(__('Error sending email:') + ' ' + error.firstChild.nodeValue);
|
||||||
|
} 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&subop=completeEmails",
|
||||||
|
{ tokens: '', paramName: "search" });
|
||||||
|
});
|
||||||
|
|
||||||
|
dialog.show();
|
||||||
|
|
||||||
|
/* displayDlg('emailArticle', id,
|
||||||
function () {
|
function () {
|
||||||
document.forms['article_email_form'].destination.focus();
|
document.forms['article_email_form'].destination.focus();
|
||||||
|
|
||||||
|
@ -1877,56 +1917,13 @@ function emailArticle(id) {
|
||||||
"backend.php?op=rpc&subop=completeEmails",
|
"backend.php?op=rpc&subop=completeEmails",
|
||||||
{ tokens: '', paramName: "search" });
|
{ tokens: '', paramName: "search" });
|
||||||
|
|
||||||
});
|
}); */
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("emailArticle", e);
|
exception_error("emailArticle", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function emailArticleDo() {
|
|
||||||
try {
|
|
||||||
var f = document.forms['article_email_form'];
|
|
||||||
|
|
||||||
if (f.destination.value == "") {
|
|
||||||
alert("Please fill in the destination email.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (f.subject.value == "") {
|
|
||||||
alert("Please fill in the subject.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var query = Form.serialize("article_email_form");
|
|
||||||
|
|
||||||
// console.log(query);
|
|
||||||
|
|
||||||
new Ajax.Request("backend.php", {
|
|
||||||
parameters: query,
|
|
||||||
onComplete: function(transport) {
|
|
||||||
try {
|
|
||||||
|
|
||||||
var error = transport.responseXML.getElementsByTagName('error')[0];
|
|
||||||
|
|
||||||
if (error) {
|
|
||||||
alert(__('Error sending email:') + ' ' + error.firstChild.nodeValue);
|
|
||||||
} else {
|
|
||||||
notify_info('Your message has been sent.');
|
|
||||||
closeInfoBox();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("sendEmailDo", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
} });
|
|
||||||
|
|
||||||
} catch (e) {
|
|
||||||
exception_error("emailArticleDo", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function dismissArticle(id) {
|
function dismissArticle(id) {
|
||||||
try {
|
try {
|
||||||
var elem = $("RROW-" + id);
|
var elem = $("RROW-" + id);
|
||||||
|
|
Loading…
Reference in New Issue