]> git.wh0rd.org Git - tt-rss.git/commitdiff
optimize counter responses in markSelected, etc
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 10 Aug 2007 04:03:56 +0000 (05:03 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 10 Aug 2007 04:03:56 +0000 (05:03 +0100)
functions.php
modules/backend-rpc.php
viewfeed.js

index f68768383d02783e32cb84f624705b4028c1d640..5fc20841a67f09013cbaa902feba401f0aee84da 100644 (file)
                        }
        }
 
-       function getAllCounters($link, $omode = "tflc") {
+       function getAllCounters($link, $omode = "flc") {
 /*             getLabelCounters($link);
                getFeedCounters($link);
                getTagCounters($link);
                        getCategoryCounters($link);
                } */
 
-               if (!$omode) $omode = "tflc";
+               if (!$omode) $omode = "flc";
 
                getGlobalCounters($link);
 
index b41709bcd5de25de26f7e65b152021191940a8bc..2705f45f55d789ebe562ad86363d164451a753a0 100644 (file)
 
                        print "<rpc-reply>";
                        print "<counters>";
-                       getAllCounters($link);
+                       getAllCounters($link, $_GET["omode"]);
                        print "</counters>";
                        print_runtime_info($link);
                        print "</rpc-reply>";
 
                        print "<rpc-reply>";
                        print "<counters>";
-                       getAllCounters($link);
+                       getAllCounters($link, $_GET["omode"]);
                        print "</counters>";
                        print_runtime_info($link);
                        print "</rpc-reply>";
 
                        print "<rpc-reply>";
                        print "<counters>";
-                       getAllCounters($link);
+                       getAllCounters($link, $_GET["omode"]);
                        print "</counters>";
                        print_runtime_info($link);
                        print "</rpc-reply>";
index 74dad5edd77af9e210d73db8b22222ee14a459df..17a1b6b1542d2b29ee971b8f31a874ea9ed6bc22 100644 (file)
@@ -348,6 +348,14 @@ function toggleMark(id) {
 
        var query = "backend.php?op=rpc&id=" + id + "&subop=mark";
 
+       query = query + "&afid=" + getActiveFeedId();
+
+       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);
@@ -395,56 +403,69 @@ function toggleMark(id) {
 
 function togglePub(id) {
 
-       if (!xmlhttp_ready(xmlhttp_rpc)) {
-               printLockingError();
-               return;
-       }
-
-       var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
-
-       var mark_img = document.getElementById("FPPIC-" + id);
-       var vfeedu = document.getElementById("FEEDU--2");
-       var crow = document.getElementById("RROW-" + id);
-
-       if (mark_img.alt != "Unpublish") {
-               mark_img.src = "images/pub_set.png";
-               mark_img.alt = "Unpublish";
-               query = query + "&pub=1";
+       try {
 
-               if (vfeedu && crow.className.match("Unread")) {
-                       vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
+               if (!xmlhttp_ready(xmlhttp_rpc)) {
+                       printLockingError();
+                       return;
                }
-
-       } else {
-               mark_img.src = "images/pub_unset.png";
-               mark_img.alt = "Publish";
-               query = query + "&pub=0";
-
-               if (vfeedu && crow.className.match("Unread")) {
-                       vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
+       
+               var query = "backend.php?op=rpc&id=" + id + "&subop=publ";
+       
+               query = query + "&afid=" + getActiveFeedId();
+       
+               if (tagsAreDisplayed()) {
+                       query = query + "&omode=tl";
+               } else {
+                       query = query + "&omode=flc";
                }
-
-       }
-
-       var vfeedctr = document.getElementById("FEEDCTR--2");
-       var vfeedr = document.getElementById("FEEDR--2");
-
-       if (vfeedu && vfeedctr) {
-               if ((+vfeedu.innerHTML) > 0) {
-                       if (crow.className.match("Unread") && !vfeedr.className.match("Unread")) {
-                               vfeedr.className = vfeedr.className + "Unread";
-                               vfeedctr.className = "odd";
+       
+               var mark_img = document.getElementById("FPPIC-" + id);
+               var vfeedu = document.getElementById("FEEDU--2");
+               var crow = document.getElementById("RROW-" + id);
+       
+               if (mark_img.alt != "Unpublish") {
+                       mark_img.src = "images/pub_set.png";
+                       mark_img.alt = "Unpublish";
+                       query = query + "&pub=1";
+       
+                       if (vfeedu && crow.className.match("Unread")) {
+                               vfeedu.innerHTML = (+vfeedu.innerHTML) + 1;
                        }
+       
                } else {
-                       vfeedctr.className = "invisible";
-                       vfeedr.className = vfeedr.className.replace("Unread", "");
+                       mark_img.src = "images/pub_unset.png";
+                       mark_img.alt = "Publish";
+                       query = query + "&pub=0";
+       
+                       if (vfeedu && crow.className.match("Unread")) {
+                               vfeedu.innerHTML = (+vfeedu.innerHTML) - 1;
+                       }
+       
                }
-       }
-
-       debug("toggle published for aid " + id);
-
-       new Ajax.Request(query);
+       
+               var vfeedctr = document.getElementById("FEEDCTR--2");
+               var vfeedr = document.getElementById("FEEDR--2");
+       
+               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 published for aid " + id);
+       
+               new Ajax.Request(query);
+       } catch (e) {
 
+               exception_error("togglePub", e);
+       }
 }
 
 function correctHeadlinesOffset(id) {
@@ -670,6 +691,14 @@ function selectionToggleMarked(cdm_mode) {
                        var query = "backend.php?op=rpc&subop=markSelected&ids=" +
                                param_escape(rows.toString()) + "&cmode=2";
 
+                       query = query + "&afid=" + getActiveFeedId();
+
+                       if (tagsAreDisplayed()) {
+                               query = query + "&omode=tl";
+                       } else {
+                               query = query + "&omode=flc";
+                       }
+
                        xmlhttp_rpc.open("GET", query, true);
                        xmlhttp_rpc.onreadystatechange=all_counters_callback;
                        xmlhttp_rpc.send(null);
@@ -727,6 +756,14 @@ function selectionTogglePublished(cdm_mode) {
                        var query = "backend.php?op=rpc&subop=publishSelected&ids=" +
                                param_escape(rows.toString()) + "&cmode=2";
 
+                       query = query + "&afid=" + getActiveFeedId();
+
+                       if (tagsAreDisplayed()) {
+                               query = query + "&omode=tl";
+                       } else {
+                               query = query + "&omode=flc";
+                       }
+
                        xmlhttp_rpc.open("GET", query, true);
                        xmlhttp_rpc.onreadystatechange=all_counters_callback;
                        xmlhttp_rpc.send(null);