properly request counters when starring/publishing article

This commit is contained in:
Andrew Dolgov 2007-08-20 13:37:46 +01:00
parent 3076c7b8ed
commit b685ba25b7
1 changed files with 79 additions and 65 deletions

View File

@ -374,6 +374,8 @@ function tPub_afh_off(effect) {
function toggleMark(id) { function toggleMark(id) {
try {
if (!xmlhttp_ready(xmlhttp_rpc)) { if (!xmlhttp_ready(xmlhttp_rpc)) {
printLockingError(); printLockingError();
return; return;
@ -398,18 +400,18 @@ function toggleMark(id) {
mark_img.alt = "Reset mark"; mark_img.alt = "Reset mark";
query = query + "&mark=1"; query = query + "&mark=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/mark_unset.png"; //mark_img.src = "images/mark_unset.png";
mark_img.alt = "Please wait..."; mark_img.alt = "Please wait...";
query = query + "&mark=0"; query = query + "&mark=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: tMark_afh_off}); Effect.Puff(mark_img, {duration : 0.25, afterFinish: tMark_afh_off});
@ -419,7 +421,7 @@ function toggleMark(id) {
} }
} }
var vfeedctr = document.getElementById("FEEDCTR--1"); /* var vfeedctr = document.getElementById("FEEDCTR--1");
var vfeedr = document.getElementById("FEEDR--1"); var vfeedr = document.getElementById("FEEDR--1");
if (vfeedu && vfeedctr) { if (vfeedu && vfeedctr) {
@ -436,8 +438,15 @@ function toggleMark(id) {
debug("toggle starred for aid " + id); debug("toggle starred 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) {
exception_error("toggleMark", e);
}
} }
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);