From c2913898f1f56548d457073dbaa03c77ddc6d0d9 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 24 Jan 2009 06:01:17 +0100 Subject: [PATCH] use popup feedbrowser for main UI (2) --- functions.js | 24 ++++++++++++++ modules/backend-rpc.php | 17 ++++++++++ modules/pref-feeds.php | 44 +++++++++++++++++-------- prefs.js | 22 ------------- tt-rss.js | 71 +++++++++++++++++++++++++++++++++++++++-- 5 files changed, 141 insertions(+), 37 deletions(-) diff --git a/functions.js b/functions.js index 0e9ec02a..35ca9e77 100644 --- a/functions.js +++ b/functions.js @@ -2015,3 +2015,27 @@ function labelFieldsCheck(elem) { } } + +function getSelectedFeedsFromBrowser() { + + var list = document.getElementById("browseFeedList"); + if (!list) list = document.getElementById("browseBigFeedList"); + + var selected = new Array(); + + for (i = 0; i < list.childNodes.length; i++) { + var child = list.childNodes[i]; + if (child.id && child.id.match("FBROW-")) { + var id = child.id.replace("FBROW-", ""); + + var cb = document.getElementById("FBCHK-" + id); + + if (cb.checked) { + selected.push(id); + } + } + } + + return selected; +} + diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index b26304c2..855d54aa 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -503,6 +503,23 @@ return; } + if ($subop == "feedBrowser") { + + $search = db_escape_string($_REQUEST["search"]); + $limit = db_escape_string($_REQUEST["limit"]); + + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + + return; + } + print "Unknown method: $subop"; } ?> diff --git a/modules/pref-feeds.php b/modules/pref-feeds.php index 0bdaf4e5..6c80d69a 100644 --- a/modules/pref-feeds.php +++ b/modules/pref-feeds.php @@ -64,33 +64,41 @@ print "
"; - $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 " + "; + onclick=\"javascript:updateFeedBrowser()\" value=\"".__('Search')."\"> +
"; + + print __('Top')." + "; print "

"; $owner_uid = $_SESSION["uid"]; print "

"; print "
- 0) { + sb.disabled = false; + } else { + sb.disabled = true; + } + } + + } }); + + + } catch (e) { + exception_error("updateFeedBrowser", e); + } } + function feedBrowserSubscribe() { - alert("FIXME"); + try { + + var selected = getSelectedFeedsFromBrowser(); + + if (selected.length > 0) { + closeInfoBox(); + + notify_progress("Loading, please wait...", true); + + var query = "backend.php?op=pref-feeds&subop=massSubscribe&ids="+ + param_escape(selected.toString()); + new Ajax.Request(query, { + onComplete: function(transport) { + updateFeedList(); + } }); + + } else { + alert(__("No feeds are selected.")); + } + + } catch (e) { + exception_error("feedBrowserSubscribe", e); + } } + -- 2.39.5