properly request counters when starring/publishing article
This commit is contained in:
parent
3076c7b8ed
commit
b685ba25b7
130
viewfeed.js
130
viewfeed.js
|
@ -374,70 +374,79 @@ function tPub_afh_off(effect) {
|
||||||
|
|
||||||
function toggleMark(id) {
|
function toggleMark(id) {
|
||||||
|
|
||||||
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
try {
|
||||||
printLockingError();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
|
if (!xmlhttp_ready(xmlhttp_rpc)) {
|
||||||
|
printLockingError();
|
||||||
query = query + "&afid=" + getActiveFeedId();
|
return;
|
||||||
|
|
||||||
if (tagsAreDisplayed()) {
|
|
||||||
query = query + "&omode=tl";
|
|
||||||
} else {
|
|
||||||
query = query + "&omode=flc";
|
|
||||||
}
|
|
||||||
|
|
||||||
var mark_img = document.getElementById("FMPIC-" + id);
|
|
||||||
var vfeedu = document.getElementById("FEEDU--1");
|
|
||||||
var crow = document.getElementById("RROW-" + id);
|
|
||||||
|
|
||||||
if (mark_img.alt != "Reset mark") {
|
|
||||||
mark_img.src = "images/mark_set.png";
|
|
||||||
mark_img.alt = "Reset mark";
|
|
||||||
query = query + "&mark=1";
|
|
||||||
|
|
||||||
if (vfeedu && crow.className.match("Unread")) {
|
|
||||||
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
|
||||||
//mark_img.src = "images/mark_unset.png";
|
|
||||||
mark_img.alt = "Please wait...";
|
|
||||||
query = query + "&mark=0";
|
|
||||||
|
|
||||||
if (vfeedu && crow.className.match("Unread")) {
|
query = query + "&afid=" + getActiveFeedId();
|
||||||
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.getElementById("headlinesList")) {
|
if (tagsAreDisplayed()) {
|
||||||
Effect.Puff(mark_img, {duration : 0.25, afterFinish: tMark_afh_off});
|
query = query + "&omode=tl";
|
||||||
} else {
|
} else {
|
||||||
mark_img.src = "images/mark_unset.png";
|
query = query + "&omode=flc";
|
||||||
mark_img.alt = "Set mark";
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var vfeedctr = document.getElementById("FEEDCTR--1");
|
var mark_img = document.getElementById("FMPIC-" + id);
|
||||||
var vfeedr = document.getElementById("FEEDR--1");
|
var vfeedu = document.getElementById("FEEDU--1");
|
||||||
|
var crow = document.getElementById("RROW-" + id);
|
||||||
|
|
||||||
if (vfeedu && vfeedctr) {
|
if (mark_img.alt != "Reset mark") {
|
||||||
if ((+vfeedu.innerHTML) > 0) {
|
mark_img.src = "images/mark_set.png";
|
||||||
if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
|
mark_img.alt = "Reset mark";
|
||||||
vfeedr.className = vfeedr.className + "Unread";
|
query = query + "&mark=1";
|
||||||
vfeedctr.className = "odd";
|
|
||||||
|
/* if (vfeedu && crow.className.match("Unread")) {
|
||||||
|
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
|
||||||
|
} */
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//mark_img.src = "images/mark_unset.png";
|
||||||
|
mark_img.alt = "Please wait...";
|
||||||
|
query = query + "&mark=0";
|
||||||
|
|
||||||
|
/* if (vfeedu && crow.className.match("Unread")) {
|
||||||
|
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
|
||||||
|
} */
|
||||||
|
|
||||||
|
if (document.getElementById("headlinesList")) {
|
||||||
|
Effect.Puff(mark_img, {duration : 0.25, afterFinish: tMark_afh_off});
|
||||||
|
} else {
|
||||||
|
mark_img.src = "images/mark_unset.png";
|
||||||
|
mark_img.alt = "Set mark";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
vfeedctr.className = "invisible";
|
|
||||||
vfeedr.className = vfeedr.className.replace("Unread", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* var vfeedctr = document.getElementById("FEEDCTR--1");
|
||||||
|
var vfeedr = document.getElementById("FEEDR--1");
|
||||||
|
|
||||||
|
if (vfeedu && vfeedctr) {
|
||||||
|
if ((+vfeedu.innerHTML) > 0) {
|
||||||
|
if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
|
||||||
|
vfeedr.className = vfeedr.className + "Unread";
|
||||||
|
vfeedctr.className = "odd";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vfeedctr.className = "invisible";
|
||||||
|
vfeedr.className = vfeedr.className.replace("Unread", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
debug("toggle starred for aid " + id);
|
||||||
|
|
||||||
|
//new Ajax.Request(query); */
|
||||||
|
|
||||||
|
xmlhttp_rpc.open("GET", query, true);
|
||||||
|
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
||||||
|
xmlhttp_rpc.send(null);
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("toggleMark", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("toggle starred for aid " + id);
|
|
||||||
|
|
||||||
new Ajax.Request(query);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function togglePub(id) {
|
function togglePub(id) {
|
||||||
|
@ -468,18 +477,18 @@ function togglePub(id) {
|
||||||
mark_img.alt = "Unpublish";
|
mark_img.alt = "Unpublish";
|
||||||
query = query + "&pub=1";
|
query = query + "&pub=1";
|
||||||
|
|
||||||
if (vfeedu && crow.className.match("Unread")) {
|
/* if (vfeedu && crow.className.match("Unread")) {
|
||||||
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
|
vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
|
||||||
}
|
} */
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//mark_img.src = "images/pub_unset.png";
|
//mark_img.src = "images/pub_unset.png";
|
||||||
mark_img.alt = "Please wait...";
|
mark_img.alt = "Please wait...";
|
||||||
query = query + "&pub=0";
|
query = query + "&pub=0";
|
||||||
|
|
||||||
if (vfeedu && crow.className.match("Unread")) {
|
/* if (vfeedu && crow.className.match("Unread")) {
|
||||||
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
|
vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
|
||||||
}
|
} */
|
||||||
|
|
||||||
if (document.getElementById("headlinesList")) {
|
if (document.getElementById("headlinesList")) {
|
||||||
Effect.Puff(mark_img, {duration : 0.25, afterFinish: tPub_afh_off});
|
Effect.Puff(mark_img, {duration : 0.25, afterFinish: tPub_afh_off});
|
||||||
|
@ -489,7 +498,7 @@ function togglePub(id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var vfeedctr = document.getElementById("FEEDCTR--2");
|
/* var vfeedctr = document.getElementById("FEEDCTR--2");
|
||||||
var vfeedr = document.getElementById("FEEDR--2");
|
var vfeedr = document.getElementById("FEEDR--2");
|
||||||
|
|
||||||
if (vfeedu && vfeedctr) {
|
if (vfeedu && vfeedctr) {
|
||||||
|
@ -506,7 +515,12 @@ function togglePub(id) {
|
||||||
|
|
||||||
debug("toggle published for aid " + id);
|
debug("toggle published for aid " + id);
|
||||||
|
|
||||||
new Ajax.Request(query);
|
new Ajax.Request(query); */
|
||||||
|
|
||||||
|
xmlhttp_rpc.open("GET", query, true);
|
||||||
|
xmlhttp_rpc.onreadystatechange=all_counters_callback;
|
||||||
|
xmlhttp_rpc.send(null);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
exception_error("togglePub", e);
|
exception_error("togglePub", e);
|
||||||
|
|
Loading…
Reference in New Issue