]> git.wh0rd.org Git - tt-rss.git/commitdiff
unify child category counter display; remove include_children control
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Oct 2012 08:46:33 +0000 (12:46 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 11 Oct 2012 08:46:33 +0000 (12:46 +0400)
classes/feeds.php
include/functions.php
index.php
js/FeedTree.js
js/feedlist.js
js/tt-rss.js

index ad9f297fc1772f23e0c6d09b6ef46ba57642143e..31224d1db3b6579e3c547441c8bf020fce7e159d 100644 (file)
@@ -763,7 +763,6 @@ class Feeds extends Handler_Protected {
                @$offset = db_escape_string($_REQUEST["skip"]);\r
                @$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);\r
                $order_by = db_escape_string($_REQUEST["order_by"]);\r
-               $include_children = $_REQUEST["include_children"] == "true";\r
 \r
                if (is_numeric($feed)) $feed = (int) $feed;\r
 \r
@@ -804,7 +803,6 @@ class Feeds extends Handler_Protected {
                set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);\r
                set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);\r
                set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);\r
-               set_pref($this->link, "_DEFAULT_INCLUDE_CHILDREN", $include_children);\r
 \r
                if (!$cat_view && is_numeric($feed) && $feed > 0) {\r
                        db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()\r
@@ -858,7 +856,7 @@ class Feeds extends Handler_Protected {
 \r
                $ret = $this->format_headlines_list($feed, $method,\r
                        $view_mode, $limit, $cat_view, $next_unread_feed, $offset,\r
-                       $vgroup_last_feed, $override_order, $include_children);\r
+                       $vgroup_last_feed, $override_order, true);\r
 \r
                $topmost_article_ids = $ret[0];\r
                $headlines_count = $ret[1];\r
index 446e474a4b8c92ba11b0e858225e4f858be61e10..c03fd9975b92025801889849c85baf041feaa464 100644 (file)
                        }
 
                        $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);
                }
 
                $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");
index 61a6763207f3b0a68a149f9a155edf679a2c2c24..4c4fa5415e7377fb41a73385a9d699f76b686f9e 100644 (file)
--- a/index.php
+++ b/index.php
                        <option value="score"><?php echo __('Score') ?></option>
                </select>
 
-               <button dojoType="dijit.form.ToggleButton"
-                       id="include_children"
-                       onchange="viewCurrentFeed()">
-                       <?php echo __('With subcategories') ?></button>
-
                <button dojoType="dijit.form.Button" name="update"
                        onclick="scheduleFeedUpdate()">
                        <?php echo __('Update') ?></button>
index c4d7bf2f74e5e5e8c91957fdad7002ec8766c956..a197935be164c0f193cc6a22317665fc5927f9fa 100644 (file)
@@ -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);
-       },
 });
index 972fa3b1efd0f6324e04dd25ad4eab30cddf3287..b7cd57c5c2109914f4272d6afaf37d0c2f9edd54 100644 (file)
@@ -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) {
index 9dbf6ef50af28f8854cc5757ebb97b94345ba390..4c53d9e1768112dc712fba283bd006a619a45028 100644 (file)
@@ -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);