From 95004daf9dcb46fc0e74f631e184ea4aea46ffd5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 18 Dec 2009 15:19:34 +0300 Subject: mobile: implement WIP pagination for flat feedlist --- functions.php | 7 +++++++ mobile/functions.php | 21 +++++++++++++++------ mobile/home.php | 5 +++-- mobile/index.php | 5 +++-- mobile/prefs.php | 16 +++++++++++----- 5 files changed, 39 insertions(+), 15 deletions(-) diff --git a/functions.php b/functions.php index c0d9eaaea..6708612d6 100644 --- a/functions.php +++ b/functions.php @@ -2568,6 +2568,13 @@ } + function getSubscribedFeeds($link) { + $result = db_query($link, "SELECT COUNT(id) AS fn FROM + ttrss_feeds WHERE owner_uid = " . $_SESSION["uid"]); + + return db_fetch_result($result, 0, "fn"); + } + function getTagCounters($link, $smart_mode = SMART_RPC_COUNTERS) { if ($smart_mode) { diff --git a/mobile/functions.php b/mobile/functions.php index 4880e1f57..30200a136 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -22,8 +22,11 @@ return file_exists($filename) && filesize($filename) > 0; } - function render_flat_feed_list($link) { + function render_flat_feed_list($link, $offset) { $owner_uid = $_SESSION["uid"]; + $limit = 30; + + if (!$offset) $offset = 0; if (mobile_get_pref($link, "SORT_FEEDS_UNREAD")) { $order_by = "unread DESC, title"; @@ -42,13 +45,15 @@ ttrss_feeds.hidden = false AND ttrss_feeds.owner_uid = '$owner_uid' AND parent_feed IS NULL - ORDER BY $order_by"); + ORDER BY $order_by LIMIT $limit OFFSET $offset"); - print '"; + $next_offset = $offset + $num_feeds; + + print "
  • Show more feeds...
  • "; + if (!$offset) print ""; } diff --git a/mobile/home.php b/mobile/home.php index 0ac313ac0..2830f5530 100644 --- a/mobile/home.php +++ b/mobile/home.php @@ -20,11 +20,12 @@ login_sequence($link, true); - $use_cats = get_pref($link, 'ENABLE_FEED_CATS'); + $use_cats = mobile_get_pref($link, 'ENABLE_CATS'); + $offset = (int) db_escape_string($_REQUEST["skip"]); if ($use_cats) { render_categories_list($link); } else { - render_flat_feed_list($link); + render_flat_feed_list($link, $offset); } ?> diff --git a/mobile/index.php b/mobile/index.php index a530d0e8b..b3221d67e 100644 --- a/mobile/index.php +++ b/mobile/index.php @@ -69,12 +69,13 @@ diff --git a/mobile/prefs.php b/mobile/prefs.php index a42e31ce7..dd53148c2 100644 --- a/mobile/prefs.php +++ b/mobile/prefs.php @@ -25,6 +25,17 @@ myBackLabel="" myBackHref="home.php">
    + +
    + +
    ">ONOFF
    +
    + +
    + +
    ">ONOFF
    +
    +
    ">ONOFF
    @@ -35,9 +46,4 @@
    ">ONOFF
    -
    - -
    ">ONOFF
    -
    -
    -- cgit v1.2.3