mobile: implement WIP pagination for flat feedlist
This commit is contained in:
parent
78d7a96559
commit
95004daf9d
|
@ -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) {
|
||||
|
|
|
@ -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 '<ul id="home" title="'.__('Home').'" selected="true"
|
||||
if (!$offset) print '<ul id="home" title="'.__('Home').'" selected="true"
|
||||
myBackLabel="'.__('Logout').'" myBackHref="logout.php" myBackTarget="_self">';
|
||||
|
||||
// print "<li><a href='#cat-actions'>".__('Actions...')."</a></li>";
|
||||
|
||||
$num_feeds = 0;
|
||||
|
||||
while ($line = db_fetch_assoc($result)) {
|
||||
$id = $line["id"];
|
||||
$unread = $line["unread"];
|
||||
|
@ -72,12 +77,16 @@
|
|||
print "<li class='$class'><a href='feed.php?id=$id'>" .
|
||||
"<img class='tinyIcon' src='$icon_url'/>".
|
||||
$line["title"] . "</a></li>";
|
||||
++$num_feeds;
|
||||
}
|
||||
}
|
||||
|
||||
print "</ul>";
|
||||
$next_offset = $offset + $num_feeds;
|
||||
|
||||
print "<li><a href=\"home.php?skip=$next_offset\"
|
||||
target=\"_replace\">Show more feeds...</a></li>";
|
||||
|
||||
if (!$offset) print "</ul>";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -69,12 +69,13 @@
|
|||
</div>
|
||||
|
||||
<?php
|
||||
$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);
|
||||
}
|
||||
?>
|
||||
|
||||
|
|
|
@ -25,6 +25,17 @@
|
|||
myBackLabel="<?php echo __('Home') ?>" myBackHref="home.php">
|
||||
|
||||
<fieldset>
|
||||
|
||||
<div class="row">
|
||||
<label>Enable categories</label>
|
||||
<div class="toggle" id="ENABLE_CATS" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "ENABLE_CATS") ?>"><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label>Display images</label>
|
||||
<div class="toggle" id="SHOW_IMAGES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SHOW_IMAGES") ?>"><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label>Hide read items</label>
|
||||
<div class="toggle" id="HIDE_READ" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "HIDE_READ") ?>"><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
|
||||
|
@ -35,9 +46,4 @@
|
|||
<div class="toggle" id="SORT_FEEDS_UNREAD" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SORT_FEEDS_UNREAD") ?>"><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<label>Show images</label>
|
||||
<div class="toggle" id="SHOW_IMAGES" onclick="setPref(this)" toggled="<?php echo mobile_pref_toggled($link, "SHOW_IMAGES") ?>"><span class="thumb"></span><span class="toggleOn">ON</span><span class="toggleOff">OFF</span></div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
|
Loading…
Reference in New Issue