From: Andrew Dolgov Date: Fri, 18 Dec 2009 12:19:34 +0000 (+0300) Subject: mobile: implement WIP pagination for flat feedlist X-Git-Tag: 1.4.0~157 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=95004daf9dcb46fc0e74f631e184ea4aea46ffd5;p=tt-rss.git mobile: implement WIP pagination for flat feedlist --- diff --git a/functions.php b/functions.php index c0d9eaae..6708612d 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 4880e1f5..30200a13 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 0ac313ac..2830f553 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 a530d0e8..b3221d67 100644 --- a/mobile/index.php +++ b/mobile/index.php @@ -69,12 +69,13 @@ diff --git a/mobile/prefs.php b/mobile/prefs.php index a42e31ce..dd53148c 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
    -
    -