implement feed grouping display, remove unneeded server vgrlf passing

This commit is contained in:
Andrew Dolgov 2018-12-07 21:11:50 +03:00
parent 1369124fe0
commit 8f75b06835
8 changed files with 35 additions and 34 deletions

View File

@ -113,8 +113,7 @@ class Feeds extends Handler_Protected {
}
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
$offset, $vgr_last_feed = false,
$override_order = false, $include_children = false, $check_first_id = false,
$offset, $override_order = false, $include_children = false, $check_first_id = false,
$skip_first_id_check = false) {
$disable_cache = false;
@ -216,8 +215,7 @@ class Feeds extends Handler_Protected {
$highlight_words = $qfh_ret[5];
$reply['first_id'] = $qfh_ret[6];
$reply['search_query'] = [$search, $search_language];
$vgroup_last_feed = $vgr_last_feed;
$reply['vfeed_group_enabled'] = $vfeed_group_enabled;
$reply['toolbar'] = $this->format_headline_subtoolbar($feed_site_url,
$feed_title,
@ -737,8 +735,7 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);
return array($topmost_article_ids, $headlines_count, $feed, $disable_cache,
$vgroup_last_feed, $reply);
return array($topmost_article_ids, $headlines_count, $feed, $disable_cache, $reply);
}
function catchupAll() {
@ -763,7 +760,6 @@ class Feeds extends Handler_Protected {
@$cat_view = $_REQUEST["cat"] == "true";
@$next_unread_feed = $_REQUEST["nuf"];
@$offset = $_REQUEST["skip"];
@$vgroup_last_feed = $_REQUEST["vgrlf"];
$order_by = $_REQUEST["order_by"];
$check_first_id = $_REQUEST["fid"];
@ -851,18 +847,12 @@ class Feeds extends Handler_Protected {
$ret = $this->format_headlines_list($feed, $method,
$view_mode, $limit, $cat_view, $offset,
$vgroup_last_feed, $override_order, true, $check_first_id, $skip_first_id_check);
$override_order, true, $check_first_id, $skip_first_id_check);
//$topmost_article_ids = $ret[0];
$headlines_count = $ret[1];
/* $returned_feed = $ret[2]; */
$disable_cache = $ret[3];
$vgroup_last_feed = $ret[4];
//$reply['headlines']['content'] =& $ret[5]['content'];
//$reply['headlines']['toolbar'] =& $ret[5]['toolbar'];
$reply['headlines'] = $ret[5];
$reply['headlines'] = $ret[4];
if (!$next_unread_feed)
$reply['headlines']['id'] = $feed;
@ -874,8 +864,7 @@ class Feeds extends Handler_Protected {
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);
$reply['headlines-info'] = array("count" => (int) $headlines_count,
"vgroup_last_feed" => $vgroup_last_feed,
"disable_cache" => (bool) $disable_cache);
"disable_cache" => (bool) $disable_cache);
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("30", $timing_info);
@ -921,7 +910,6 @@ class Feeds extends Handler_Protected {
$reply['headlines']['content'] .= "</span></p>";
$reply['headlines-info'] = array("count" => 0,
"vgroup_last_feed" => '',
"unread" => 0,
"disable_cache" => true);
@ -938,7 +926,6 @@ class Feeds extends Handler_Protected {
$reply['headlines']['content'] = "<div class='whiteBox'>". $error . "</div>";
$reply['headlines-info'] = array("count" => 0,
"vgroup_last_feed" => '',
"unread" => 0,
"disable_cache" => true);

View File

@ -680,7 +680,7 @@ body.ttrss_main #headlines-frame {
body.ttrss_main #headlines-frame div.feed-title {
border: 0px solid #257aa7;
border-bottom-width: 1px;
padding: 5px 3px 5px 5px;
padding: 5px 8px;
}
body.ttrss_main #headlines-frame div.feed-title a.title {
color: #555555;

File diff suppressed because one or more lines are too long

View File

@ -799,7 +799,7 @@ body.ttrss_main {
div.feed-title {
border: 0px solid @color-link;
border-bottom-width: 1px;
padding: 5px 3px 5px 5px;
padding: 5px 8px;
}
div.feed-title a.title {

View File

@ -340,11 +340,6 @@ define(["dojo/_base/declare"], function (declare) {
if (offset != 0) {
query.skip = offset;
// to prevent duplicate feed titles when showing grouped vfeeds
if (Headlines.vgroup_last_feed != undefined) {
query.vgrlf = Headlines.vgroup_last_feed;
}
} else if (!is_cat && feed == this.getActive() && !params.method) {
query.m = "ForceUpdate";
}

View File

@ -248,6 +248,22 @@ define(["dojo/_base/declare"], function (declare) {
if (hl.published) row_class += " published";
if (hl.unread) row_class += " Unread";
if (headlines.vfeed_group_enabled && hl.feed_title && this.vgroup_last_feed != hl.feed_id) {
let vgrhdr = `<div data-feed-id='${hl.feed_id}' class='feed-title'>
<div style='float : right'>${hl.feed_icon}</div>
<a class="title" href="#" onclick="Feeds.open({feed:${hl.feed_id}})">${hl.feed_title}
<a class="catchup" onclick="Feeds.catchupFeedInGroup(${hl.feed_id})" href="#">${__('mark feed as read')}</a>
</div>`
const tmp = document.createElement("div");
tmp.innerHTML = vgrhdr;
$("headlines-frame").appendChild(tmp.firstChild);
this.vgroup_last_feed = hl.feed_id;
}
if (App.isCombinedMode()) {
row_class += App.getInitParam("cdm_expanded") ? " expanded" : " expandable";
@ -343,11 +359,13 @@ define(["dojo/_base/declare"], function (declare) {
`;
}
const tmp = document.createElement("div");
tmp.innerHTML = row;
dojo.parser.parse(tmp);
if (row != null) {
const tmp = document.createElement("div");
tmp.innerHTML = row;
dojo.parser.parse(tmp);
$("headlines-frame").appendChild(tmp.firstChild);
$("headlines-frame").appendChild(tmp.firstChild);
}
},
onLoaded: function (transport, offset) {
const reply = App.handleRpcJson(transport);
@ -390,11 +408,12 @@ define(["dojo/_base/declare"], function (declare) {
console.log('received', headlines_count, 'headlines, infscroll disabled=', Feeds.infscroll_disabled);
this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed'];
//this.vgroup_last_feed = reply['headlines-info']['vgroup_last_feed'];
this.current_first_id = reply['headlines']['first_id'];
if (offset == 0) {
this.loaded_article_ids = [];
this.vgroup_last_feed = undefined;
dojo.html.set($("toolbar-headlines"),
reply['headlines']['toolbar'],

View File

@ -680,7 +680,7 @@ body.ttrss_main #headlines-frame {
body.ttrss_main #headlines-frame div.feed-title {
border: 0px solid #257aa7;
border-bottom-width: 1px;
padding: 5px 3px 5px 5px;
padding: 5px 8px;
}
body.ttrss_main #headlines-frame div.feed-title a.title {
color: #555555;

File diff suppressed because one or more lines are too long