]> git.wh0rd.org Git - tt-rss.git/commitdiff
vfeed grouping: prevent duplicate group headings
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 17 May 2008 04:42:20 +0000 (05:42 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 17 May 2008 04:42:20 +0000 (05:42 +0100)
backend.php
feedlist.js
functions.php
viewfeed.js

index c0362b45faf59a2ccd9fb3e6060675dc93684c84..bdecb6cd09b02b3b8786c593aff5ba9f8874269b 100644 (file)
                        $cat_view = db_escape_string($_GET["cat"]);
                        $next_unread_feed = db_escape_string($_GET["nuf"]);
                        $offset = db_escape_string($_GET["skip"]);
+                       $vgroup_last_feed = db_escape_string($_GET["vgrlf"]);
 
                        set_pref($link, "_DEFAULT_VIEW_MODE", $view_mode);
                        set_pref($link, "_DEFAULT_VIEW_LIMIT", $limit);
                        } else {
 
                                $ret = outputHeadlinesList($link, $feed, $subop, 
-                                       $view_mode, $limit, $cat_view, $next_unread_feed, $offset);
+                                       $view_mode, $limit, $cat_view, $next_unread_feed, $offset, 
+                                       $vgroup_last_feed);
        
                                $topmost_article_ids = $ret[0];
                                $headlines_count = $ret[1];
                                $returned_feed = $ret[2];
                                $disable_cache = $ret[3];
+                               $vgroup_last_feed = $ret[4];
        
                                print "]]></headlines>";
        
                                print "<headlines-count value=\"$headlines_count\"/>";
-       
+                               print "<vgroup-last-feed value=\"$vgroup_last_feed\"/>";
+
                                $headlines_unread = getFeedUnread($link, $returned_feed);
        
                                print "<headlines-unread value=\"$headlines_unread\"/>";
index 782cb3a1925f6e6dcc6e230b9687a12562b7e8bf..7ca49005335393f9f7c4ae630f0934bdf967ca29 100644 (file)
@@ -142,8 +142,6 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                disableContainerChildren("headlinesToolbar", false);
                Form.enable("main_toolbar_form");
 
-               debug(query);
-
                // for piggybacked counters
 
                if (tagsAreDisplayed()) {
@@ -152,6 +150,13 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
                        query = query + "&omode=flc";
                }
 
+               // to prevent duplicate feed titles when showing grouped vfeeds
+               if (vgroup_last_feed) {
+                       query = query + "&vgrlf=" + param_escape(vgroup_last_feed);
+               }
+
+               debug(query);
+
                var container = document.getElementById("headlinesInnerContainer");
 
                if (container && page_offset == 0 && !isCdmMode()) {
index e9134328c6f0b15c6566211658c5c7fd7729f083..693b3ddc162011d1ac499a40092841302a409fb3 100644 (file)
        }
 
        function outputHeadlinesList($link, $feed, $subop, $view_mode, $limit, $cat_view,
-                                       $next_unread_feed, $offset) {
+                                       $next_unread_feed, $offset, $vgr_last_feed = false) {
 
                $disable_cache = false;
 
                $feed_site_url = $qfh_ret[2];
                $last_error = $qfh_ret[3];
 
+               $vgroup_last_feed = $vgr_last_feed;
+
                if ($feed == -2) {
                        $feed_site_url = article_publish_url($link);
                }
                                if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
 
                                        if (defined('_VFEED_GROUP_BY_FEED')) {
-                                               if ($line["feed_title"] != $cur_feed_title) {
+                                               if ($feed_id != $vgroup_last_feed) {
 
                                                        $cur_feed_title = $line["feed_title"];
+                                                       $vgroup_last_feed = $feed_id;
 
-/*                                                     print "<tr class='feedTitle'><td colspan='7'>".
-                                                               $line["feed_title"].
-                                                               " (<a href=\"javascript:viewfeed($feed_id, '', false)\">".
-                                                               "more</a>)</td></tr>"; */
 
-                                                       $vf_catchup_link = "(<a href='javascript:'>select</a>, 
-                                                               <a href='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\")'>mark as read</a>)";
+                                                       $vf_catchup_link = "(<a href='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\")'>mark as read</a>)";
 
                                                        print "<tr class='feedTitle'><td colspan='7'>".
                                                                "<a href=\"javascript:viewfeed($feed_id, '', false)\">".
                                } else {
 
                                        if (defined('_VFEED_GROUP_BY_FEED')) {
-                                               if ($line["feed_title"] != $cur_feed_title) {
+                                               if ($feed_id != $vgroup_last_feed) {
+
+                                                       $cur_feed_title = $line["feed_title"];
+                                                       $vgroup_last_feed = $feed_id;
+
+                                                       $vf_catchup_link = "(<a href='javascript:catchupFeedInGroup($feed_id, \"$cur_feed_title\")'>mark as read</a>)";
+
                                                        print "<div class='cdmFeedTitle'>".
                                                                "<a href=\"javascript:viewfeed($feed_id, '', false)\">".
-                                                               $line["feed_title"]."</a></div>";
-                                                       $cur_feed_title = $line["feed_title"];
+                                                               $line["feed_title"]."</a> $vf_catchup_link</div>";
                                                }
                                        }
 
                        print "</div>";
                }
 
-               return array($topmost_article_ids, $headlines_count, $feed, $disable_cache);
+               return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $vgroup_last_feed);
        }
 
 // from here: http://www.roscripts.com/Create_tag_cloud-71.html
index fb72751272bad0e47417d802a9a2beebd7c7eb04..caaec2daa48a343fa16376df81cea0bde8c8807b 100644 (file)
@@ -17,6 +17,8 @@ var _cdm_wd_vishist = new Array();
 
 var article_cache = new Array();
 
+var vgroup_last_feed = false;
+
 function catchup_callback() {
        if (xmlhttp_rpc.readyState == 4) {
                try {
@@ -93,10 +95,14 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                        var headlines_unread_obj = transport.responseXML.getElementsByTagName("headlines-unread")[0];
                        var disable_cache_obj = transport.responseXML.getElementsByTagName("disable-cache")[0];
 
+                       var vgroup_last_feed_obj =  transport.responseXML.getElementsByTagName("vgroup-last-feed")[0];
+
                        var headlines_count = headlines_count_obj.getAttribute("value");
                        var headlines_unread = headlines_unread_obj.getAttribute("value");
                        var disable_cache = disable_cache_obj.getAttribute("value") != "0";
 
+                       vgroup_last_feed = vgroup_last_feed_obj.getAttribute("value");
+
                        if (headlines_count == 0) {
                                _infscroll_disable = 1;
                        } else {