initial work on big feed browser
This commit is contained in:
parent
88d9259a4e
commit
c6232e4333
84
backend.php
84
backend.php
|
@ -2015,7 +2015,7 @@
|
||||||
<input type=\"submit\" class=\"button\"
|
<input type=\"submit\" class=\"button\"
|
||||||
onclick=\"javascript:addFeed()\" value=\"Add feed\">
|
onclick=\"javascript:addFeed()\" value=\"Add feed\">
|
||||||
|
|
||||||
(<a href='javascript:browseFeeds()'>Browse feeds</a>)
|
(<a href='javascript:browseFeeds()'>Top 50</a>)
|
||||||
</td><td align='right'>
|
</td><td align='right'>
|
||||||
<input id=\"feed_search\" size=\"20\"
|
<input id=\"feed_search\" size=\"20\"
|
||||||
onchange=\"javascript:updateFeedList()\"
|
onchange=\"javascript:updateFeedList()\"
|
||||||
|
@ -3928,6 +3928,88 @@
|
||||||
onclick=\"closeInfoBox()\" value=\"Close this window\"></div>";
|
onclick=\"closeInfoBox()\" value=\"Close this window\"></div>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 "<div class=\"warning\">Under construction</div>";
|
||||||
|
|
||||||
|
print "<h1>Feed browser</h1>";
|
||||||
|
|
||||||
|
$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 "<ul class='nomarks' id='browseFeedList'>";
|
||||||
|
|
||||||
|
$feedctr = 0;
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
$feed_url = $line["feed_url"];
|
||||||
|
$subscribers = $line["subscribers"];
|
||||||
|
|
||||||
|
$sub_result = db_query($link, "SELECT id
|
||||||
|
FROM ttrss_feeds WHERE feed_url = '$feed_url' AND owner_uid =" .
|
||||||
|
$_SESSION["uid"]);
|
||||||
|
|
||||||
|
if (db_num_rows($sub_result) > 0) {
|
||||||
|
continue; // already subscribed
|
||||||
|
}
|
||||||
|
|
||||||
|
$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 onclick='toggleSelectListRow(this)' class='feedBrowseCB'
|
||||||
|
type=\"checkbox\" id=\"FBCHK-" . $details["id"] . "\">";
|
||||||
|
|
||||||
|
$class = ($feedctr % 2) ? "even" : "odd";
|
||||||
|
|
||||||
|
print "<li class='$class' id=\"FBROW-".$details["id"]."\">$check_box".
|
||||||
|
"$feed_icon ";
|
||||||
|
|
||||||
|
print "<a href=\"javascript:browserExpand('".$details["id"]."')\">" .
|
||||||
|
$details["title"] ."</a> " .
|
||||||
|
"<span class='subscribers'>($subscribers)</span>";
|
||||||
|
|
||||||
|
print "<div class=\"browserDetails\" id=\"BRDET-" . $details["id"] . "\">";
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
print "</li>";
|
||||||
|
|
||||||
|
++$feedctr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($feedctr == 0) {
|
||||||
|
print "<li>No feeds found to subscribe.</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</ul>";
|
||||||
|
|
||||||
|
print "<input type='submit' class='button' onclick=\"feedBrowserSubscribe()\"
|
||||||
|
value=\"Subscribe\">";
|
||||||
|
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
db_close($link);
|
db_close($link);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
59
prefs.js
59
prefs.js
|
@ -5,8 +5,8 @@ var active_feed_cat = false;
|
||||||
var active_filter = false;
|
var active_filter = false;
|
||||||
var active_label = false;
|
var active_label = false;
|
||||||
var active_user = false;
|
var active_user = false;
|
||||||
|
|
||||||
var active_tab = false;
|
var active_tab = false;
|
||||||
|
var feed_to_expand = false;
|
||||||
|
|
||||||
/*@cc_on @*/
|
/*@cc_on @*/
|
||||||
/*@if (@_jscript_version >= 5)
|
/*@if (@_jscript_version >= 5)
|
||||||
|
@ -27,6 +27,19 @@ if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
|
||||||
xmlhttp = new XMLHttpRequest();
|
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() {
|
function feedlist_callback() {
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
try {
|
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() {
|
function userlist_callback() {
|
||||||
var container = document.getElementById('prefContent');
|
var container = document.getElementById('prefContent');
|
||||||
if (xmlhttp.readyState == 4) {
|
if (xmlhttp.readyState == 4) {
|
||||||
|
@ -1202,6 +1223,8 @@ function selectTab(id) {
|
||||||
updatePrefsList();
|
updatePrefsList();
|
||||||
} else if (id == "userConfig") {
|
} else if (id == "userConfig") {
|
||||||
updateUsersList();
|
updateUsersList();
|
||||||
|
} else if (id == "feedBrowser") {
|
||||||
|
updateBigFeedBrowser();
|
||||||
}
|
}
|
||||||
|
|
||||||
var tab = document.getElementById(active_tab + "Tab");
|
var tab = document.getElementById(active_tab + "Tab");
|
||||||
|
@ -1334,3 +1357,37 @@ function feedBrowserSubscribe() {
|
||||||
exception_error("feedBrowserSubscribe", e);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -87,6 +87,8 @@
|
||||||
onclick="selectTab('genConfig')">
|
onclick="selectTab('genConfig')">
|
||||||
<input id="feedConfigTab" class="prefsTab" type="submit" value="Feed Configuration"
|
<input id="feedConfigTab" class="prefsTab" type="submit" value="Feed Configuration"
|
||||||
onclick="selectTab('feedConfig')">
|
onclick="selectTab('feedConfig')">
|
||||||
|
<input id="feedBrowserTab" class="prefsTab" type="submit" value="Feed Browser"
|
||||||
|
onclick="selectTab('feedBrowser')">
|
||||||
<input id="filterConfigTab" class="prefsTab" type="submit" value="Content Filtering"
|
<input id="filterConfigTab" class="prefsTab" type="submit" value="Content Filtering"
|
||||||
onclick="selectTab('filterConfig')">
|
onclick="selectTab('filterConfig')">
|
||||||
<? if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) { ?>
|
<? if (GLOBAL_ENABLE_LABELS && get_pref($link, 'ENABLE_LABELS')) { ?>
|
||||||
|
|
12
tt-rss.css
12
tt-rss.css
|
@ -940,6 +940,18 @@ span.subscribers {
|
||||||
color : #808080;
|
color : #808080;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.subscribers {
|
||||||
|
color : #808080;
|
||||||
|
font-size : x-small;
|
||||||
|
float : right;
|
||||||
|
}
|
||||||
|
|
||||||
input.feedBrowseCB {
|
input.feedBrowseCB {
|
||||||
margin-right : 1em;
|
margin-right : 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.browserDetails {
|
||||||
|
margin : 5px 5px 5px 5px;
|
||||||
|
display : none;
|
||||||
|
padding : 5px;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue