]> git.wh0rd.org Git - tt-rss.git/commitdiff
mobile: fix uncategorized category not respecting the browse cat setting
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 18 Mar 2011 15:08:07 +0000 (18:08 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Fri, 18 Mar 2011 15:08:07 +0000 (18:08 +0300)
mobile/functions.php

index 68530cf8f738b934dc2db2e73fce19c5741e8351..3d3cdc6608f836928d15ea0229305378eda22702 100644 (file)
@@ -4,7 +4,7 @@
        /* TODO replace with interface to db-prefs */
 
        function mobile_pref_toggled($link, $id) {
-               if (get_pref($link, "_MOBILE_$id")) 
+               if (get_pref($link, "_MOBILE_$id"))
                        return "true";
                else
                        return "";
                                        AND ttrss_user_entries.ref_id = ttrss_entries.id
                                        AND owner_uid = '$owner_uid') AS unread
                        FROM ttrss_feeds
-                       WHERE 
+                       WHERE
                                ttrss_feeds.owner_uid = '$owner_uid'
-                       ORDER BY $order_by $limit_qpart"); 
-       
+                       ORDER BY $order_by $limit_qpart");
+
                if (!$offset) print '<ul id="home" title="'.__('Home').'" selected="true"
                        myBackLabel="'.__('Logout').'" myBackHref="logout.php" myBackTarget="_self">';
 
                                $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 {
@@ -83,8 +83,8 @@
                                }
 
                                if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
-                                       print "<li class='$class'><a href='feed.php?id=$id'>" . 
-                                               "<img class='tinyIcon' src='$icon_url'/>".                              
+                                       print "<li class='$class'><a href='feed.php?id=$id'>" .
+                                               "<img class='tinyIcon' src='$icon_url'/>".
                                                $line["title"] . "</a></li>";
                                }
 
@@ -93,7 +93,7 @@
 
 /*                     $next_offset = $offset + $num_feeds;
 
-                       print "<li><a href=\"home.php?skip=$next_offset\" 
+                       print "<li><a href=\"home.php?skip=$next_offset\"
        target=\"_replace\">Show more feeds...</a></li>"; */
 
                        if (!$offset) print "</ul>";
 
        function render_category($link, $cat_id, $offset) {
                $owner_uid = $_SESSION["uid"];
-       
+
                if ($cat_id >= 0) {
 
                        if ($cat_id != 0) {
                                        AND ttrss_user_entries.ref_id = ttrss_entries.id
                                        AND owner_uid = '$owner_uid') as unread
                        FROM ttrss_feeds
-                       WHERE 
-                               ttrss_feeds.owner_uid = '$owner_uid' AND 
+                       WHERE
+                               ttrss_feeds.owner_uid = '$owner_uid' AND
                                $cat_query
-                       ORDER BY $order_by"); 
-                       
+                       ORDER BY $order_by");
+
                        $title = getCategoryTitle($link, $cat_id);
-       
+
                        print "<ul id='cat-$cat_id' title='$title' myBackLabel='".__("Home")."'
                                myBackHref='home.php'>";
-       
+
        //              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 {
                                }
 
                                if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
-                                       print "<li class='$class'><a href='feed.php?id=$id&cat=$cat_id'>" . 
-                                               "<img class='tinyIcon' src='$icon_url'/>".                              
+                                       print "<li class='$class'><a href='feed.php?id=$id&cat=$cat_id'>" .
+                                               "<img class='tinyIcon' src='$icon_url'/>".
                                                $line["title"] . "</a></li>";
                                }
                        }
-       
+
                        print "</ul>";
                } else if ($cat_id == -1) {
 
 
                print '<ul id="home" title="'.__('Home').'" selected="true"
                        myBackLabel="'.__('Logout').'" myBackHref="logout.php" myBackTarget="_self">';
-               
+
 //             print "<li><a href='#searchForm'>Search...</a></li>";
 
                foreach (array(-1, -2) as $id) {
                        $title = getCategoryTitle($link, $id);
                        $unread = getFeedUnread($link, $id, true);
-                       if ($unread > 0) { 
+                       if ($unread > 0) {
                                $title = $title . " ($unread)";
                                $class = '';
                        } else {
                                print "<li class='$class'><a href='feed.php?id=$id&is_cat=true'>$title</a></li>";
                }
 
-               $result = db_query($link, "SELECT 
-                               ttrss_feed_categories.id, 
-                               ttrss_feed_categories.title, 
-                               COUNT(ttrss_feeds.id) AS num_feeds 
+               $result = db_query($link, "SELECT
+                               ttrss_feed_categories.id,
+                               ttrss_feed_categories.title,
+                               COUNT(ttrss_feeds.id) AS num_feeds
                        FROM ttrss_feed_categories, ttrss_feeds
-                       WHERE ttrss_feed_categories.owner_uid = $owner_uid 
-                               AND ttrss_feed_categories.id = cat_id   
-                               GROUP BY ttrss_feed_categories.id, 
+                       WHERE ttrss_feed_categories.owner_uid = $owner_uid
+                               AND ttrss_feed_categories.id = cat_id
+                               GROUP BY ttrss_feed_categories.id,
                                        ttrss_feed_categories.title
                                ORDER BY ttrss_feed_categories.title");
 
 
                                if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
 
-                                       if ($cat_browse) 
-                                               print "<li class='$class'><a href='cat.php?id=$id'>" . 
+                                       if ($cat_browse)
+                                               print "<li class='$class'><a href='cat.php?id=$id'>" .
                                                        $line["title"] . "</a></li>";
                                        else
                                                print "<li class='$class'><a href='feed.php?id=$id&is_cat=true'>".
                        }
 
                        if ($unread > 0 || !mobile_get_pref($link, "HIDE_READ")) {
-                               print "<li class='$class'><a href='cat.php?id=0'>$title</a></li>";
+                               if ($cat_browse)
+                                       print "<li class='$class'><a href='cat.php?id=0'>$title</a></li>";
+                               else
+                                       print "<li class='$class'><a href='feed.php?id=0&is_cat=true'>$title</a></li>";
+
                        }
                }
 
                print "</ul>";
        }
 
-       function render_headlines_list($link, $feed_id, $cat_id, $offset, $search, 
+       function render_headlines_list($link, $feed_id, $cat_id, $offset, $search,
                $is_cat = false) {
 
                $feed_id = $feed_id;
                        $match_on = '';
                }
 
-               $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit, 
+               $qfh_ret = queryFeedHeadlines($link, $feed_id, $limit,
                        $view_mode, $is_cat, $search, $search_mode, $match_on, false, $offset);
 
                $result = $qfh_ret[0];
 
                if (!$offset) {
 
-                       print "<form id=\"searchForm-$feed_id-$cat_id\" class=\"dialog\" method=\"POST\" 
+                       print "<form id=\"searchForm-$feed_id-$cat_id\" class=\"dialog\" method=\"POST\"
                                action=\"feed.php\">
 
                                <input type=\"hidden\" name=\"id\" value=\"$feed_id\">
                    <label>Search:</label>
                                        <input id=\"search\" type=\"text\" name=\"search\"/>
                </fieldset>
-                         </form>"; 
+                         </form>";
 
                        if ($cat_id) {
                                $cat_title = getCategoryTitle($link, $cat_id);
                        $articles_url = "feed.php?id=$feed_id&cat=$cat_id&skip=$next_offset".
                                "&search=$search";
 
-                       print "<li><a href=\"$articles_url\" 
+                       print "<li><a href=\"$articles_url\"
                                target=\"_replace\">Get more articles...</a></li>";
                }
 
                        ".SUBSTRING_FOR_DATE."(updated,1,16) as updated,
                        author
                        FROM ttrss_entries,ttrss_user_entries
-                       WHERE   id = '$id' AND ref_id = id AND owner_uid = " . 
+                       WHERE   id = '$id' AND ref_id = id AND owner_uid = " .
                                $_SESSION["uid"] ;
 
                $result = db_query($link, $query);
 
                        $line = db_fetch_assoc($result);
 
-                       $tmp_result = db_query($link, "UPDATE ttrss_user_entries 
-                               SET unread = false,last_read = NOW() 
+                       $tmp_result = db_query($link, "UPDATE ttrss_user_entries
+                               SET unread = false,last_read = NOW()
                                WHERE ref_id = '$id'
                                AND owner_uid = " . $_SESSION["uid"]);
 
 
                        $title = $line["title"];
                        $article_link = $line["link"];
-       
+
                        $feed_title = getFeedTitle($link, $feed_id, false);
-       
-                       print "<div class=\"panel\" id=\"article-$id\" title=\"$title\" 
+
+                       print "<div class=\"panel\" id=\"article-$id\" title=\"$title\"
                                selected=\"true\"
                                myBackLabel='$feed_title' myBackHref='feed.php?id=$feed_id&cat=$cat_id'>";
-       
+
                        print "<h2><a target='_blank' href='$article_link'>$title</a></h2>";
-       
+
                        print "<fieldset>";
-       
+
 /*                     print "<div class=\"row\">";
                        print "<label id='title'><a target='_blank' href='$article_link'>$title</a></label>";
                        print "</div>"; */
-       
+
                        $is_starred = (sql_bool_to_bool($line["marked"])) ? "true" : "false";
                        $is_published = (sql_bool_to_bool($line["published"])) ? "true" : "false";
-       
+
                        print "<div class=\"row\">";
                        print "<label id='updated'>Updated:</label>";
                        print "<input enabled='false' name='updated' disabled value='$updated_fmt'/>";
                        print "</div>";
-       
+
                        print "</fieldset>";
 
                        $content = sanitize_rss($link, $line["content"]);
                        <label>Starred</label>
                        <div class=\"toggle\" onclick=\"toggleMarked($id, this)\" toggled=\"$is_starred\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>
                    </div>";
-       
+
                        print "<div class=\"row\">
                        <label>Published</label>
                        <div class=\"toggle\" onclick=\"togglePublished($id, this)\" toggled=\"$is_published\"><span class=\"thumb\"></span><span class=\"toggleOn\">ON</span><span class=\"toggleOff\">OFF</span></div>