From c6232e43333ff070cc16d3346369a1712966f68f Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 30 Dec 2005 06:17:23 +0100 Subject: initial work on big feed browser --- backend.php | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- prefs.js | 59 ++++++++++++++++++++++++++++++++++++++++++- prefs.php | 2 ++ tt-rss.css | 12 +++++++++ 4 files changed, 155 insertions(+), 2 deletions(-) diff --git a/backend.php b/backend.php index 20b2740b1..e9783902d 100644 --- a/backend.php +++ b/backend.php @@ -2015,7 +2015,7 @@   - (Browse feeds) + (Top 50) "; } + if ($op == "pref-feed-browser") { + + $subop = $_REQUEST["subop"]; + + if ($subop == "details") { + $id = db_escape_string($_GET["id"]); + print "-- nasty details about feed $id --"; + return; + } + + print "
Under construction
"; + + print "

Feed browser

"; + + $result = db_query($link, "SELECT feed_url,count(id) AS subscribers + FROM ttrss_feeds + WHERE auth_login = '' AND auth_pass = '' AND private = false + GROUP BY feed_url ORDER BY subscribers DESC LIMIT 50"); + + print ""; + + print ""; + + print ""; + + } + db_close($link); ?> diff --git a/prefs.js b/prefs.js index a4096df56..2a8a42d44 100644 --- a/prefs.js +++ b/prefs.js @@ -5,8 +5,8 @@ var active_feed_cat = false; var active_filter = false; var active_label = false; var active_user = false; - var active_tab = false; +var feed_to_expand = false; /*@cc_on @*/ /*@if (@_jscript_version >= 5) @@ -27,6 +27,19 @@ if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest(); } +function expand_feed_callback() { + if (xmlhttp.readyState == 4) { + try { + var container = document.getElementById("BRDET-" + feed_to_expand); + container.innerHTML=xmlhttp.responseText; + container.style.display = "block"; + p_notify(""); + } catch (e) { + exception_error("expand_feed_callback", e); + } + } +} + function feedlist_callback() { if (xmlhttp.readyState == 4) { try { @@ -96,6 +109,14 @@ function labellist_callback() { } } +function feed_browser_callback() { + var container = document.getElementById('prefContent'); + if (xmlhttp.readyState == 4) { + container.innerHTML=xmlhttp.responseText; + p_notify(""); + } +} + function userlist_callback() { var container = document.getElementById('prefContent'); if (xmlhttp.readyState == 4) { @@ -1202,6 +1223,8 @@ function selectTab(id) { updatePrefsList(); } else if (id == "userConfig") { updateUsersList(); + } else if (id == "feedBrowser") { + updateBigFeedBrowser(); } var tab = document.getElementById(active_tab + "Tab"); @@ -1334,3 +1357,37 @@ function feedBrowserSubscribe() { exception_error("feedBrowserSubscribe", e); } } + +function updateBigFeedBrowser() { + + if (!xmlhttp_ready(xmlhttp)) { + printLockingError(); + return + } + + p_notify("Loading, please wait..."); + + xmlhttp.open("GET", "backend.php?op=pref-feed-browser", true); + xmlhttp.onreadystatechange=feed_browser_callback; + xmlhttp.send(null); + +} + +function browserExpand(id) { + try { +/* if (feed_to_expand && feed_to_expand != id) { + var d = document.getElementById("BRDET-" + feed_to_expand); + d.style.display = "none"; + } */ + + feed_to_expand = id; + + xmlhttp.open("GET", "backend.php?op=pref-feed-browser&subop=details&id=" + + param_escape(id), true); + xmlhttp.onreadystatechange=expand_feed_callback; + xmlhttp.send(null); + + } catch (e) { + exception_error("browserExpand", e); + } +} diff --git a/prefs.php b/prefs.php index cfdb5e0c8..c2492f1a1 100644 --- a/prefs.php +++ b/prefs.php @@ -87,6 +87,8 @@ onclick="selectTab('genConfig')"> + diff --git a/tt-rss.css b/tt-rss.css index e2802119b..8da868446 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -940,6 +940,18 @@ span.subscribers { color : #808080; } +div.subscribers { + color : #808080; + font-size : x-small; + float : right; +} + input.feedBrowseCB { margin-right : 1em; } + +div.browserDetails { + margin : 5px 5px 5px 5px; + display : none; + padding : 5px; +} -- cgit v1.2.3