]> git.wh0rd.org Git - tt-rss.git/commitdiff
initial feed browser work
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 29 Dec 2005 16:36:41 +0000 (17:36 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 29 Dec 2005 16:36:41 +0000 (17:36 +0100)
backend.php
prefs.js
tt-rss.css

index e92317680b4b38c4c2886c8bf737bf881956d575..7b0594660b88b4c80b2913956edbc96a808ad610 100644 (file)
                $subop = $_REQUEST["subop"];
                $quiet = $_REQUEST["quiet"];
 
+               if ($subop == "browse") {
+                       
+                       print "<div class=\"infoBoxContents\">";
+
+                       print "<h1>Feed browser</h1>";
+
+                       print "<p>Showing top 50 registered feeds, sorted by popularity:</p>";
+
+                       $result = db_query($link, "SELECT feed_url,count(id) AS subscribers 
+                               FROM ttrss_feeds WHERE auth_login = '' AND auth_pass = '' 
+                               GROUP BY feed_url ORDER BY subscribers LIMIT 50");
+                       
+                       print "<ul class='browseFeedList' id='browseFeedList'>";
+                       
+                       while ($line = db_fetch_assoc($result)) {
+                               $feed_url = $line["feed_url"];
+                               $subscribers = $line["subscribers"];
+                       
+                               $det_result = db_query($link, "SELECT site_url,title,id 
+                                       FROM ttrss_feeds WHERE feed_url = '$feed_url' LIMIT 1");
+
+                               $details = db_fetch_assoc($det_result);
+                       
+                               $icon_file = ICONS_DIR . "/" . $details["id"] . ".ico";
+
+                               if (file_exists($icon_file) && filesize($icon_file) > 0) {
+                                               $feed_icon = "<img class=\"tinyFeedIcon\"       src=\"" . ICONS_URL . 
+                                                       "/".$details["id"].".ico\">";
+                               } else {
+                                       $feed_icon = "<img class=\"tinyFeedIcon\" src=\"images/blank_icon.gif\">";
+                               }
+
+                               $check_box = "<input class='feedBrowseCB' type=\"checkbox\" id=\"BFCHK-" . $details["id"] . "\">";
+
+                               print "<li>$check_box $feed_icon" . $details["title"] . 
+                                       "&nbsp;<span class='subscribers'>($subscribers)</span></li>";
+                                                               }
+
+                       print "</ul>";
+
+                       print "<div align='center'>
+                               <input type='submit' class='button'                     
+                               onclick=\"closeInfoBox()\" value=\"Cancel\">
+                               <input type=\"submit\" class=\"button\" 
+                               onclick=\"feedBrowserSubscribe()\" value=\"Subscribe\"></div>";
+
+                       print "</div>";
+                       return;
+               }
+
                if ($subop == "editfeed") {
                        $feed_id = db_escape_string($_GET["id"]);
 
                                size=\"40\">
                                <input type=\"submit\" class=\"button\"
                                onclick=\"javascript:addFeed()\" value=\"Add feed\">
+                               &nbsp;
+                               (<a href='javascript:browseFeeds()'>Browse feeds</a>)
                        </td><td align='right'>
                                <input id=\"feed_search\" size=\"20\"  
                                onchange=\"javascript:updateFeedList()\"
index 82d897c97036037f01ae90bf2877c603cdf172c3..3f88fff1977b14f8d520fc6dfbc8fdba0a61b8f1 100644 (file)
--- a/prefs.js
+++ b/prefs.js
@@ -1285,3 +1285,11 @@ function categorizeSelectedFeeds() {
 function validatePrefsReset() {
        return confirm("Reset to defaults?");
 }
+
+function browseFeeds() {
+
+       xmlhttp.open("GET", "backend.php?op=pref-feeds&subop=browse", true);
+       xmlhttp.onreadystatechange=infobox_callback;
+       xmlhttp.send(null);
+
+}
index b0c7bdcd64ddfc40ec18c087eada9ab3a766d6b1..3bd621066085bfa15cc9ccca144546528cc66520 100644 (file)
@@ -922,3 +922,17 @@ ul.userFeedList {
        overflow : auto;
        list-style-type : none;
 }
+
+ul.browseFeedList {
+       height : 300px;
+       overflow : auto;
+       list-style-type : none;
+}
+
+span.subscribers {
+       color : #808080;
+}
+
+input.feedBrowseCB {
+       margin-right : 1em;
+}