unify child category counter display; remove include_children control
This commit is contained in:
parent
daf0b0142d
commit
0ef32f48b2
|
@ -763,7 +763,6 @@ class Feeds extends Handler_Protected {
|
||||||
@$offset = db_escape_string($_REQUEST["skip"]);
|
@$offset = db_escape_string($_REQUEST["skip"]);
|
||||||
@$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);
|
@$vgroup_last_feed = db_escape_string($_REQUEST["vgrlf"]);
|
||||||
$order_by = db_escape_string($_REQUEST["order_by"]);
|
$order_by = db_escape_string($_REQUEST["order_by"]);
|
||||||
$include_children = $_REQUEST["include_children"] == "true";
|
|
||||||
|
|
||||||
if (is_numeric($feed)) $feed = (int) $feed;
|
if (is_numeric($feed)) $feed = (int) $feed;
|
||||||
|
|
||||||
|
@ -804,7 +803,6 @@ class Feeds extends Handler_Protected {
|
||||||
set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);
|
set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);
|
||||||
set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);
|
set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);
|
||||||
set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
|
set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
|
||||||
set_pref($this->link, "_DEFAULT_INCLUDE_CHILDREN", $include_children);
|
|
||||||
|
|
||||||
if (!$cat_view && is_numeric($feed) && $feed > 0) {
|
if (!$cat_view && is_numeric($feed) && $feed > 0) {
|
||||||
db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()
|
db_query($this->link, "UPDATE ttrss_feeds SET last_viewed = NOW()
|
||||||
|
@ -858,7 +856,7 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
$ret = $this->format_headlines_list($feed, $method,
|
$ret = $this->format_headlines_list($feed, $method,
|
||||||
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
|
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
|
||||||
$vgroup_last_feed, $override_order, $include_children);
|
$vgroup_last_feed, $override_order, true);
|
||||||
|
|
||||||
$topmost_article_ids = $ret[0];
|
$topmost_article_ids = $ret[0];
|
||||||
$headlines_count = $ret[1];
|
$headlines_count = $ret[1];
|
||||||
|
|
|
@ -1413,8 +1413,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$cv = array("id" => $line["cat_id"], "kind" => "cat",
|
$cv = array("id" => $line["cat_id"], "kind" => "cat",
|
||||||
"child_counter" => $child_counter,
|
"counter" => $line["unread"] + $child_counter);
|
||||||
"counter" => $line["unread"]);
|
|
||||||
|
|
||||||
array_push($ret_arr, $cv);
|
array_push($ret_arr, $cv);
|
||||||
}
|
}
|
||||||
|
@ -2124,7 +2123,6 @@
|
||||||
|
|
||||||
$params["icons_url"] = ICONS_URL;
|
$params["icons_url"] = ICONS_URL;
|
||||||
$params["cookie_lifetime"] = SESSION_COOKIE_LIFETIME;
|
$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_mode"] = get_pref($link, "_DEFAULT_VIEW_MODE");
|
||||||
$params["default_view_limit"] = (int) get_pref($link, "_DEFAULT_VIEW_LIMIT");
|
$params["default_view_limit"] = (int) get_pref($link, "_DEFAULT_VIEW_LIMIT");
|
||||||
$params["default_view_order_by"] = get_pref($link, "_DEFAULT_VIEW_ORDER_BY");
|
$params["default_view_order_by"] = get_pref($link, "_DEFAULT_VIEW_ORDER_BY");
|
||||||
|
|
|
@ -183,11 +183,6 @@
|
||||||
<option value="score"><?php echo __('Score') ?></option>
|
<option value="score"><?php echo __('Score') ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button dojoType="dijit.form.ToggleButton"
|
|
||||||
id="include_children"
|
|
||||||
onchange="viewCurrentFeed()">
|
|
||||||
<?php echo __('With subcategories') ?></button>
|
|
||||||
|
|
||||||
<button dojoType="dijit.form.Button" name="update"
|
<button dojoType="dijit.form.Button" name="update"
|
||||||
onclick="scheduleFeedUpdate()">
|
onclick="scheduleFeedUpdate()">
|
||||||
<?php echo __('Update') ?></button>
|
<?php echo __('Update') ?></button>
|
||||||
|
|
|
@ -120,14 +120,6 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
|
||||||
dojo.place(span, tnode.iconNode, 'replace');
|
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:")) {
|
if (id.match("FEED:")) {
|
||||||
var menu = new dijit.Menu();
|
var menu = new dijit.Menu();
|
||||||
menu.row_id = bare_id;
|
menu.row_id = bare_id;
|
||||||
|
@ -258,9 +250,8 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
|
||||||
|
|
||||||
if (node) {
|
if (node) {
|
||||||
var check_unread = tree.model.getFeedUnread(bare_id, true);
|
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,
|
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 {
|
||||||
|
@ -473,15 +464,4 @@ dojo.declare("fox.FeedTree", dijit.Tree, {
|
||||||
return false;
|
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);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -179,7 +179,6 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
||||||
}
|
}
|
||||||
|
|
||||||
query += "&cat=" + is_cat;
|
query += "&cat=" + is_cat;
|
||||||
query += "&include_children=" + dijit.byId("include_children").attr("checked");
|
|
||||||
|
|
||||||
console.log(query);
|
console.log(query);
|
||||||
|
|
||||||
|
@ -296,7 +295,6 @@ function parse_counters(elems, scheduled_call) {
|
||||||
var error = elems[l].error;
|
var error = elems[l].error;
|
||||||
var has_img = elems[l].has_img;
|
var has_img = elems[l].has_img;
|
||||||
var updated = elems[l].updated;
|
var updated = elems[l].updated;
|
||||||
var child_unread = parseInt(elems[l].child_counter);
|
|
||||||
|
|
||||||
if (id == "global-unread") {
|
if (id == "global-unread") {
|
||||||
global_unread = ctr;
|
global_unread = ctr;
|
||||||
|
@ -317,7 +315,7 @@ function parse_counters(elems, scheduled_call) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getFeedUnread(id, (kind == "cat")) != ctr ||
|
if (getFeedUnread(id, (kind == "cat")) != ctr ||
|
||||||
(kind == "cat" && getCatParam(id) != child_unread)) {
|
(kind == "cat")) {
|
||||||
|
|
||||||
cache_delete("feed:" + id + ":" + (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');
|
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) {
|
function selectFeed(feed, is_cat) {
|
||||||
try {
|
try {
|
||||||
var tree = dijit.byId("feedTree");
|
var tree = dijit.byId("feedTree");
|
||||||
|
@ -581,11 +556,6 @@ function catchupFeed(feed, is_cat) {
|
||||||
|
|
||||||
function decrementFeedCounter(feed, is_cat) {
|
function decrementFeedCounter(feed, is_cat) {
|
||||||
try {
|
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);
|
var ctr = getFeedUnread(feed, is_cat);
|
||||||
|
|
||||||
if (ctr > 0) {
|
if (ctr > 0) {
|
||||||
|
|
11
js/tt-rss.js
11
js/tt-rss.js
|
@ -41,10 +41,6 @@ function setActiveFeedId(id, is_cat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
selectFeed(id, is_cat);
|
selectFeed(id, is_cat);
|
||||||
|
|
||||||
dijit.byId("include_children").attr("disabled", !(is_cat && id > 0));
|
|
||||||
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
exception_error("setActiveFeedId", e);
|
exception_error("setActiveFeedId", e);
|
||||||
}
|
}
|
||||||
|
@ -355,13 +351,6 @@ function init_second_stage() {
|
||||||
dijit.getEnclosingWidget(toolbar.order_by).attr('value',
|
dijit.getEnclosingWidget(toolbar.order_by).attr('value',
|
||||||
getInitParam("default_view_order_by"));
|
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;
|
feeds_sort_by_unread = getInitParam("feeds_sort_by_unread") == 1;
|
||||||
|
|
||||||
loading_set_progress(30);
|
loading_set_progress(30);
|
||||||
|
|
Loading…
Reference in New Issue