queryFeedHeadlines: move to array-based arguments, optionally check if first element changed when paginating
This commit is contained in:
parent
5f297a5c11
commit
f5a0fb8b64
|
@ -658,11 +658,30 @@ class API extends Handler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($feed_id, $limit,
|
/*$qfh_ret = queryFeedHeadlines($feed_id, $limit,
|
||||||
$view_mode, $is_cat, $search, false,
|
$view_mode, $is_cat, $search, false,
|
||||||
$order, $offset, 0, false, $since_id, $include_nested);
|
$order, $offset, 0, false, $since_id, $include_nested);*/
|
||||||
|
|
||||||
$result = $qfh_ret[0];
|
//function queryFeedHeadlines($feed, $limit,
|
||||||
|
// $view_mode, $cat_view, $search, $search_mode,
|
||||||
|
// $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false,
|
||||||
|
// $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) {
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"feed" => $feed_id,
|
||||||
|
"limit" => $limit,
|
||||||
|
"view_mode" => $view_mode,
|
||||||
|
"cat_view" => $is_cat,
|
||||||
|
"search" => $search,
|
||||||
|
"override_order" => $order,
|
||||||
|
"offset" => $offset,
|
||||||
|
"since_id" => $since_id,
|
||||||
|
"include_children" => $include_nested,
|
||||||
|
);
|
||||||
|
|
||||||
|
$qfh_ret = queryFeedHeadlines($params);
|
||||||
|
|
||||||
|
$result = $qfh_ret[0];
|
||||||
$feed_title = $qfh_ret[1];
|
$feed_title = $qfh_ret[1];
|
||||||
|
|
||||||
$headlines = array();
|
$headlines = array();
|
||||||
|
|
|
@ -148,7 +148,7 @@ class Feeds extends Handler_Protected {
|
||||||
|
|
||||||
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
|
private function format_headlines_list($feed, $method, $view_mode, $limit, $cat_view,
|
||||||
$next_unread_feed, $offset, $vgr_last_feed = false,
|
$next_unread_feed, $offset, $vgr_last_feed = false,
|
||||||
$override_order = false, $include_children = false) {
|
$override_order = false, $include_children = false, $check_top_id = false) {
|
||||||
|
|
||||||
$disable_cache = false;
|
$disable_cache = false;
|
||||||
|
|
||||||
|
@ -232,9 +232,28 @@ class Feeds extends Handler_Protected {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
|
/*$qfh_ret = queryFeedHeadlines($feed, $limit, $view_mode, $cat_view,
|
||||||
$search, false, $override_order, $offset, 0,
|
$search, false, $override_order, $offset, 0,
|
||||||
false, 0, $include_children);
|
false, 0, $include_children, $topid);*/
|
||||||
|
|
||||||
|
//function queryFeedHeadlines($feed, $limit,
|
||||||
|
// $view_mode, $cat_view, $search, $search_mode,
|
||||||
|
// $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false,
|
||||||
|
// $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) {
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"feed" => $feed,
|
||||||
|
"limit" => $limit,
|
||||||
|
"view_mode" => $view_mode,
|
||||||
|
"cat_view" => $cat_view,
|
||||||
|
"search" => $search,
|
||||||
|
"override_order" => $override_order,
|
||||||
|
"offset" => $offset,
|
||||||
|
"include_children" => $include_children,
|
||||||
|
"check_top_id" => $check_top_id
|
||||||
|
);
|
||||||
|
|
||||||
|
$qfh_ret = queryFeedHeadlines($params);
|
||||||
}
|
}
|
||||||
|
|
||||||
$vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6;
|
$vfeed_group_enabled = get_pref("VFEED_GROUP_BY_FEED") && $feed != -6;
|
||||||
|
@ -810,6 +829,7 @@ class Feeds extends Handler_Protected {
|
||||||
@$offset = $this->dbh->escape_string($_REQUEST["skip"]);
|
@$offset = $this->dbh->escape_string($_REQUEST["skip"]);
|
||||||
@$vgroup_last_feed = $this->dbh->escape_string($_REQUEST["vgrlf"]);
|
@$vgroup_last_feed = $this->dbh->escape_string($_REQUEST["vgrlf"]);
|
||||||
$order_by = $this->dbh->escape_string($_REQUEST["order_by"]);
|
$order_by = $this->dbh->escape_string($_REQUEST["order_by"]);
|
||||||
|
$check_top_id = $this->dbh->escape_string($_REQUEST["topid"]);
|
||||||
|
|
||||||
if (is_numeric($feed)) $feed = (int) $feed;
|
if (is_numeric($feed)) $feed = (int) $feed;
|
||||||
|
|
||||||
|
@ -889,7 +909,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, true);
|
$vgroup_last_feed, $override_order, true, $check_top_id);
|
||||||
|
|
||||||
//$topmost_article_ids = $ret[0];
|
//$topmost_article_ids = $ret[0];
|
||||||
$headlines_count = $ret[1];
|
$headlines_count = $ret[1];
|
||||||
|
|
|
@ -37,10 +37,31 @@ class Handler_Public extends Handler {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($feed,
|
/*$qfh_ret = queryFeedHeadlines($feed,
|
||||||
1, $view_mode, $is_cat, $search, false,
|
1, $view_mode, $is_cat, $search, false,
|
||||||
$date_sort_field, $offset, $owner_uid,
|
$date_sort_field, $offset, $owner_uid,
|
||||||
false, 0, true, true, false, false, $start_ts);
|
false, 0, true, true, false, false, $start_ts);*/
|
||||||
|
|
||||||
|
//function queryFeedHeadlines($feed,
|
||||||
|
// $limit, $view_mode, $cat_view, $search, $search_mode,
|
||||||
|
// $override_order = false, $offset = 0, $owner_uid = 0,
|
||||||
|
// $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) {
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"owner_uid" => $owner_uid,
|
||||||
|
"feed" => $feed,
|
||||||
|
"limit" => 1,
|
||||||
|
"view_mode" => $view_mode,
|
||||||
|
"cat_view" => $is_cat,
|
||||||
|
"search" => $search,
|
||||||
|
"override_order" => $date_sort_field,
|
||||||
|
"include_children" => true,
|
||||||
|
"ignore_vfeed_group" => true,
|
||||||
|
"offset" => $offset,
|
||||||
|
"start_ts" => $start_ts
|
||||||
|
);
|
||||||
|
|
||||||
|
$qfh_ret = queryFeedHeadlines($params);
|
||||||
|
|
||||||
$result = $qfh_ret[0];
|
$result = $qfh_ret[0];
|
||||||
|
|
||||||
|
@ -58,11 +79,26 @@ class Handler_Public extends Handler {
|
||||||
header("Last-Modified: $last_modified", true);
|
header("Last-Modified: $last_modified", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines($feed,
|
/*$qfh_ret = queryFeedHeadlines($feed,
|
||||||
$limit, $view_mode, $is_cat, $search, false,
|
$limit, $view_mode, $is_cat, $search, false,
|
||||||
$date_sort_field, $offset, $owner_uid,
|
$date_sort_field, $offset, $owner_uid,
|
||||||
false, 0, true, true, false, false, $start_ts);
|
false, 0, true, true, false, false, $start_ts);*/
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"owner_uid" => $owner_uid,
|
||||||
|
"feed" => $feed,
|
||||||
|
"limit" => $limit,
|
||||||
|
"view_mode" => $view_mode,
|
||||||
|
"cat_view" => $is_cat,
|
||||||
|
"search" => $search,
|
||||||
|
"override_order" => $date_sort_field,
|
||||||
|
"include_children" => true,
|
||||||
|
"ignore_vfeed_group" => true,
|
||||||
|
"offset" => $offset,
|
||||||
|
"start_ts" => $start_ts
|
||||||
|
);
|
||||||
|
|
||||||
|
$qfh_ret = queryFeedHeadlines($params);
|
||||||
|
|
||||||
$result = $qfh_ret[0];
|
$result = $qfh_ret[0];
|
||||||
$feed_title = htmlspecialchars($qfh_ret[1]);
|
$feed_title = htmlspecialchars($qfh_ret[1]);
|
||||||
|
@ -496,7 +532,7 @@ class Handler_Public extends Handler {
|
||||||
</div>
|
</div>
|
||||||
<button type="submit"><?php echo __('Share') ?></button>
|
<button type="submit"><?php echo __('Share') ?></button>
|
||||||
<button onclick="return window.close()"><?php echo __('Cancel') ?></button>
|
<button onclick="return window.close()"><?php echo __('Cancel') ?></button>
|
||||||
</div>
|
</td>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
|
|
|
@ -83,9 +83,22 @@ class Pref_Filters extends Handler_Protected {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$qfh_ret = queryFeedHeadlines(-4, 30, "", false, false, false,
|
//function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode,
|
||||||
"date_entered DESC", 0, $_SESSION["uid"], $filter);
|
// $override_order = false, $offset = 0, $owner_uid = 0, $filter = false,
|
||||||
|
|
||||||
|
/*$qfh_ret = queryFeedHeadlines(-4, 30, "", false, false, false,
|
||||||
|
"date_entered DESC", 0, $_SESSION["uid"], $filter);*/
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"feed" => -4,
|
||||||
|
"limit" => 30,
|
||||||
|
"view_mode" => "",
|
||||||
|
"cat_view" => false,
|
||||||
|
"override_order" => "date_entered DESC",
|
||||||
|
"filter" => $filter
|
||||||
|
);
|
||||||
|
|
||||||
|
$qfh_ret = queryFeedHeadlines($params);
|
||||||
$result = $qfh_ret[0];
|
$result = $qfh_ret[0];
|
||||||
|
|
||||||
$found = 0;
|
$found = 0;
|
||||||
|
|
|
@ -426,9 +426,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// $search_mode is obsolete/unused
|
// $search_mode is obsolete/unused
|
||||||
function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false) {
|
//function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false, $start_ts = false, $check_top_id = false) {
|
||||||
|
function queryFeedHeadlines($params) {
|
||||||
|
|
||||||
if (!$owner_uid) $owner_uid = $_SESSION["uid"];
|
$feed = $params["feed"];
|
||||||
|
$limit = isset($params["limit"]) ? $params["limit"] : 30;
|
||||||
|
$view_mode = $params["view_mode"];
|
||||||
|
$cat_view = isset($params["cat_view"]) ? $params["cat_view"] : false;
|
||||||
|
$search = isset($params["search"]) ? $params["search"] : false;
|
||||||
|
$override_order = isset($params["override_order"]) ? $params["override_order"] : false;
|
||||||
|
$offset = isset($params["offset"]) ? $params["offset"] : 0;
|
||||||
|
$owner_uid = isset($params["owner_uid"]) ? $params["owner_uid"] : $_SESSION["uid"];
|
||||||
|
$filter = isset($params["filter"]) ? $params["filter"] : 0;
|
||||||
|
$since_id = isset($params["since_id"]) ? $params["since_id"] : 0;
|
||||||
|
$include_children = isset($params["include_children"]) ? $params["include_children"] : false;
|
||||||
|
$ignore_vfeed_group = isset($params["ignore_vfeed_group"]) ? $params["ignore_vfeed_group"] : false;
|
||||||
|
$override_strategy = isset($params["override_strategy"]) ? $params["override_strategy"] : false;
|
||||||
|
$override_vfeed = isset($params["override_vfeed"]) ? $params["override_vfeed"] : false;
|
||||||
|
$start_ts = isset($params["start_ts"]) ? $params["start_ts"] : false;
|
||||||
|
$check_top_id = isset($params["check_top_id"]) ? $params["check_top_id"] : false;
|
||||||
|
|
||||||
$ext_tables_part = "";
|
$ext_tables_part = "";
|
||||||
$search_words = array();
|
$search_words = array();
|
||||||
|
@ -711,6 +727,45 @@
|
||||||
$start_ts_query_part = "";
|
$start_ts_query_part = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// if previous topmost article id changed that means our current pagination is no longer valid
|
||||||
|
if ($check_top_id) {
|
||||||
|
$query = "SELECT DISTINCT
|
||||||
|
date_entered,
|
||||||
|
guid,
|
||||||
|
ttrss_entries.id,
|
||||||
|
ttrss_entries.title,
|
||||||
|
updated,
|
||||||
|
score
|
||||||
|
FROM
|
||||||
|
$from_qpart
|
||||||
|
WHERE
|
||||||
|
$feed_check_qpart
|
||||||
|
ttrss_user_entries.ref_id = ttrss_entries.id AND
|
||||||
|
ttrss_user_entries.owner_uid = '$owner_uid' AND
|
||||||
|
$search_query_part
|
||||||
|
$start_ts_query_part
|
||||||
|
$filter_query_part
|
||||||
|
$view_query_part
|
||||||
|
$since_id_part
|
||||||
|
$query_strategy_part ORDER BY $order_by LIMIT 1";
|
||||||
|
|
||||||
|
if ($_REQUEST["debug"]) {
|
||||||
|
print $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = db_query($query);
|
||||||
|
if ($result) {
|
||||||
|
$current_top_id = db_fetch_result($result, 0, "id");
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$query = "SELECT DISTINCT
|
$query = "SELECT DISTINCT
|
||||||
date_entered,
|
date_entered,
|
||||||
guid,
|
guid,
|
||||||
|
|
|
@ -99,6 +99,10 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req, can_w
|
||||||
query = query + "&m=" + param_escape(method);
|
query = query + "&m=" + param_escape(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (current_top_article_id && offset > 0) {
|
||||||
|
query = query + "&topid=" + param_escape(current_top_article_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (!background) {
|
if (!background) {
|
||||||
if (_search_query) {
|
if (_search_query) {
|
||||||
force_nocache = true;
|
force_nocache = true;
|
||||||
|
|
|
@ -13,6 +13,7 @@ var catchup_timeout_id = false;
|
||||||
var cids_requested = [];
|
var cids_requested = [];
|
||||||
var loaded_article_ids = [];
|
var loaded_article_ids = [];
|
||||||
var _last_headlines_update = 0;
|
var _last_headlines_update = 0;
|
||||||
|
var current_top_article_id = false;
|
||||||
|
|
||||||
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
|
var has_storage = 'sessionStorage' in window && window['sessionStorage'] !== null;
|
||||||
|
|
||||||
|
@ -83,6 +84,7 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
|
||||||
|
|
||||||
if (infscroll_req == false) {
|
if (infscroll_req == false) {
|
||||||
loaded_article_ids = [];
|
loaded_article_ids = [];
|
||||||
|
current_top_article_id = false;
|
||||||
|
|
||||||
dijit.byId("headlines-frame").attr('content',
|
dijit.byId("headlines-frame").attr('content',
|
||||||
reply['headlines']['content']);
|
reply['headlines']['content']);
|
||||||
|
@ -102,6 +104,10 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (loaded_article_ids.size() > 0) {
|
||||||
|
current_top_article_id = parseInt(loaded_article_ids[0].replace("RROW-", ""));
|
||||||
|
}
|
||||||
|
|
||||||
var hsp = $("headlines-spacer");
|
var hsp = $("headlines-spacer");
|
||||||
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
|
if (!hsp) hsp = new Element("DIV", {"id": "headlines-spacer"});
|
||||||
dijit.byId('headlines-frame').domNode.appendChild(hsp);
|
dijit.byId('headlines-frame').domNode.appendChild(hsp);
|
||||||
|
|
|
@ -35,7 +35,7 @@ class VF_Shared extends Plugin {
|
||||||
//function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
|
//function queryFeedHeadlines($feed, $limit, $view_mode, $cat_view, $search, $search_mode, $override_order = false, $offset = 0, $owner_uid = 0, $filter = false, $since_id = 0, $include_children = false, $ignore_vfeed_group = false, $override_strategy = false, $override_vfeed = false) {
|
||||||
|
|
||||||
function get_headlines($feed_id, $options) {
|
function get_headlines($feed_id, $options) {
|
||||||
$qfh_ret = queryFeedHeadlines(-4,
|
/*$qfh_ret = queryFeedHeadlines(-4,
|
||||||
$options['limit'],
|
$options['limit'],
|
||||||
$this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
|
$this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
|
||||||
false,
|
false,
|
||||||
|
@ -49,8 +49,23 @@ class VF_Shared extends Plugin {
|
||||||
$options['include_children'],
|
$options['include_children'],
|
||||||
false,
|
false,
|
||||||
"uuid != ''",
|
"uuid != ''",
|
||||||
"ttrss_feeds.title AS feed_title,");
|
"ttrss_feeds.title AS feed_title,"); */
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
"feed" => -4,
|
||||||
|
"limit" => $options["limit"],
|
||||||
|
"view_mode" => $this->get_unread(-1) > 0 ? "adaptive" : "all_articles",
|
||||||
|
"search" => $options['search'],
|
||||||
|
"override_order" => $options['override_order'],
|
||||||
|
"offset" => $options["offset"],
|
||||||
|
"filter" => $options["filter"],
|
||||||
|
"since_id" => $options["since_id"],
|
||||||
|
"include_children" => $options["include_children"],
|
||||||
|
"override_strategy" => "uuid != ''",
|
||||||
|
"override_vfeed" => "ttrss_feeds.title AS feed_title,"
|
||||||
|
);
|
||||||
|
|
||||||
|
$qfh_ret = queryFeedHeadlines($params);
|
||||||
$qfh_ret[1] = __("Shared articles");
|
$qfh_ret[1] = __("Shared articles");
|
||||||
|
|
||||||
return $qfh_ret;
|
return $qfh_ret;
|
||||||
|
|
Loading…
Reference in New Issue