From 3d72bbdb4f4cb35c40aa61199dc6b3265cc5c9b6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 17 Jan 2009 11:14:45 +0100 Subject: [PATCH] active_feed_is_cat, active_feed_id handling changes --- backend.php | 2 +- feedlist.js | 14 +++++++------- functions.js | 24 ------------------------ functions.php | 2 +- help/3.php | 4 ++-- tt-rss.js | 42 ++++++++++++++++++++++++++++++++++-------- viewfeed.js | 28 +++++++++++++++++----------- 7 files changed, 62 insertions(+), 54 deletions(-) diff --git a/backend.php b/backend.php index b772dbbf..028ca2ad 100644 --- a/backend.php +++ b/backend.php @@ -281,7 +281,7 @@ WHERE id = '$feed' AND owner_uid = ".$_SESSION["uid"]); } - print " 0) { + if ($cat_id >= 0) { $cat_class = "feedCat"; } else { $cat_class = "virtCat"; diff --git a/help/3.php b/help/3.php index 11d258b4..af50db9f 100644 --- a/help/3.php +++ b/help/3.php @@ -39,14 +39,14 @@

- + - +
r
f r
f a
f s
f e
f w
f h
q
f q
Q
x
diff --git a/tt-rss.js b/tt-rss.js index 658c696d..304c87ec 100644 --- 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') } diff --git a/viewfeed.js b/viewfeed.js index 94554a42..c7194ab1 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -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?"); -- 2.39.5