From 0ef32f48b26f94b041977730bf00fe2750e4ad25 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 11 Oct 2012 12:46:33 +0400 Subject: [PATCH] unify child category counter display; remove include_children control --- classes/feeds.php | 4 +--- include/functions.php | 4 +--- index.php | 5 ----- js/FeedTree.js | 22 +--------------------- js/feedlist.js | 32 +------------------------------- js/tt-rss.js | 11 ----------- 6 files changed, 4 insertions(+), 74 deletions(-) diff --git a/classes/feeds.php b/classes/feeds.php index ad9f297f..31224d1d 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -763,7 +763,6 @@ class Feeds extends Handler_Protected { @$offset = db_escape_string($_REQUEST["skip"]); @$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]); $order_by = db_escape_string($_REQUEST["order_by"]); - $include_children = $_REQUEST["include_children"] == "true"; if (is_numeric($feed)) $feed = (int) $feed; @@ -804,7 +803,6 @@ class Feeds extends Handler_Protected { set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode); set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit); set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by); - set_pref($this->link, "_DEFAULT_INCLUDE_CHILDREN", $include_children); if (!$cat_view && is_numeric($feed) && $feed > 0) { db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW() @@ -858,7 +856,7 @@ class Feeds extends Handler_Protected { $ret = $this->format_headlines_list($feed, $method, $view_mode, $limit, $cat_view, $next_unread_feed, $offset, - $vgroup_last_feed, $override_order, $include_children); + $vgroup_last_feed, $override_order, true); $topmost_article_ids = $ret[0]; $headlines_count = $ret[1]; diff --git a/include/functions.php b/include/functions.php index 446e474a..c03fd997 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1413,8 +1413,7 @@ } $cv = array("id" => $line["cat_id"], "kind" => "cat", - "child_counter" => $child_counter, - "counter" => $line["unread"]); + "counter" => $line["unread"] + $child_counter); array_push($ret_arr, $cv); } @@ -2124,7 +2123,6 @@ $params["icons_url"] = ICONS_URL; $params["cookie_lifetime"] = SESSION_COOKIE_LIFETIME; - $params["default_include_children"] = get_pref($link, "_DEFAULT_INCLUDE_CHILDREN"); $params["default_view_mode"] = get_pref($link, "_DEFAULT_VIEW_MODE"); $params["default_view_limit"] = (int) get_pref($link, "_DEFAULT_VIEW_LIMIT"); $params["default_view_order_by"] = get_pref($link, "_DEFAULT_VIEW_ORDER_BY"); diff --git a/index.php b/index.php index 61a67632..4c4fa541 100644 --- a/index.php +++ b/index.php @@ -183,11 +183,6 @@ - - diff --git a/js/FeedTree.js b/js/FeedTree.js index c4d7bf2f..a197935b 100644 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -120,14 +120,6 @@ dojo.declare("fox.FeedTree", dijit.Tree, { dojo.place(span, tnode.iconNode, 'replace'); } - if (id.match("CAT:") && bare_id > 0) { - param = dojo.doc.createElement('span'); - param.className = 'feedParam'; - param.innerHTML = ""; - dojo.place(param, tnode.labelNode, 'after'); - tnode._paramNode = param; - } - if (id.match("FEED:")) { var menu = new dijit.Menu(); menu.row_id = bare_id; @@ -258,9 +250,8 @@ dojo.declare("fox.FeedTree", dijit.Tree, { if (node) { var check_unread = tree.model.getFeedUnread(bare_id, true); - var check_param = tree.model.getFeedValue(bare_id, true, "child_unread"); - if (hide && cat_unread == 0 && check_unread == 0 && check_param == 0) { + if (hide && cat_unread == 0 && check_unread == 0) { Effect.Fade(node[0].rowNode, {duration : 0.3, queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }}); } else { @@ -473,15 +464,4 @@ dojo.declare("fox.FeedTree", dijit.Tree, { return false; } }, - setCatParam: function(cat, value) { - var treeNode = this._itemNodesMap['CAT:' + cat]; - - if (treeNode && treeNode[0] && treeNode[0]._paramNode) { - if (value > 0) - treeNode[0]._paramNode.innerHTML = '+' + value; - else - treeNode[0]._paramNode.innerHTML = ""; - } - this.model.setFeedValue(cat, true, 'child_unread', value); - }, }); diff --git a/js/feedlist.js b/js/feedlist.js index 972fa3b1..b7cd57c5 100644 --- a/js/feedlist.js +++ b/js/feedlist.js @@ -179,7 +179,6 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) { } query += "&cat=" + is_cat; - query += "&include_children=" + dijit.byId("include_children").attr("checked"); console.log(query); @@ -296,7 +295,6 @@ function parse_counters(elems, scheduled_call) { var error = elems[l].error; var has_img = elems[l].has_img; var updated = elems[l].updated; - var child_unread = parseInt(elems[l].child_counter); if (id == "global-unread") { global_unread = ctr; @@ -317,7 +315,7 @@ function parse_counters(elems, scheduled_call) { } if (getFeedUnread(id, (kind == "cat")) != ctr || - (kind == "cat" && getCatParam(id) != child_unread)) { + (kind == "cat")) { cache_delete("feed:" + id + ":" + (kind == "cat")); } @@ -336,8 +334,6 @@ function parse_counters(elems, scheduled_call) { setFeedIcon(id, false, 'images/blank_icon.gif'); } } - } else { - setCatParam(id, child_unread); } } @@ -427,27 +423,6 @@ function setFeedValue(feed, is_cat, key, value) { } } -function setCatParam(cat, value) { - try { - var tree = dijit.byId("feedTree"); - - if (tree && tree.model) - return tree.setCatParam(cat, value); - - } catch (e) { - // - } -} - -function getCatParam(cat) { - try { - return getFeedValue(cat, true, "child_unread"); - } catch (e) { - // - } -} - - function selectFeed(feed, is_cat) { try { var tree = dijit.byId("feedTree"); @@ -581,11 +556,6 @@ function catchupFeed(feed, is_cat) { function decrementFeedCounter(feed, is_cat) { try { - // we have subcats, no way to figure out if this article is - // actually from this category - if (is_cat && getCatParam(feed) > 0) - return; - var ctr = getFeedUnread(feed, is_cat); if (ctr > 0) { diff --git a/js/tt-rss.js b/js/tt-rss.js index 9dbf6ef5..4c53d9e1 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -41,10 +41,6 @@ function setActiveFeedId(id, is_cat) { } selectFeed(id, is_cat); - - dijit.byId("include_children").attr("disabled", !(is_cat && id > 0)); - - } catch (e) { exception_error("setActiveFeedId", e); } @@ -355,13 +351,6 @@ function init_second_stage() { dijit.getEnclosingWidget(toolbar.order_by).attr('value', getInitParam("default_view_order_by")); - - if (getInitParam("enable_feed_cats") == 0) - Element.hide(dijit.byId("include_children").domNode); - - dijit.byId("include_children").attr("checked", - getInitParam("default_include_children")); - feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1; loading_set_progress(30); -- 2.39.5