]> git.wh0rd.org Git - tt-rss.git/commitdiff
mobile: misc fixes; add getFeedIcon()
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 21 Dec 2009 10:42:02 +0000 (13:42 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 21 Dec 2009 10:42:02 +0000 (13:42 +0300)
functions.php
mobile/functions.php

index 6708612d6c9f87c6b0ce03a72cc65cecebd8d581..9fba3c83c9f9af4aa9fe35f64eb31bd57bee0d65 100644 (file)
 
        }
 
+       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");
index b68895288dbe527820af8bd9254f9d0bff3959c8..c0085e5ea5ca44d85dce8053a9e07c01fac71944 100644 (file)
@@ -24,7 +24,7 @@
 
        function render_flat_feed_list($link, $offset) {
                $owner_uid = $_SESSION["uid"];
-               $limit = 30;
+               $limit = 0;
 
                if (!$offset) $offset = 0;
 
                        $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;
                                        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>";
 
                        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)";
 
                                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>";
                                }
                        }