From af88c48a3a4f098b5d11b8aaac9a524763ef6d95 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 21 Dec 2009 13:42:02 +0300 Subject: [PATCH] mobile: misc fixes; add getFeedIcon() --- functions.php | 20 ++++++++++++++++++++ mobile/functions.php | 24 +++++++++++++++++------- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/functions.php b/functions.php index 6708612d..9fba3c83 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 b6889528..c0085e5e 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 '"; @@ -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 "
  • - $title
  • "; + + $title"; } } -- 2.39.5