mobile: implement flat list browsing mode
This commit is contained in:
parent
706fe94907
commit
b1bd222cd5
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
define('MOBILE_FEEDLIST_ENABLE_ICONS', false);
|
|
||||||
define('TTRSS_SESSION_NAME', 'ttrss_m_sid');
|
define('TTRSS_SESSION_NAME', 'ttrss_m_sid');
|
||||||
|
|
||||||
function mobile_feed_has_icon($id) {
|
function mobile_feed_has_icon($id) {
|
||||||
|
@ -8,6 +7,56 @@
|
||||||
return file_exists($filename) && filesize($filename) > 0;
|
return file_exists($filename) && filesize($filename) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function render_flat_feed_list($link) {
|
||||||
|
$owner_uid = $_SESSION["uid"];
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT id,
|
||||||
|
title,
|
||||||
|
(SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries
|
||||||
|
WHERE feed_id = ttrss_feeds.id AND unread = true
|
||||||
|
AND ttrss_user_entries.ref_id = ttrss_entries.id
|
||||||
|
AND owner_uid = '$owner_uid') as unread
|
||||||
|
FROM ttrss_feeds
|
||||||
|
WHERE
|
||||||
|
ttrss_feeds.hidden = false AND
|
||||||
|
ttrss_feeds.owner_uid = '$owner_uid' AND
|
||||||
|
parent_feed IS NULL
|
||||||
|
ORDER BY unread DESC,title");
|
||||||
|
|
||||||
|
print '<ul id="home" title="Feeds" selected="true">';
|
||||||
|
|
||||||
|
// print "<li><a href='#cat-actions'>".__('Actions...')."</a></li>";
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
$id = $line["id"];
|
||||||
|
$unread = $line["unread"];
|
||||||
|
|
||||||
|
// $unread = rand(0, 100);
|
||||||
|
|
||||||
|
if ($unread > 0) {
|
||||||
|
$line["title"] = $line["title"] . " ($unread)";
|
||||||
|
$class = '';
|
||||||
|
} else {
|
||||||
|
$class = 'oldItem';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mobile_feed_has_icon($id)) {
|
||||||
|
$icon_url = "../".ICONS_URL."/$id.ico";
|
||||||
|
} else {
|
||||||
|
$icon_url = "../images/blank_icon.gif";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<li class='$class'><a href='feed.php?id=$id'>" .
|
||||||
|
"<img class='tinyIcon' src='$icon_url'/>".
|
||||||
|
$line["title"] . "</a></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</ul>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function render_category($link, $cat_id) {
|
function render_category($link, $cat_id) {
|
||||||
$owner_uid = $_SESSION["uid"];
|
$owner_uid = $_SESSION["uid"];
|
||||||
|
|
||||||
|
@ -223,10 +272,15 @@
|
||||||
$result = $qfh_ret[0];
|
$result = $qfh_ret[0];
|
||||||
$feed_title = $qfh_ret[1];
|
$feed_title = $qfh_ret[1];
|
||||||
|
|
||||||
$cat_title = getCategoryTitle($link, $cat_id);
|
if ($cat_id) {
|
||||||
|
$cat_title = getCategoryTitle($link, $cat_id);
|
||||||
|
|
||||||
print "<ul id=\"feed-$feed_id\" title=\"$feed_title\" selected=\"true\"
|
print "<ul id=\"feed-$feed_id\" title=\"$feed_title\" selected=\"true\"
|
||||||
myBackLabel='$cat_title' myBackHref='cat.php?id=$cat_id'>";
|
myBackLabel='$cat_title' myBackHref='cat.php?id=$cat_id'>";
|
||||||
|
} else {
|
||||||
|
print "<ul id=\"feed-$feed_id\" title=\"$feed_title\" selected=\"true\"
|
||||||
|
myBackLabel='Feeds' myBackHref='home.php'>";
|
||||||
|
}
|
||||||
|
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
$id = $line["id"];
|
$id = $line["id"];
|
||||||
|
|
|
@ -20,5 +20,11 @@
|
||||||
|
|
||||||
login_sequence($link, true);
|
login_sequence($link, true);
|
||||||
|
|
||||||
render_categories_list($link);
|
$use_cats = get_pref($link, 'ENABLE_FEED_CATS');
|
||||||
|
|
||||||
|
if ($use_cats) {
|
||||||
|
render_categories_list($link);
|
||||||
|
} else {
|
||||||
|
render_flat_feed_list($link);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -67,8 +67,16 @@
|
||||||
<a id="myBackButton" class="button" href="#"></a>
|
<a id="myBackButton" class="button" href="#"></a>
|
||||||
<a class="button" target="_self" href="logout.php">Logout</a>
|
<a class="button" target="_self" href="logout.php">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php render_categories_list($link); ?>
|
<?php
|
||||||
|
$use_cats = get_pref($link, 'ENABLE_FEED_CATS');
|
||||||
|
|
||||||
|
if ($use_cats) {
|
||||||
|
render_categories_list($link);
|
||||||
|
} else {
|
||||||
|
render_flat_feed_list($link);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue