]> git.wh0rd.org Git - tt-rss.git/commitdiff
active_feed_is_cat, active_feed_id handling changes
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 17 Jan 2009 10:14:45 +0000 (11:14 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 17 Jan 2009 10:14:45 +0000 (11:14 +0100)
backend.php
feedlist.js
functions.js
functions.php
help/3.php
tt-rss.js
viewfeed.js

index b772dbbf1f10c7ebf2252095ee443c42d70692d4..028ca2ad008e4f1b582a3e3305441b65af8ef758 100644 (file)
                                        WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]);
                        }
 
-                       print "<headlines id=\"$feed\"><![CDATA[";
+                       print "<headlines id=\"$feed\" is_cat=\"$cat_view\"><![CDATA[";
                
                        $override_order = false;
 
index 2b5b4f8d3eb781208a528b550af8d0b3aff09424..bc38c13910b5dbafe57969315cadcb9ddd5febca 100644 (file)
@@ -25,7 +25,6 @@ function toggle_sortable_feedlist(enabled) {
 }
 
 function viewCategory(cat) {
-       active_feed_is_cat = true;
        viewfeed(cat, '', true);
        return false;
 }
@@ -239,17 +238,18 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
 
                        clean_feed_selections();
 
-                       setActiveFeedId(feed);
+                       setActiveFeedId(feed, is_cat);
                
-                       if (is_cat != undefined) {
-                               active_feed_is_cat = is_cat;
-                       }
-       
                        if (!is_cat) {
                                var feedr = document.getElementById("FEEDR-" + feed);
                                if (feedr && !feedr.className.match("Selected")) {      
                                        feedr.className = feedr.className + "Selected";
                                } 
+                       } else {
+                               var feedr = document.getElementById("FCAT-" + feed_id);
+                               if (feedr && !feedr.className.match("Selected")) {      
+                                       feedr.className = feedr.className + "Selected";
+                               } 
                        }
 
                        f.innerHTML = cache_find_param(cache_prefix + feed, unread_ctr);
@@ -264,7 +264,7 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) {
 
                        new Ajax.Request(query, {
                                onComplete: function(transport) { 
-                                       headlines_callback2(transport, feed, is_cat, page_offset); 
+                                       headlines_callback2(transport, page_offset); 
                                } });
                }
 
index 9456a6a25f9d8256d79126c116cff3e874483b69..034e463d1933105e5cffdc06d9f916bb407f2759 100644 (file)
@@ -406,30 +406,6 @@ function gotoExportOpml() {
        document.location.href = "opml.php?op=Export";
 }
 
-function getActiveFeedId() {
-//     return getCookie("ttrss_vf_actfeed");
-       try {
-               debug("gAFID: " + active_feed_id);
-               return active_feed_id;
-       } catch (e) {
-               exception_error("getActiveFeedId", e);
-       }
-}
-
-function activeFeedIsCat() {
-       return active_feed_is_cat;
-}
-
-function setActiveFeedId(id) {
-//     return setCookie("ttrss_vf_actfeed", id);
-       try {
-               debug("sAFID(" + id + ")");
-               active_feed_id = id;
-       } catch (e) {
-               exception_error("setActiveFeedId", e);
-       }
-}
-
 function parse_counters(reply, scheduled_call) {
        try {
 
index c4ecc78ecaeacc408c8968a98916d87462560556..8c11ed0d98ef23c1de9e3040b797da9737efcd89 100644 (file)
                                $inner_title_class = "catTitleNL";
                        }
 
-                       if ($cat_id > 0) {
+                       if ($cat_id >= 0) {
                                $cat_class = "feedCat";
                        } else {
                                $cat_class = "virtCat";
index 11d258b48ac927c7b8b44cc3ab22e3493578d0e2..af50db9f35b0cca47e853b03aa7e771154c2011a 100644 (file)
        <h2><?php echo __("Feed actions") ?></h2>
 
        <table>
-               <tr><td class='n'>r</td><td><?php echo __("Update active feed") ?></td></tr>
+               <tr><td class='n'>r</td><td><?php echo __("Update active feed") ?></td></tr>
                <!-- <tr><td class='n'>R</td><td><?php echo __("Update all feeds") ?></td></tr> -->
                <tr><td class='n'>f a</td><td><?php echo __("(Un)hide read feeds") ?></td></tr>
                <tr><td class='n'>f s</td><td><?php echo __("Subscribe to feed") ?></td></tr>
                <tr><td class='n'>f e</td><td><?php echo __("Edit feed") ?></td></tr>
                <tr><td class='n'>f w</td><td><?php echo __("Sort by name or unread count") ?></td></tr>
                <tr><td class='n'>f h</td><td><?php echo __("Hide visible read articles") ?></td></tr>
-               <tr><td class='n'>q</td><td><?php echo __("Mark feed as read") ?></td></tr>
+               <tr><td class='n'>q</td><td><?php echo __("Mark feed as read") ?></td></tr>
                <tr><td class='n'>Q</td><td><?php echo __("Mark all feeds as read") ?></td></tr>
                <tr><td class='n'>x</td><td><?php echo __("If viewing category, (un)collapse it") ?></td></tr>
        </table>
index 658c696d2fc2282917987ad4e4ec56f41439e5b7..304c87ec6a03fbd655f5d35e328e14e4c5f0ffe4 100644 (file)
--- a/tt-rss.js
+++ b/tt-rss.js
@@ -8,8 +8,8 @@ var daemon_enabled = false;
 var daemon_refresh_only = false;
 //var _qfd_deleted_feed = 0;
 var firsttime_update = true;
-var active_feed_id = 0;
-var active_feed_is_cat = false;
+var _active_feed_id = 0;
+var _active_feed_is_cat = false;
 var number_of_feeds = 0;
 var sanity_check_done = false;
 var _hfd_scrolltop = 0;
@@ -20,6 +20,36 @@ var hor_offset = 0;
 var feeds_sort_by_unread = false;
 var feedlist_sortable_enabled = false;
 
+function activeFeedIsCat() {
+       return _active_feed_is_cat;
+}
+
+function getActiveFeedId() {
+//     return getCookie("ttrss_vf_actfeed");
+       try {
+               debug("gAFID: " + _active_feed_id);
+               return _active_feed_id;
+       } catch (e) {
+               exception_error("getActiveFeedId", e);
+       }
+}
+
+function setActiveFeedId(id, is_cat) {
+//     return setCookie("ttrss_vf_actfeed", id);
+       try {
+               debug("sAFID(" + id + ", " + is_cat + ")");
+               _active_feed_id = id;
+
+               if (is_cat != undefined) {
+                       _active_feed_is_cat = is_cat;
+               }
+
+       } catch (e) {
+               exception_error("setActiveFeedId", e);
+       }
+}
+
+
 function isFeedlistSortable() {
        return feedlist_sortable_enabled;
 }
@@ -250,7 +280,7 @@ function viewCurrentFeed(subop) {
 
 //     if (getActiveFeedId()) {
        if (getActiveFeedId() != undefined) {
-               viewfeed(getActiveFeedId(), subop, active_feed_is_cat);
+               viewfeed(getActiveFeedId(), subop, activeFeedIsCat());
        } else {
                disableContainerChildren("headlinesToolbar", false, document);
 //             viewfeed(-1, subop); // FIXME
@@ -728,14 +758,10 @@ function parse_runtime_info(elem) {
 
 function catchupCurrentFeed() {
 
-       var fn = getFeedName(getActiveFeedId(), active_feed_is_cat);
+       var fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
        
        var str = __("Mark all articles in %s as read?").replace("%s", fn);
 
-/*     if (active_feed_is_cat) {
-               str = "Mark all articles in this category as read?";
-       } */
-
        if (getInitParam("confirm_feed_catchup") != 1 || confirm(str)) {
                return viewCurrentFeed('MarkAllRead')
        }
index 94554a42207194b6db81eb3ed7c4e2963f445fc3..c7194ab1b1d1213a0df24d62bb3c2db2b717bde7 100644 (file)
@@ -67,7 +67,7 @@ function clean_feed_selections() {
        }
 }
 
-function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
+function headlines_callback2(transport, feed_cur_page) {
        try {
 
                loading_set_progress(100);
@@ -75,20 +75,26 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                debug("headlines_callback2 [page=" + feed_cur_page + "]");
 
                clean_feed_selections();
+       
+               var is_cat = false;
+               var feed_id = false;
 
-               setActiveFeedId(active_feed_id);
-               
-               if (is_cat != undefined) {
-                       active_feed_is_cat = is_cat;
+               if (transport.responseXML) {
+                       var headlines = transport.responseXML.getElementsByTagName("headlines")[0];
+                       if (headlines) {
+                               is_cat = headlines.getAttribute("is_cat");
+                               feed_id = headlines.getAttribute("id");
+                               setActiveFeedId(feed_id, is_cat);
+                       }
                }
 
                if (!is_cat) {
-                       var feedr = document.getElementById("FEEDR-" + active_feed_id);
+                       var feedr = document.getElementById("FEEDR-" + feed_id);
                        if (feedr && !feedr.className.match("Selected")) {      
                                feedr.className = feedr.className + "Selected";
                        } 
                } else {
-                       var feedr = document.getElementById("FCAT-" + active_feed_id);
+                       var feedr = document.getElementById("FCAT-" + feed_id);
                        if (feedr && !feedr.className.match("Selected")) {      
                                feedr.className = feedr.className + "Selected";
                        } 
@@ -138,10 +144,10 @@ function headlines_callback2(transport, active_feed_id, is_cat, feed_cur_page) {
                                                cache_prefix = "F:";
                                        }
 
-                                       cache_invalidate(cache_prefix + active_feed_id);
+                                       cache_invalidate(cache_prefix + feed_id);
 
                                        if (!disable_cache) {
-                                               cache_inject(cache_prefix + active_feed_id,
+                                               cache_inject(cache_prefix + feed_id,
                                                        headlines.firstChild.nodeValue, headlines_unread);
                                        }
 
@@ -1090,7 +1096,7 @@ function cdmSelectArticles(mode) {
 
 function catchupPage() {
 
-       var fn = getFeedName(getActiveFeedId(), active_feed_is_cat);
+       var fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
        
        var str = __("Mark all visible articles in %s as read?");
 
@@ -1129,7 +1135,7 @@ function catchupSelection() {
                }
        
        
-               var fn = getFeedName(getActiveFeedId(), active_feed_is_cat);
+               var fn = getFeedName(getActiveFeedId(), activeFeedIsCat());
                
                var str = __("Mark %d selected articles in %s as read?");