summaryrefslogtreecommitdiff
path: root/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-03-06 13:40:59 +0300
committerAndrew Dolgov <[email protected]>2009-03-06 13:40:59 +0300
commit5161564f3d70d1434bc6f7469217de45bb272ff8 (patch)
treefbe5dc8690f32ed3fad80ee90229b6a4c3ec5fe6 /viewfeed.js
parent5859b5383db16c5b6a2f1f2a9888cd995ec1a9c1 (diff)
add support for adding syndicated notes to published articles
Diffstat (limited to 'viewfeed.js')
-rw-r--r--viewfeed.js61
1 files changed, 57 insertions, 4 deletions
diff --git a/viewfeed.js b/viewfeed.js
index be1a442e0..d21e3e623 100644
--- a/viewfeed.js
+++ b/viewfeed.js
@@ -15,6 +15,39 @@ var post_under_pointer = false;
var last_requested_article = false;
+function toggle_published_callback(transport) {
+ try {
+ if (transport.responseXML) {
+
+ all_counters_callback2(transport);
+
+ var note = transport.responseXML.getElementsByTagName("note")[0];
+
+ if (note) {
+ var note_id = note.getAttribute("id");
+ var note_size = note.getAttribute("size");
+ var note_content = note.firstChild.nodeValue;
+
+ var container = $('POSTNOTE-' + note_id);
+
+ cache_invalidate(note_id);
+
+ if (container) {
+ if (note_size == "0") {
+ Element.hide(container);
+ } else {
+ container.innerHTML = note_content;
+ Element.show(container);
+ }
+ }
+ }
+ }
+
+ } catch (e) {
+ exception_error("toggle_published_callback", e, transport);
+ }
+}
+
function catchup_callback2(transport, callback) {
try {
debug("catchup_callback2 " + transport + ", " + callback);
@@ -592,13 +625,19 @@ function toggleMark(id, client_only, no_effects) {
}
}
-function togglePub(id, client_only, no_effects) {
+function togglePub(id, client_only, no_effects, note) {
try {
var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
query = query + "&afid=" + getActiveFeedId();
+
+ if (note != undefined) {
+ query = query + "&note=" + param_escape(note);
+ } else {
+ query = query + "&note=undefined";
+ }
if (tagsAreDisplayed()) {
query = query + "&omode=tl";
@@ -613,11 +652,10 @@ function togglePub(id, client_only, no_effects) {
var vfeedu = $("FEEDU--2");
var crow = $("RROW-" + id);
- if (mark_img.src.match("pub_unset")) {
+ if (mark_img.src.match("pub_unset") || note != undefined) {
mark_img.src = mark_img.src.replace("pub_unset", "pub_set");
mark_img.alt = __("Unpublish article");
query = query + "&pub=1";
-
} else {
//mark_img.src = "images/pub_unset.png";
@@ -635,7 +673,7 @@ function togglePub(id, client_only, no_effects) {
if (!client_only) {
new Ajax.Request(query, {
onComplete: function(transport) {
- all_counters_callback2(transport);
+ toggle_published_callback(transport);
} });
}
@@ -2147,3 +2185,18 @@ function toggleHeadlineActions() {
exception_error("toggleHeadlineActions", e);
}
}
+
+function publishWithNote(id, def_note) {
+ try {
+ if (!def_note) def_note = '';
+
+ var note = prompt(__("Please enter a note for this article:"), def_note);
+
+ if (note != undefined) {
+ togglePub(id, false, false, note);
+ }
+
+ } catch (e) {
+ exception_error("publishWithNote", e);
+ }
+}