]> git.wh0rd.org Git - tt-rss.git/commitdiff
remove server-side feedtree collapse implementation
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Feb 2013 11:34:13 +0000 (15:34 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Wed, 27 Feb 2013 11:34:13 +0000 (15:34 +0400)
classes/feeds.php
classes/pref/feeds.php
include/functions.php
js/FeedTree.js
js/tt-rss.js

index a2e19d5809ccc4d47c469a5ad9f59855446630e3..de001d56821b55887e0ca11584e6e0b6639fa0a9 100644 (file)
@@ -749,12 +749,6 @@ class Feeds extends Handler_Protected {
                ccache_zero_all($this->link, $_SESSION["uid"]);
        }
 
-       function collapse() {
-               $cat_id = db_escape_string($_REQUEST["cid"]);
-               $mode = (int) db_escape_string($_REQUEST['mode']);
-               toggle_collapse_cat($this->link, $cat_id, $mode);
-       }
-
        function view() {
                $timing_info = getmicrotime();
 
index aa2ae6615e17ca6e3f80070acdff6d872be653cf..da8d68ba1f51a8e622917bebd45f31a65c9a768a 100644 (file)
@@ -38,7 +38,7 @@ class Pref_Feeds extends Handler_Protected {
 
                $items = array();
 
-               $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories
+               $result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories
                                WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat = '$cat_id' ORDER BY order_id, title");
 
                while ($line = db_fetch_assoc($result)) {
@@ -49,7 +49,6 @@ class Pref_Feeds extends Handler_Protected {
                        $cat['name'] = $line['title'];
                        $cat['items'] = array();
                        $cat['checkbox'] = false;
-                       $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
                        $cat['type'] = 'category';
                        $cat['unread'] = 0;
                        $cat['child_unread'] = 0;
@@ -107,8 +106,7 @@ class Pref_Feeds extends Handler_Protected {
                if ($_REQUEST['mode'] == 2) {
 
                        if ($enable_cats) {
-                               $cat_hidden = get_pref($this->link, "_COLLAPSED_SPECIAL");
-                               $cat = $this->feedlist_init_cat(-1, $cat_hidden);
+                               $cat = $this->feedlist_init_cat(-1);
                        } else {
                                $cat['items'] = array();
                        }
@@ -129,8 +127,7 @@ class Pref_Feeds extends Handler_Protected {
                        if (db_num_rows($result) > 0) {
 
                                if (get_pref($this->link, 'ENABLE_FEED_CATS')) {
-                                       $cat_hidden = get_pref($this->link, "_COLLAPSED_LABELS");
-                                       $cat = $this->feedlist_init_cat(-2, $cat_hidden);
+                                       $cat = $this->feedlist_init_cat(-2);
                                } else {
                                        $cat['items'] = array();
                                }
@@ -138,9 +135,8 @@ class Pref_Feeds extends Handler_Protected {
                                while ($line = db_fetch_assoc($result)) {
 
                                        $label_id = -$line['id'] - 11;
-                                       $count = getFeedUnread($this->link, $label_id);
 
-                                       $feed = $this->feedlist_init_feed($label_id, false, $count);
+                                       $feed = $this->feedlist_init_feed($label_id, false, 0);
 
                                        $feed['fg_color'] = $line['fg_color'];
                                        $feed['bg_color'] = $line['bg_color'];
@@ -160,7 +156,7 @@ class Pref_Feeds extends Handler_Protected {
                        $show_empty_cats = $_REQUEST['mode'] != 2 && !$search &&
                                get_pref($this->link, '_PREFS_SHOW_EMPTY_CATS');
 
-                       $result = db_query($this->link, "SELECT id, title, collapsed FROM ttrss_feed_categories
+                       $result = db_query($this->link, "SELECT id, title FROM ttrss_feed_categories
                                WHERE owner_uid = " . $_SESSION["uid"] . " AND parent_cat IS NULL ORDER BY order_id, title");
 
                        while ($line = db_fetch_assoc($result)) {
@@ -170,7 +166,6 @@ class Pref_Feeds extends Handler_Protected {
                                $cat['name'] = $line['title'];
                                $cat['items'] = array();
                                $cat['checkbox'] = false;
-                               $cat['hidden'] = sql_bool_to_bool($line['collapsed']);
                                $cat['type'] = 'category';
                                $cat['unread'] = 0;
                                $cat['child_unread'] = 0;
@@ -192,7 +187,6 @@ class Pref_Feeds extends Handler_Protected {
                        $cat['bare_id'] = 0;
                        $cat['name'] = __("Uncategorized");
                        $cat['items'] = array();
-                       $cat['hidden'] = get_pref($this->link, "_COLLAPSED_UNCAT");
                        $cat['type'] = 'category';
                        $cat['checkbox'] = false;
                        $cat['unread'] = 0;
@@ -1414,7 +1408,7 @@ class Pref_Feeds extends Handler_Protected {
                print "</div>"; #container
        }
 
-       private function feedlist_init_cat($cat_id, $hidden = false) {
+       private function feedlist_init_cat($cat_id) {
                $obj = array();
                $cat_id = (int) $cat_id;
 
@@ -1429,7 +1423,6 @@ class Pref_Feeds extends Handler_Protected {
                $obj['name'] = getCategoryTitle($this->link, $cat_id);
                $obj['type'] = 'category';
                $obj['unread'] = (int) $cat_unread;
-               $obj['hidden'] = $hidden;
                $obj['bare_id'] = $cat_id;
 
                return $obj;
index ec91bd3fa6df8875c6e4523a4a60c77d2ff070a3..d153f9c119cef44f0332b86fa4ad37f9c84a518b 100644 (file)
                return $str;
        }
 
-       function toggle_collapse_cat($link, $cat_id, $mode) {
-               if ($cat_id > 0) {
-                       $mode = bool_to_sql_bool($mode);
-
-                       db_query($link, "UPDATE ttrss_feed_categories SET
-                               collapsed = $mode WHERE id = '$cat_id' AND owner_uid = " .
-                               $_SESSION["uid"]);
-               } else {
-                       $pref_name = '';
-
-                       switch ($cat_id) {
-                       case -1:
-                               $pref_name = '_COLLAPSED_SPECIAL';
-                               break;
-                       case -2:
-                               $pref_name = '_COLLAPSED_LABELS';
-                               break;
-                       case 0:
-                               $pref_name = '_COLLAPSED_UNCAT';
-                               break;
-                       }
-
-                       if ($pref_name) {
-                               if ($mode) {
-                                       set_pref($link, $pref_name, 'true');
-                               } else {
-                                       set_pref($link, $pref_name, 'false');
-                               }
-                       }
-               }
-       }
-
 
        function get_feed_category($link, $feed_cat, $parent_cat_id = false) {
                if ($parent_cat_id) {
index b8fb93ca0dfd900f50294ae09d0f8feb0ffc84ea..2cb6346e4b8a9f6058ea56df5a69cb7cde4d2216 100644 (file)
@@ -331,34 +331,13 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
                var item = tree.model.store._itemsByIdentity['CAT:' + id];
 
                if (node && item) {
-                       var hidden = tree.model.store.getValue(item, 'hidden');
-
-                       if (hidden)
+                       if (!node.isExpanded)
                                tree._expandNode(node);
                        else
                                tree._collapseNode(node);
 
-                       tree.model.store.setValue(item, 'hidden', !hidden);
                }
        },
-       collapseHiddenCats: function() {
-               if (!this.model.hasCats()) return;
-
-               var cats = this.model.store._arrayOfTopLevelItems;
-               var tree = this;
-
-               dojo.forEach(cats, function(cat) {
-                       var hidden = tree.model.store.getValue(cat, 'hidden');
-                       var id = tree.model.store.getValue(cat, 'id');
-                       var node = tree._itemNodesMap[id][0];
-
-                       if (hidden)
-                               tree._collapseNode(node);
-                       else
-                               tree._expandNode(node);
-
-               });
-       },
        getVisibleUnreadFeeds: function() {
                var items = this.model.store._arrayOfAllItems;
                var rv = [];
index 3a0504d5594a328f8298da9d5792ff5c970dd28f..530cb293139d4c02ffaed5fdac7df24db5e9a693 100644 (file)
@@ -69,25 +69,7 @@ function updateFeedList() {
                });
 
                var tree = new fox.FeedTree({
-               persist: false,
                model: treeModel,
-               onOpen: function (item, node) {
-                       var id = String(item.id);
-                       var cat_id = id.substr(id.indexOf(":")+1);
-
-                       new Ajax.Request("backend.php",
-                               { parameters: "backend.php?op=feeds&method=collapse&cid=" +
-                                       param_escape(cat_id) + "&mode=0" } );
-          },
-               onClose: function (item, node) {
-                       var id = String(item.id);
-                       var cat_id = id.substr(id.indexOf(":")+1);
-
-                       new Ajax.Request("backend.php",
-                               { parameters: "backend.php?op=feeds&method=collapse&cid=" +
-                                       param_escape(cat_id) + "&mode=1" } );
-
-          },
                onClick: function (item, node) {
                        var id = String(item.id);
                        var is_cat = id.match("^CAT:");
@@ -119,8 +101,6 @@ function updateFeedList() {
                dojo.disconnect(tmph);
                        Element.hide("feedlistLoading");
 
-                       tree.collapseHiddenCats();
-
                        feedlist_init();
 
 //                     var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode