use popup feedbrowser for main UI (incomplete)
This commit is contained in:
parent
273d1e293e
commit
b56465dd56
|
@ -60,66 +60,33 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
print "<div id=\"infoBoxTitle\">".__('Other feeds: Top 25')."</div>";
|
print "<div id=\"infoBoxTitle\">".__('Feed Browser')."</div>";
|
||||||
|
|
||||||
print "<div class=\"infoBoxContents\">";
|
print "<div class=\"infoBoxContents\">";
|
||||||
|
|
||||||
print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>";
|
|
||||||
|
$browser_search = db_escape_string($_GET["search"]);
|
||||||
|
|
||||||
|
if (array_key_exists("search", $_GET)) {
|
||||||
|
$_SESSION["feed_browser_search"] = $browser_search;
|
||||||
|
} else {
|
||||||
|
$browser_search = $_SESSION["feed_browser_search"];
|
||||||
|
}
|
||||||
|
|
||||||
|
//print "<p>".__("Showing top 25 registered feeds, sorted by popularity:")."</p>";
|
||||||
|
print "<input id=\"feed_browser_search\" size=\"20\" type=\"search\"
|
||||||
|
onfocus=\"javascript:disableHotkeys();\"
|
||||||
|
onblur=\"javascript:enableHotkeys();\"
|
||||||
|
onchange=\"javascript:updateFeedBrowser()\" value=\"$browser_search\">
|
||||||
|
<input type=\"submit\" class=\"button\"
|
||||||
|
onclick=\"javascript:updateFeedBrowser()\" value=\"".__('Search')."\">";
|
||||||
|
|
||||||
|
print "<p>";
|
||||||
|
|
||||||
$owner_uid = $_SESSION["uid"];
|
$owner_uid = $_SESSION["uid"];
|
||||||
|
|
||||||
/* $result = db_query($link, "SELECT feed_url,COUNT(id) AS subscribers
|
|
||||||
FROM ttrss_feeds WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
|
|
||||||
WHERE tf.feed_url = ttrss_feeds.feed_url
|
|
||||||
AND owner_uid = '$owner_uid') GROUP BY feed_url
|
|
||||||
ORDER BY subscribers DESC LIMIT 25"); */
|
|
||||||
|
|
||||||
$result = db_query($link, "SELECT feed_url, subscribers FROM
|
|
||||||
ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
|
|
||||||
WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
|
|
||||||
AND owner_uid = '$owner_uid') ORDER BY subscribers DESC LIMIT 25");
|
|
||||||
|
|
||||||
print "<ul class='browseFeedList' id='browseFeedList'>";
|
print "<ul class='browseFeedList' id='browseFeedList'>";
|
||||||
|
$subscribe_btn_disabled = print_feed_browser($link, $search, $limit) == 0 ? "disabled" : "";
|
||||||
$feedctr = 0;
|
|
||||||
|
|
||||||
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 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 " . $details["title"] .
|
|
||||||
" <span class='subscribers'>($subscribers)</span></li>";
|
|
||||||
|
|
||||||
++$feedctr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($feedctr == 0) {
|
|
||||||
print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
|
|
||||||
$subscribe_btn_disabled = "disabled";
|
|
||||||
} else {
|
|
||||||
$subscribe_btn_disabled = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
print "</ul>";
|
print "</ul>";
|
||||||
|
|
||||||
print "<div align='center'>
|
print "<div align='center'>
|
||||||
|
@ -1463,4 +1430,51 @@
|
||||||
print "</p>";
|
print "</p>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function print_feed_browser($link, $search, $limit) {
|
||||||
|
|
||||||
|
$result = db_query($link, "SELECT feed_url, subscribers FROM
|
||||||
|
ttrss_feedbrowser_cache WHERE (SELECT COUNT(id) = 0 FROM ttrss_feeds AS tf
|
||||||
|
WHERE tf.feed_url = ttrss_feedbrowser_cache.feed_url
|
||||||
|
AND owner_uid = '$owner_uid') ORDER BY subscribers DESC LIMIT 25");
|
||||||
|
|
||||||
|
$feedctr = 0;
|
||||||
|
|
||||||
|
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 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 " . $details["title"] .
|
||||||
|
" <span class='subscribers'>($subscribers)</span></li>";
|
||||||
|
|
||||||
|
++$feedctr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($feedctr == 0) {
|
||||||
|
print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $feedctr;
|
||||||
|
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|
5
prefs.js
5
prefs.js
|
@ -2256,3 +2256,8 @@ function batchFeedsToggleField(cb, elem, label) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateFeedBrowser() {
|
||||||
|
alert("FIXME");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
28
tt-rss.js
28
tt-rss.js
|
@ -1422,3 +1422,31 @@ function addLabel() {
|
||||||
function visitOfficialSite() {
|
function visitOfficialSite() {
|
||||||
window.open("http://tt-rss.org/");
|
window.open("http://tt-rss.org/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function browseFeeds(limit) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
var query = "backend.php?op=pref-feeds&subop=browse";
|
||||||
|
|
||||||
|
notify_progress("Loading, please wait...", true);
|
||||||
|
|
||||||
|
new Ajax.Request(query, {
|
||||||
|
onComplete: function(transport) {
|
||||||
|
infobox_callback2(transport);
|
||||||
|
} });
|
||||||
|
|
||||||
|
return false;
|
||||||
|
} catch (e) {
|
||||||
|
exception_error("browseFeeds", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateFeedBrowser() {
|
||||||
|
alert("FIXME");
|
||||||
|
}
|
||||||
|
|
||||||
|
function feedBrowserSubscribe() {
|
||||||
|
alert("FIXME");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -140,7 +140,7 @@ window.onload = init;
|
||||||
href="javascript:toggleTags()"><?php echo __("tag cloud") ?></a>
|
href="javascript:toggleTags()"><?php echo __("tag cloud") ?></a>
|
||||||
<?php if (!SINGLE_USER_MODE) { ?>
|
<?php if (!SINGLE_USER_MODE) { ?>
|
||||||
<br/>
|
<br/>
|
||||||
<a id="feedBrowserPrompt" href="prefs.php?tab=feedBrowser"
|
<a id="feedBrowserPrompt" onclick="return browseFeeds()" href="#"
|
||||||
title="<?php echo __('More feeds...') ?>">+</a>
|
title="<?php echo __('More feeds...') ?>">+</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue