From: Andrew Dolgov Date: Wed, 27 Feb 2013 11:34:13 +0000 (+0400) Subject: remove server-side feedtree collapse implementation X-Git-Tag: 1.7.1~26 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=88918ca637d5e5d22a687ddd70ea04675577448a;p=tt-rss.git remove server-side feedtree collapse implementation --- diff --git a/classes/feeds.php b/classes/feeds.php index a2e19d58..de001d56 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -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(); diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index aa2ae661..da8d68ba 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -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 ""; #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; diff --git a/include/functions.php b/include/functions.php index ec91bd3f..d153f9c1 100644 --- a/include/functions.php +++ b/include/functions.php @@ -3293,38 +3293,6 @@ 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) { diff --git a/js/FeedTree.js b/js/FeedTree.js index b8fb93ca..2cb6346e 100644 --- a/js/FeedTree.js +++ b/js/FeedTree.js @@ -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 = []; diff --git a/js/tt-rss.js b/js/tt-rss.js index 3a0504d5..530cb293 100644 --- a/js/tt-rss.js +++ b/js/tt-rss.js @@ -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