From 203de776e0185414049441ef831063a5a198fd5b Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Jan 2007 10:38:16 +0100 Subject: [PATCH] implement (disabled) support for page skipping in headline view --- backend.php | 12 ++++++++++-- feedlist.js | 20 +++++++++++++++++++- functions.php | 12 ++++++++++-- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/backend.php b/backend.php index 01cfe0a5..05a9957a 100644 --- a/backend.php +++ b/backend.php @@ -299,6 +299,9 @@ $limit = db_escape_string($_GET["limit"]); $cat_view = db_escape_string($_GET["cat"]); $next_unread_feed = db_escape_string($_GET["nuf"]); + $offset = db_escape_string($_GET["skip"]); + + if (!$offset) $offset = 0; if ($subop == "undefined") $subop = ""; @@ -382,7 +385,10 @@ $match_on = "both"; } - $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, $search, $search_mode, $match_on); + $real_offset = $offset * $limit; + + $qfh_ret = queryFeedHeadlines($link, $feed, $limit, $view_mode, $cat_view, + $search, $search_mode, $match_on, false, $real_offset); $result = $qfh_ret[0]; $feed_title = $qfh_ret[1]; @@ -401,10 +407,12 @@ if (db_num_rows($result) > 0) { print_headline_subtoolbar($link, $feed_site_url, $feed_title, false, - $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode); + $rtl_content, $feed, $cat_view, $search, $match_on, $search_mode, $offset); print "
"; +# print "\{$offset}"; + if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { print ""; diff --git a/feedlist.js b/feedlist.js index caffc938..9b47ce49 100644 --- a/feedlist.js +++ b/feedlist.js @@ -14,9 +14,23 @@ function feedlist_callback() { } } -function viewfeed(feed, subop, is_cat, subop_param, skip_history) { +var page_offset = 0; + +function viewFeedGoPage(i) { + page_offset = page_offset + i; + + if (page_offset < 0) page_offset = 0; + + viewfeed(getActiveFeedId(), undefined, undefined, undefined, + undefined, page_offset); + +} + +function viewfeed(feed, subop, is_cat, subop_param, skip_history, offset) { try { + if (!offset) page_offset = 0; + enableHotkeys(); if (!skip_history) { @@ -84,6 +98,10 @@ function viewfeed(feed, subop, is_cat, subop_param, skip_history) { query = query + "&cat=1"; } + if (offset) { + query = query + "&skip=" + offset; + } + if (navigator.userAgent.match("Opera")) { var date = new Date(); var timestamp = Math.round(date.getTime() / 1000); diff --git a/functions.php b/functions.php index bbcfdce3..3811a9a1 100644 --- a/functions.php +++ b/functions.php @@ -2371,7 +2371,7 @@ } $content_query_part = "content as content_preview,"; - + $query = "SELECT guid, ttrss_entries.id,ttrss_entries.title, @@ -2694,7 +2694,7 @@ function print_headline_subtoolbar($link, $feed_site_url, $feed_title, $bottom = false, $rtl_content = false, $feed_id = 0, $is_cat = false, $search = false, $match_on = false, - $search_mode = false) { + $search_mode = false, $offset = 0) { if (!$bottom) { $class = "headlinesSubToolbar"; @@ -2713,6 +2713,14 @@ $rtl_cpart = ""; } +# if ($offset > 0) { +# $prev_page_link = "<<"; +# } else { +# $prev_page_link = "<<"; +# } +# $r_offset = $offset + 1; +# $next_page_link = "[$r_offset] >>"; + if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { print "
".