]> git.wh0rd.org Git - tt-rss.git/commitdiff
support browsing of NULL category, assorted related fixes
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 4 Mar 2006 13:58:15 +0000 (14:58 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 4 Mar 2006 13:58:15 +0000 (14:58 +0100)
backend.php
feedlist.js

index 2beffdb26e669d703a4096f794497ed40836d428..977905e5b2bfdafe36df4ee04e5a704228cbea97 100644 (file)
                                        
                                        print "<li class=\"feedCat\" id=\"FCAT-$cat_id\">
                                                <a href=\"javascript:toggleCollapseCat($cat_id)\">$tmp_category</a>
-                                                       <a href=\"javascript:viewCategory($cat_id)\">
+                                                       <a href=\"javascript:viewCategory($cat_id)\" id=\"FCAP-$cat_id\">
                                                        <span id=\"FCATCTR-$cat_id\" 
                                                        class=\"$catctr_class\">($cat_unread unread)$ellipsis</span></a>
                                                        <!-- <div style=\"float : right\">
                $limit = $_GET["limit"];
                $cat_view = $_GET["cat"];
 
-               if (!$feed) {
-                       return;
-               }
-
                if (!$skip) $skip = 0;
 
                if ($subop == "undefined") $subop = "";
                        } */
 
                        if ($cat_view) {
+
+                               if ($feed > 0) {
+                                       $cat_qpart = "cat_id = '$feed'";
+                               } else {
+                                       $cat_qpart = "cat_id IS NULL";
+                               }
+                               
                                $tmp_result = db_query($link, "SELECT feed_url FROM ttrss_feeds
-                                       WHERE cat_id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
+                                       WHERE $cat_qpart AND owner_uid = " . $_SESSION["uid"]);
 
                                while ($tmp_line = db_fetch_assoc($tmp_result)) {                                       
                                        $feed_url = $tmp_line["feed_url"];
 
                if ($subop == "MarkAllRead")  {
 
-                       if (sprintf("%d", $feed) != 0) {
+                       if (preg_match("/^[0-9][0-9]*$/", $feed) != false) {
                        
                                if ($cat_view) {
 
+                                       if ($feed > 0) {
+                                               $cat_qpart = "cat_id = '$feed'";
+                                       } else {
+                                               $cat_qpart = "cat_id IS NULL";
+                                       }
+                                       
                                        $tmp_result = db_query($link, "SELECT id 
-                                               FROM ttrss_feeds WHERE cat_id = '$feed' AND owner_uid = " . 
+                                               FROM ttrss_feeds WHERE $cat_qpart AND owner_uid = " . 
                                                $_SESSION["uid"]);
 
                                        while ($tmp_line = db_fetch_assoc($tmp_result)) {
                if ($search && $search_mode == "All feeds") {
                        $query_strategy_part = "ttrss_entries.id > 0";
                        $vfeed_query_part = "ttrss_feeds.title AS feed_title,";         
-               } else if (sprintf("%d", $feed) == 0) {
+               } else if (preg_match("/^[0-9][0-9]*$/", $feed) == false) {
                        $query_strategy_part = "ttrss_entries.id > 0";
                        $vfeed_query_part = "(SELECT title FROM ttrss_feeds WHERE
                                id = feed_id) as feed_title,";
 
                        if ($cat_view) {
 
-                               $query_strategy_part = "cat_id = $feed";
+                               if ($feed > 0) {
+                                       $query_strategy_part = "cat_id = '$feed'";
+                               } else {
+                                       $query_strategy_part = "cat_id IS NULL";
+                               }
+
                                $vfeed_query_part = "ttrss_feeds.title AS feed_title,";
 
                        } else {                
 
                print "<div id=\"headlinesContainer\">";
 
-               if (sprintf("%d", $feed) != 0) {
+               if (preg_match("/^[0-9][0-9]*$/", $feed) != false) {
 
-                       if ($feed > 0) {                        
+                       if ($feed >= 0) {
                                $feed_kind = "Feeds";
                        } else {
                                $feed_kind = "Labels";
index 370296b6b6724333bc4032665387dc2058888c92..8f9898ac7e6725b0d4f783f4051d110e7734c35b 100644 (file)
@@ -114,7 +114,7 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
                if (cat_view_mode) {
                        query = query + "&cat=1";
                }
-               
+
                var headlines_frame = parent.frames["headlines-frame"];
        
        //      alert(headlines_frame)
@@ -125,6 +125,8 @@ function viewfeed(feed, skip, subop, doc, is_cat) {
                        query = query + "&ts=" + timestamp
                }
 
+               parent.debug(query);
+
                headlines_frame.location.href = query;
        
                cleanSelectedList("feedList");
@@ -192,7 +194,7 @@ function toggleCollapseCat(cat) {
        
                var cat_elem = document.getElementById("FCAT-" + cat);
                var cat_list = document.getElementById("FCATLIST-" + cat).parentNode;
-               var caption = cat_elem.lastChild;
+               var caption = document.getElementById("FCAP-" + cat);
                
                if (cat_list.className.match("invisible")) {
                        cat_list.className = "";