]> git.wh0rd.org Git - tt-rss.git/commitdiff
prefetch old articles when necessary
authorAndrew Dolgov <fox@madoka.spb.ru>
Tue, 15 May 2007 06:19:48 +0000 (07:19 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Tue, 15 May 2007 06:19:48 +0000 (07:19 +0100)
backend.php
tt-rss.js
viewfeed.js

index b04b2619bc079f73901eaeefcc89ba370a62e1c2..f83b71d5e10dafc07130972f4385376061481599 100644 (file)
                // in prefetch mode we only output requested cids, main article 
                // just gets marked as read (it already exists in client cache)
 
-               if ($mode != "prefetch") {
+               if ($mode == "") {
                        outputArticleXML($link, $id, $feed_id);
-               } else {
+               } else if ($mode == "prefetch") {
                        catchupArticleById($link, $id, 0);
                }
 
                        }
                }
 
-               print "<counters>";
-               getAllCounters($link, $omode);
-               print "</counters>";
+               if ($mode != "prefetch_old") {
+                       print "<counters>";
+                       getAllCounters($link, $omode);
+                       print "</counters>";
+               }
 
                print "</reply>";
        }
index d22aa1fba3ae6df2bbc52c46f971acecb162f148..861c9abb8acaf096ed1574af08496237f920d4e5 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -50,7 +50,7 @@ function dlg_frefresh_callback() {
                if (getActiveFeedId() == _qfd_deleted_feed) {
                        var h = document.getElementById("headlines-frame");
                        if (h) {
-                               h.innerHTML = "<div class='whiteBox'>No feed selected.</div>";
+                               h.innerHTML = "<div class='whiteBox'>" + __('No feed selected.') + "</div>";
                        }
                }
 
index 91b042689662f46aca7d37ea24600c05f925578e..f60783514113e5a1d827e59a4e00c70f5824edb8 100644 (file)
@@ -50,11 +50,12 @@ function headlines_callback() {
                        if (counters) {
                                debug("parsing piggybacked counters: " + counters);
                                parse_counters(counters, false);
+                       } else {
+                               debug("counters container not found in reply");
                        }
                } else {
                        debug("headlines_callback: returned no XML object");
-                       f.innerHTML = xmlhttp.responseText;
-                       update_all_counters();
+                       f.innerHTML = "<div class='whiteBox'>" + __('Could not update headlines (missing XML object)') + "</div>";
                }
 
                if (typeof correctPNG != 'undefined') {
@@ -122,6 +123,7 @@ function article_callback() {
                        
                        } else {
                                debug("article_callback: returned no XML object");
+                               f.innerHTML = "<div class='whiteBox'>" + __('Could not display article (missing XML object)') + "</div>";
                        }
                } catch (e) {
                        exception_error("article_callback", e);
@@ -144,7 +146,7 @@ function article_callback() {
                                debug("parsing piggybacked counters: " + counters);
                                parse_counters(counters, false);
                        } else {
-                               update_all_counters();
+                               debug("counters container not found in reply");
                        }
                }
 
@@ -253,6 +255,14 @@ function view(id, feed_id, skip_history) {
 
                        } else if (cached_article) {
 
+                               query = query + "&mode=prefetch_old";
+
+                               debug(query);
+
+                               xmlhttp.open("GET", query, true);
+                               xmlhttp.onreadystatechange=article_callback;
+                               xmlhttp.send(null);
+
                                render_article(cached_article);
 
                        }