report top id changed in headlines buffer
This commit is contained in:
parent
1727ceabca
commit
3444020100
4 changed files with 98 additions and 78 deletions
|
@ -686,6 +686,7 @@ class API extends Handler {
|
|||
|
||||
$headlines = array();
|
||||
|
||||
if (is_resource($result)) {
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
$line["content_preview"] = truncate_string(strip_tags($line["content"]), $excerpt_length);
|
||||
foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) {
|
||||
|
@ -773,6 +774,7 @@ class API extends Handler {
|
|||
|
||||
array_push($headlines, $headline_row);
|
||||
}
|
||||
}
|
||||
|
||||
return $headlines;
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ class Feeds extends Handler_Protected {
|
|||
}
|
||||
}
|
||||
|
||||
if ($this->dbh->num_rows($result) > 0) {
|
||||
if (is_resource($result) && $this->dbh->num_rows($result) > 0) {
|
||||
|
||||
$lnum = $offset;
|
||||
|
||||
|
@ -753,7 +753,7 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("PE", $timing_info);
|
||||
|
||||
} else {
|
||||
} else if (is_resource($result)) {
|
||||
$message = "";
|
||||
|
||||
switch ($view_mode) {
|
||||
|
@ -799,6 +799,9 @@ class Feeds extends Handler_Protected {
|
|||
}
|
||||
$reply['content'] .= "</span></p></div>";
|
||||
}
|
||||
} else if (is_numeric($result) && $result == -1) {
|
||||
$reply['content'] = '';
|
||||
$reply['top_id_changed'] = true;
|
||||
}
|
||||
|
||||
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("H2", $timing_info);
|
||||
|
@ -884,13 +887,6 @@ class Feeds extends Handler_Protected {
|
|||
|
||||
$reply['headlines'] = array();
|
||||
|
||||
if (!$next_unread_feed)
|
||||
$reply['headlines']['id'] = $feed;
|
||||
else
|
||||
$reply['headlines']['id'] = $next_unread_feed;
|
||||
|
||||
$reply['headlines']['is_cat'] = (bool) $cat_view;
|
||||
|
||||
$override_order = false;
|
||||
|
||||
switch ($order_by) {
|
||||
|
@ -917,8 +913,17 @@ class Feeds extends Handler_Protected {
|
|||
$disable_cache = $ret[3];
|
||||
$vgroup_last_feed = $ret[4];
|
||||
|
||||
$reply['headlines']['content'] =& $ret[5]['content'];
|
||||
$reply['headlines']['toolbar'] =& $ret[5]['toolbar'];
|
||||
//$reply['headlines']['content'] =& $ret[5]['content'];
|
||||
//$reply['headlines']['toolbar'] =& $ret[5]['toolbar'];
|
||||
|
||||
$reply['headlines'] =& $ret[5];
|
||||
|
||||
if (!$next_unread_feed)
|
||||
$reply['headlines']['id'] = $feed;
|
||||
else
|
||||
$reply['headlines']['id'] = $next_unread_feed;
|
||||
|
||||
$reply['headlines']['is_cat'] = (bool) $cat_view;
|
||||
|
||||
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("05", $timing_info);
|
||||
|
||||
|
|
|
@ -761,7 +761,7 @@
|
|||
if ($current_top_id != $check_top_id) {
|
||||
// top changed, bail out
|
||||
|
||||
return array(false, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words);
|
||||
return array(-1, $feed_title, $feed_site_url, $last_error, $last_updated, $search_words);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,11 +184,23 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
|
|||
} else {
|
||||
console.log("no new headlines received");
|
||||
|
||||
var top_id_changed = reply['headlines']['top_id_changed'];
|
||||
console.log("top id changed:" + top_id_changed);
|
||||
|
||||
var hsp = $("headlines-spacer");
|
||||
|
||||
if (hsp) hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
|
||||
if (hsp) {
|
||||
if (top_id_changed) {
|
||||
hsp.innerHTML = "<a href='#' onclick='viewCurrentFeed()'>" +
|
||||
__("New articles found, reload feed to continue.") + "</a>";
|
||||
} else {
|
||||
hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
|
||||
__("Click to open next unread feed.") + "</a>";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (articles) {
|
||||
|
@ -1325,13 +1337,14 @@ function headlines_scroll_handler(e) {
|
|||
return;
|
||||
|
||||
}
|
||||
} else {
|
||||
if (hsp)
|
||||
/*} else {
|
||||
if (hsp) {
|
||||
if (_infscroll_disable)
|
||||
hsp.innerHTML = "<a href='#' onclick='openNextUnreadFeed()'>" +
|
||||
__("Click to open next unread feed.") + "</a>";
|
||||
else
|
||||
hsp.innerHTML = "";
|
||||
}*/
|
||||
}
|
||||
|
||||
if (isCdmMode()) {
|
||||
|
|
Loading…
Reference in a new issue