]> git.wh0rd.org Git - tt-rss.git/commitdiff
finalize changes for open-next-unread-feed-on-catchup (closes #63)
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 17 May 2006 13:20:00 +0000 (14:20 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 17 May 2006 13:20:00 +0000 (14:20 +0100)
backend.php
feedlist.js

index 9746536dda58fb3d0228ee047ca73cd2fa787f01..066700dc572880b851770c7f58b6de7409ac25ad 100644 (file)
                $view_mode = db_escape_string($_GET["view"]);
                $limit = db_escape_string($_GET["limit"]);
                $cat_view = db_escape_string($_GET["cat"]);
+               $next_unread_feed = db_escape_string($_GET["nuf"]);
 
                if (!$skip) $skip = 0;
 
                                        type=\"text/css\" href=\"tt-rss_compact.css\"/>";
                }
 
+               if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
+                       update_generic_feed($link, $feed, $cat_view);
+               }
+
+               if ($subop == "MarkAllRead")  {
+                       catchup_feed($link, $feed, $cat_view);
+
+                       if (get_pref($link, 'ON_CATCHUP_SHOW_NEXT_FEED')) {
+                               $feed = $next_unread_feed;
+                       }
+               }
+
                if (preg_match("/^-?[0-9][0-9]*$/", $feed) != false) {
        
                        $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds
                        window.onload = init;
                        </script>";
 
-               if ($subop == "ForceUpdate" && sprintf("%d", $feed) > 0) {
-                       update_generic_feed($link, $feed, $cat_view);
-               }
-
-               if ($subop == "MarkAllRead")  {
-                       catchup_feed($link, $feed, $cat_view);
-               }
-
                $search = db_escape_string($_GET["search"]);
                $search_mode = db_escape_string($_GET["smode"]);
 
index 7bdf63a062c2c012f6f5e7cadd202f4309dba686..f1038d613916b3740647a91cfb202cb5d7a4f850 100644 (file)
@@ -28,7 +28,7 @@ function viewCategory(cat) {
        viewfeed(cat, 0, '', false, true);
 }
 
-function viewfeed(feed, skip, subop, doc, is_cat) {
+function viewfeed(feed, skip, subop, doc, is_cat, subop_param) {
        try {
 
                if (!doc) doc = parent.document;
@@ -91,9 +91,14 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
                }
 
                setActiveFeedId(feed);
+
+               var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
+                       "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) +
+                       "&view=" + param_escape(view_mode) + "&limit=" + limit + 
+                       "&smode=" + param_escape(search_mode);
        
                if (subop == "MarkAllRead") {
-       
+
                        var feedr = document.getElementById("FEEDR-" + feed);
                        var feedctr = document.getElementById("FEEDCTR-" + feed);
 
@@ -105,13 +110,18 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
                                        feedr.className = feedr.className.replace("Unread", "");
                                }
                        }
+
+                       var feedlist = document.getElementById('feedList');
+                       
+                       var next_unread_feed = getRelativeFeedId(feedlist,
+                                       getActiveFeedId(), "next", true);
+
+                       if (next_unread_feed) {
+                               query = query + "&nuf=" + param_escape(next_unread_feed);
+                               setActiveFeedId(next_unread_feed);
+                       }
                }
        
-               var query = "backend.php?op=viewfeed&feed=" + param_escape(feed) +
-                       "&skip=" + param_escape(skip) + "&subop=" + param_escape(subop) +
-                       "&view=" + param_escape(view_mode) + "&limit=" + limit + 
-                       "&smode=" + param_escape(search_mode);
-       
                if (search_query != "") {
                        query = query + "&search=" + param_escape(search_query);
                        searchbox.value = "";
@@ -137,7 +147,7 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
        
 //             cleanSelectedList("feedList");
        
-               var feedr = document.getElementById("FEEDR-" + feed);
+               var feedr = document.getElementById("FEEDR-" + getActiveFeedId());
                if (feedr && !feedr.className.match("Selected")) {      
                        feedr.className = feedr.className + "Selected";
                }