summaryrefslogtreecommitdiff
path: root/viewfeed.js
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-03-21 23:11:58 +0300
committerAndrew Dolgov <[email protected]>2009-03-21 23:11:58 +0300
commitc7e51de137d9b02ce7b9ddabde86f91d4119ce4b (patch)
tree0b09b4d10bfe7a3834f2aba2ecd093e7547c129e /viewfeed.js
parent2b38f79c86ad9199f39fa8efac1c0e89c6f3a465 (diff)
Revert "update translations"
This reverts commit 2b38f79c86ad9199f39fa8efac1c0e89c6f3a465. Wrong commit from wrong branch.
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);
+ }
+}