rpc mark/pub return proper counters, rework all_counters_callback

This commit is contained in:
Andrew Dolgov 2007-08-20 13:58:11 +01:00
parent 2fe69e2292
commit 36e05046e0
3 changed files with 18 additions and 4 deletions

View File

@ -782,11 +782,11 @@ function parse_counters_reply(xmlhttp, scheduled_call) {
return fatalError(error_code, error_msg); return fatalError(error_code, error_msg);
} }
var counters = reply.firstChild; var counters = reply.getElementsByTagName("counters")[0];
parse_counters(counters, scheduled_call); parse_counters(counters, scheduled_call);
var runtime_info = counters.nextSibling; var runtime_info = reply.getElementsByTagName("runtime-info")[0];
parse_runtime_info(runtime_info); parse_runtime_info(runtime_info);

View File

@ -68,7 +68,13 @@
$result = db_query($link, "UPDATE ttrss_user_entries SET marked = $mark $result = db_query($link, "UPDATE ttrss_user_entries SET marked = $mark
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
print "<rpc-reply><mark>$id</mark></rpc-reply>"; print "<rpc-reply><counters>";
getGlobalCounters($link);
getLabelCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link);
}
print "</counters></rpc-reply>";
} }
@ -87,7 +93,13 @@
$result = db_query($link, "UPDATE ttrss_user_entries SET published = $pub $result = db_query($link, "UPDATE ttrss_user_entries SET published = $pub
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
print "<rpc-reply><pub>$id</pub></rpc-reply>"; print "<rpc-reply><counters>";
getGlobalCounters($link);
getLabelCounters($link);
if (get_pref($link, 'ENABLE_FEED_CATS')) {
getCategoryCounters($link);
}
print "</counters></rpc-reply>";
} }

View File

@ -440,6 +440,8 @@ function toggleMark(id) {
//new Ajax.Request(query); */ //new Ajax.Request(query); */
debug(query);
xmlhttp_rpc.open("GET", query, true); xmlhttp_rpc.open("GET", query, true);
xmlhttp_rpc.onreadystatechange=all_counters_callback; xmlhttp_rpc.onreadystatechange=all_counters_callback;
xmlhttp_rpc.send(null); xmlhttp_rpc.send(null);