remove some unnecessary element IDs

rework plugins/note to use xhrJson()
This commit is contained in:
Andrew Dolgov 2018-11-30 14:39:06 +03:00
parent 59f5335f56
commit 67cdf4cf12
2 changed files with 17 additions and 22 deletions

View File

@ -417,7 +417,7 @@ class Feeds extends Handler_Protected {
$reply['content'] .= "<div onclick='return hlClicked(event, $id)' $reply['content'] .= "<div onclick='return hlClicked(event, $id)'
class=\"hlTitle\"><span class='hlContent $hlc_suffix'>"; class=\"hlTitle\"><span class='hlContent $hlc_suffix'>";
$reply['content'] .= "<a id=\"RTITLE-$id\" class=\"title $hlc_suffix\" $reply['content'] .= "<a class=\"title $hlc_suffix\"
href=\"" . htmlspecialchars($line["link"]) . "\" href=\"" . htmlspecialchars($line["link"]) . "\"
onclick=\"\">" . onclick=\"\">" .
truncate_string($line["title"], 200); truncate_string($line["title"], 200);
@ -523,7 +523,7 @@ class Feeds extends Handler_Protected {
} }
// data-article-id included for context menu // data-article-id included for context menu
$tmp_content .= "<span id=\"RTITLE-$id\" $tmp_content .= "<span
onclick=\"return cdmClicked(event, $id);\" onclick=\"return cdmClicked(event, $id);\"
data-article-id=\"$id\" data-article-id=\"$id\"
class=\"titleWrap hlMenuAttach $hlc_suffix\"> class=\"titleWrap hlMenuAttach $hlc_suffix\">
@ -564,7 +564,7 @@ class Feeds extends Handler_Protected {
$tmp_content .= "</div>"; //cdmHeader $tmp_content .= "</div>"; //cdmHeader
$tmp_content .= "<div class=\"cdmContent\" onclick=\"return cdmClicked(event, $id, true);\" id=\"CICD-$id\">"; $tmp_content .= "<div class=\"cdmContent\" onclick=\"return cdmClicked(event, $id, true);\">";
$tmp_content .= "<div id=\"POSTNOTE-$id\">"; $tmp_content .= "<div id=\"POSTNOTE-$id\">";
if ($line['note']) { if ($line['note']) {

View File

@ -12,31 +12,26 @@ function editArticleNote(id) {
style: "width: 600px", style: "width: 600px",
execute: function() { execute: function() {
if (this.validate()) { if (this.validate()) {
var query = dojo.objectToQuery(this.attr('value'));
notify_progress("Saving article note...", true); notify_progress("Saving article note...", true);
new Ajax.Request("backend.php", { xhrJson("backend.php", this.attr('value'), (reply) => {
parameters: query, notify('');
onComplete: function(transport) { dialog.hide();
notify('');
dialog.hide();
var reply = JSON.parse(transport.responseText); if (reply) {
cache_delete("article:" + id);
cache_delete("article:" + id); var elem = $("POSTNOTE-" + id);
var elem = $("POSTNOTE-" + id); if (elem) {
Element.hide(elem);
elem.innerHTML = reply.note;
if (elem) { if (reply.raw_length != 0)
Element.hide(elem); new Effect.Appear(elem);
elem.innerHTML = reply.note; }
}
if (reply.raw_length != 0) });
new Effect.Appear(elem);
}
}});
} }
}, },
href: query, href: query,