$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)) {
$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;
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();
}
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();
}
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'];
$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)) {
$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;
$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;
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;
$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;
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) {
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 = [];
});
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:");
dojo.disconnect(tmph);
Element.hide("feedlistLoading");
- tree.collapseHiddenCats();
-
feedlist_init();
// var node = dijit.byId("feedTree")._itemNodesMap['FEED:-2'][0].domNode