feed tree: set placeholder feed unread value to -1

master
Andrew Dolgov 6 years ago
parent ae376bdfbf
commit 4b74491b8b

@ -66,9 +66,9 @@ class Pref_Feeds extends Handler_Protected {
$cat['items'] = array(); $cat['items'] = array();
$cat['checkbox'] = false; $cat['checkbox'] = false;
$cat['type'] = 'category'; $cat['type'] = 'category';
$cat['unread'] = 0; $cat['unread'] = -1;
$cat['child_unread'] = 0; $cat['child_unread'] = -1;
$cat['auxcounter'] = 0; $cat['auxcounter'] = -1;
$cat['parent_id'] = $cat_id; $cat['parent_id'] = $cat_id;
$cat['items'] = $this->get_category_items($line['id']); $cat['items'] = $this->get_category_items($line['id']);
@ -95,10 +95,10 @@ class Pref_Feeds extends Handler_Protected {
$feed = array(); $feed = array();
$feed['id'] = 'FEED:' . $feed_line['id']; $feed['id'] = 'FEED:' . $feed_line['id'];
$feed['bare_id'] = (int)$feed_line['id']; $feed['bare_id'] = (int)$feed_line['id'];
$feed['auxcounter'] = 0; $feed['auxcounter'] = -1;
$feed['name'] = $feed_line['title']; $feed['name'] = $feed_line['title'];
$feed['checkbox'] = false; $feed['checkbox'] = false;
$feed['unread'] = 0; $feed['unread'] = -1;
$feed['error'] = $feed_line['last_error']; $feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']); $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime( $feed['param'] = make_local_datetime(
@ -153,14 +153,14 @@ class Pref_Feeds extends Handler_Protected {
$item = array(); $item = array();
$item['id'] = 'FEED:' . $feed_id; $item['id'] = 'FEED:' . $feed_id;
$item['bare_id'] = (int)$feed_id; $item['bare_id'] = (int)$feed_id;
$item['auxcounter'] = 0; $item['auxcounter'] = -1;
$item['name'] = $feed['title']; $item['name'] = $feed['title'];
$item['checkbox'] = false; $item['checkbox'] = false;
$item['error'] = ''; $item['error'] = '';
$item['icon'] = $feed['icon']; $item['icon'] = $feed['icon'];
$item['param'] = ''; $item['param'] = '';
$item['unread'] = 0; //$feed['sender']->get_unread($feed['id']); $item['unread'] = -1;
$item['type'] = 'feed'; $item['type'] = 'feed';
array_push($cat['items'], $item); array_push($cat['items'], $item);
@ -218,13 +218,13 @@ class Pref_Feeds extends Handler_Protected {
$cat = array(); $cat = array();
$cat['id'] = 'CAT:' . $line['id']; $cat['id'] = 'CAT:' . $line['id'];
$cat['bare_id'] = (int)$line['id']; $cat['bare_id'] = (int)$line['id'];
$cat['auxcounter'] = 0; $cat['auxcounter'] = -1;
$cat['name'] = $line['title']; $cat['name'] = $line['title'];
$cat['items'] = array(); $cat['items'] = array();
$cat['checkbox'] = false; $cat['checkbox'] = false;
$cat['type'] = 'category'; $cat['type'] = 'category';
$cat['unread'] = 0; $cat['unread'] = -1;
$cat['child_unread'] = 0; $cat['child_unread'] = -1;
$cat['items'] = $this->get_category_items($line['id']); $cat['items'] = $this->get_category_items($line['id']);
@ -242,13 +242,13 @@ class Pref_Feeds extends Handler_Protected {
$cat = array(); $cat = array();
$cat['id'] = 'CAT:0'; $cat['id'] = 'CAT:0';
$cat['bare_id'] = 0; $cat['bare_id'] = 0;
$cat['auxcounter'] = 0; $cat['auxcounter'] = -1;
$cat['name'] = __("Uncategorized"); $cat['name'] = __("Uncategorized");
$cat['items'] = array(); $cat['items'] = array();
$cat['type'] = 'category'; $cat['type'] = 'category';
$cat['checkbox'] = false; $cat['checkbox'] = false;
$cat['unread'] = 0; $cat['unread'] = -1;
$cat['child_unread'] = 0; $cat['child_unread'] = -1;
$fsth = $this->pdo->prepare("SELECT id, title,last_error, $fsth = $this->pdo->prepare("SELECT id, title,last_error,
".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated, update_interval ".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated, update_interval
@ -263,14 +263,14 @@ class Pref_Feeds extends Handler_Protected {
$feed = array(); $feed = array();
$feed['id'] = 'FEED:' . $feed_line['id']; $feed['id'] = 'FEED:' . $feed_line['id'];
$feed['bare_id'] = (int)$feed_line['id']; $feed['bare_id'] = (int)$feed_line['id'];
$feed['auxcounter'] = 0; $feed['auxcounter'] = -1;
$feed['name'] = $feed_line['title']; $feed['name'] = $feed_line['title'];
$feed['checkbox'] = false; $feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error']; $feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']); $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime( $feed['param'] = make_local_datetime(
$feed_line['last_updated'], true); $feed_line['last_updated'], true);
$feed['unread'] = 0; $feed['unread'] = -1;
$feed['type'] = 'feed'; $feed['type'] = 'feed';
$feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);
@ -298,14 +298,14 @@ class Pref_Feeds extends Handler_Protected {
$feed = array(); $feed = array();
$feed['id'] = 'FEED:' . $feed_line['id']; $feed['id'] = 'FEED:' . $feed_line['id'];
$feed['bare_id'] = (int)$feed_line['id']; $feed['bare_id'] = (int)$feed_line['id'];
$feed['auxcounter'] = 0; $feed['auxcounter'] = -1;
$feed['name'] = $feed_line['title']; $feed['name'] = $feed_line['title'];
$feed['checkbox'] = false; $feed['checkbox'] = false;
$feed['error'] = $feed_line['last_error']; $feed['error'] = $feed_line['last_error'];
$feed['icon'] = Feeds::getFeedIcon($feed_line['id']); $feed['icon'] = Feeds::getFeedIcon($feed_line['id']);
$feed['param'] = make_local_datetime( $feed['param'] = make_local_datetime(
$feed_line['last_updated'], true); $feed_line['last_updated'], true);
$feed['unread'] = 0; $feed['unread'] = -1;
$feed['type'] = 'feed'; $feed['type'] = 'feed';
$feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0); $feed['updates_disabled'] = (int)($feed_line['update_interval'] < 0);

@ -135,7 +135,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
args.item.unread > 0 || args.item.auxcounter > 0 ? Element.show(ctr) : Element.hide(ctr); args.item.unread > 0 || args.item.auxcounter > 0 ? Element.show(ctr) : Element.hide(ctr);
args.item.unread == 0 && args.item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux"); args.item.unread <= 0 && args.item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux");
domConstruct.place(ctr, tnode.rowNode, 'first'); domConstruct.place(ctr, tnode.rowNode, 'first');
tnode.counterNode = ctr; tnode.counterNode = ctr;
@ -171,7 +171,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
Element.show(ctr) : Element.show(ctr) :
Element.hide(ctr); Element.hide(ctr);
item.unread == 0 && item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux"); item.unread <= 0 && item.auxcounter > 0 ? ctr.addClassName("aux") : ctr.removeClassName("aux");
} }
} }
@ -184,7 +184,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon"; return (!item || this.model.mayHaveChildren(item)) ? (opened ? "dijitFolderOpened" : "dijitFolderClosed") : "feed-icon";
}, },
getLabelClass: function (item, opened) { getLabelClass: function (item, opened) {
return (item.unread == 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread"; return (item.unread <= 0) ? "dijitTreeLabel" : "dijitTreeLabel Unread";
}, },
getRowClass: function (item, opened) { getRowClass: function (item, opened) {
let rc = (!item.error || item.error == '') ? "dijitTreeRow" : let rc = (!item.error || item.error == '') ? "dijitTreeRow" :
@ -353,7 +353,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
if (node) { if (node) {
const check_unread = tree.model.getFeedUnread(bare_id, true); const check_unread = tree.model.getFeedUnread(bare_id, true);
if (hide && cat_unread == 0 && check_unread == 0 && (id != "CAT:-1" || !show_special)) { if (hide && cat_unread <= 0 && check_unread == 0 && (id != "CAT:-1" || !show_special)) {
Effect.Fade(node[0].rowNode, {duration : 0.3, Effect.Fade(node[0].rowNode, {duration : 0.3,
queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }}); queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
} else { } else {
@ -397,7 +397,7 @@ define(["dojo/_base/declare", "dojo/dom-construct", "dijit/Tree", "dijit/Menu"],
const node = tree._itemNodesMap[id]; const node = tree._itemNodesMap[id];
if (node) { if (node) {
if (hide && unread == 0 && !has_error && (bare_id > 0 || bare_id < _label_base_index || !show_special)) { if (hide && unread <= 0 && !has_error && (bare_id > 0 || bare_id < _label_base_index || !show_special)) {
Effect.Fade(node[0].rowNode, {duration : 0.3, Effect.Fade(node[0].rowNode, {duration : 0.3,
queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }}); queue: { position: 'end', scope: 'FFADE-' + id, limit: 1 }});
} else { } else {

Loading…
Cancel
Save