From b56465dd56772efb80ef251d8d19f7177b244d57 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 23 Jan 2009 19:54:57 +0100 Subject: [PATCH] use popup feedbrowser for main UI (incomplete) --- modules/pref-feeds.php | 120 +++++++++++++++++++++++------------------ prefs.js | 5 ++ tt-rss.js | 28 ++++++++++ tt-rss.php | 2 +- 4 files changed, 101 insertions(+), 54 deletions(-) diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index bc8171c6d..0bdaf4e55 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -60,66 +60,33 @@ return; } - print "
".__('Other feeds: Top 25')."
"; + print "
".__('Feed Browser')."
"; print "
"; - print "

".__("Showing top 25 registered feeds, sorted by popularity:")."

"; + + $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 "

".__("Showing top 25 registered feeds, sorted by popularity:")."

"; + print " + "; + + print "

"; $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 "

"; print "
@@ -1463,4 +1430,51 @@ print "

"; } + + 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 = ""; + } else { + $feed_icon = ""; + } + + $check_box = ""; + + $class = ($feedctr % 2) ? "even" : "odd"; + + print "
  • $check_box". + "$feed_icon " . $details["title"] . + " ($subscribers)
  • "; + + ++$feedctr; + } + + if ($feedctr == 0) { + print "
  • ".__('No feeds found.')."

  • "; + } + + return $feedctr; + + } ?> diff --git a/prefs.js b/prefs.js index 38dde4660..611ea6c17 100644 --- a/prefs.js +++ b/prefs.js @@ -2256,3 +2256,8 @@ function batchFeedsToggleField(cb, elem, label) { } } +function updateFeedBrowser() { + alert("FIXME"); +} + + diff --git a/tt-rss.js b/tt-rss.js index 2b6f7f822..ba7fbc64d 100644 --- a/tt-rss.js +++ b/tt-rss.js @@ -1422,3 +1422,31 @@ function addLabel() { function visitOfficialSite() { 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"); + +} diff --git a/tt-rss.php b/tt-rss.php index 5ab205e25..4ca516615 100644 --- a/tt-rss.php +++ b/tt-rss.php @@ -140,7 +140,7 @@ window.onload = init; href="javascript:toggleTags()">
    - +