new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
-
- var nf = transport.responseXML.getElementsByTagName('num-feeds')[0];
- var nf_value = nf.getAttribute("value");
-
- notify_info(__("Subscribed to %d feed(s).").replace("%d", nf_value));
-
if (inPreferences()) {
updateFeedList();
}
Element.hide('feed_browser_spinner');
var c = $("browseFeedList");
- var r = transport.responseXML.getElementsByTagName("content")[0];
- var nr = transport.responseXML.getElementsByTagName("num-results")[0];
- var mode = transport.responseXML.getElementsByTagName("mode")[0];
+
+ var reply = JSON.parse(transport.responseText);
+
+ var r = reply['content'];
+ var mode = reply['mode'];
if (c && r) {
- c.innerHTML = r.firstChild.nodeValue;
+ c.innerHTML = r;
}
dojo.parser.parse("browseFeedList");
- if (parseInt(mode.getAttribute("value")) == 2) {
+ if (mode == 2) {
Element.show(dijit.byId('feed_archive_remove').domNode);
} else {
Element.hide(dijit.byId('feed_archive_remove').domNode);
}
if ($subop == "updateFeedBrowser") {
+ header("Content-Type: text/plain");
$search = db_escape_string($_REQUEST["search"]);
$limit = db_escape_string($_REQUEST["limit"]);
- $mode = db_escape_string($_REQUEST["mode"]);
-
- print "<rpc-reply>";
- print "<content>";
- print "<![CDATA[";
- $ctr = print_feed_browser($link, $search, $limit, $mode);
- print "]]>";
- print "</content>";
- print "<num-results value=\"$ctr\"/>";
- print "<mode value=\"$mode\"/>";
- print "</rpc-reply>";
+ $mode = (int) db_escape_string($_REQUEST["mode"]);
+ print json_encode(array("content" =>
+ make_feed_browser($link, $search, $limit, $mode),
+ "mode" => $mode));
return;
}
-
if ($subop == "massSubscribe") {
$ids = split(",", db_escape_string($_REQUEST["ids"]));
}
}
- $num_feeds = count($subscribed);
-
- print "<rpc-reply>";
- print "<num-feeds value='$num_feeds'/>";
- print "</rpc-reply>";
-
return;
}
$owner_uid = $_SESSION["uid"];
print "<ul class='browseFeedList' id='browseFeedList'>";
- print_feed_browser($link, $search, 25);
+ print make_feed_browser($link, $search, 25);
print "</ul>";
print "<div align='center'>
}
- function print_feed_browser($link, $search, $limit, $mode = 1) {
+ function make_feed_browser($link, $search, $limit, $mode = 1) {
- $owner_uid = $_SESSION["uid"];
+ $owner_uid = $_SESSION["uid"];
+ $rv = '';
if ($search) {
$search_qpart = "AND (UPPER(feed_url) LIKE UPPER('%$search%') OR
style='border-width : 0px; vertical-align : middle'
src='images/feed-icon-12x12.png'></a>";
- print "<li title=\"".htmlspecialchars($details["site_url"])."\"
+ $rv .= "<li title=\"".htmlspecialchars($details["site_url"])."\"
id=\"FBROW-".$details["id"]."\">$check_box".
"$feed_icon $feed_url " . htmlspecialchars($details["title"]) .
" <span class='subscribers'>($subscribers)</span>
style='border-width : 0px; vertical-align : middle'
src='images/feed-icon-12x12.png'></a>";
- print "<li title='".$line['site_url']."' class='$class'
+ $rv .= "<li title='".$line['site_url']."' class='$class'
id=\"FBROW-".$line["id"]."\">".
$check_box . "$feed_icon $feed_url " . $title .
$archived . $site_url . "</li>";
}
if ($feedctr == 0) {
- print "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
+ $rv .= "<li style=\"text-align : center\"><p>".__('No feeds found.')."</p></li>";
}
- return $feedctr;
+ return $rv;
}