diff options
author | Andrew Dolgov <[email protected]> | 2009-12-21 13:42:02 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2009-12-21 13:42:02 +0300 |
commit | af88c48a3a4f098b5d11b8aaac9a524763ef6d95 (patch) | |
tree | 69a5af8664a67cc2a54928ffb98d99d0bdc3294a | |
parent | 37882ef39272299a28496f2bd4c632eb53b23d7c (diff) |
mobile: misc fixes; add getFeedIcon()
-rw-r--r-- | functions.php | 20 | ||||
-rw-r--r-- | mobile/functions.php | 24 |
2 files changed, 37 insertions, 7 deletions
diff --git a/functions.php b/functions.php index 6708612d6..9fba3c83c 100644 --- a/functions.php +++ b/functions.php @@ -2940,6 +2940,26 @@ } + function getFeedIcon($id) { + switch ($id) { + case -1: + return "images/mark_set.gif"; + break; + case -2: + return "images/pub_set.gif"; + break; + case -3: + return "images/fresh.png"; + break; + case -4: + return "images/tag.png"; + break; + default: + return ICONS_URL . "/$id.ico"; + break; + } + } + function getFeedTitle($link, $id) { if ($id == -1) { return __("Starred articles"); diff --git a/mobile/functions.php b/mobile/functions.php index b68895288..c0085e5ea 100644 --- a/mobile/functions.php +++ b/mobile/functions.php @@ -24,7 +24,7 @@ function render_flat_feed_list($link, $offset) { $owner_uid = $_SESSION["uid"]; - $limit = 30; + $limit = 0; if (!$offset) $offset = 0; @@ -34,22 +34,29 @@ $order_by = "title"; } + if ($limit > 0) { + $limit_qpart = "LIMIT $limit OFFSET $offset"; + } else { + $limit_qpart = ""; + } + $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 + 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 $order_by LIMIT $limit OFFSET $offset"); + ORDER BY $order_by $limit_qpart"); 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; @@ -77,14 +84,15 @@ print "<li class='$class'><a href='feed.php?id=$id'>" . "<img class='tinyIcon' src='$icon_url'/>". $line["title"] . "</a></li>"; - ++$num_feeds; } + + ++$num_feeds; } - $next_offset = $offset + $num_feeds; +/* $next_offset = $offset + $num_feeds; print "<li><a href=\"home.php?skip=$next_offset\" - target=\"_replace\">Show more feeds...</a></li>"; + target=\"_replace\">Show more feeds...</a></li>"; */ if (!$offset) print "</ul>"; @@ -165,6 +173,7 @@ foreach (array(-4, -1,-2,-3) as $id) { $title = getFeedTitle($link, $id); $unread = getFeedUnread($link, $id, false); + $icon = getFeedIcon($id); if ($unread > 0) { $title = $title . " ($unread)"; @@ -175,7 +184,8 @@ if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) { print "<li class='$class'> - <a href='feed.php?id=$id&cat_id=-1'>$title</a></li>"; + <a href='feed.php?id=$id&cat=-1'> + <img class='tinyIcon' src='../$icon'/>$title</a></li>"; } } |