rpc/updateFeedBrowser: use JSON
This commit is contained in:
parent
da661d71db
commit
4a16bda3d0
18
functions.js
18
functions.js
|
@ -1417,12 +1417,6 @@ function feedBrowser() {
|
|||
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();
|
||||
}
|
||||
|
@ -1446,17 +1440,19 @@ function feedBrowser() {
|
|||
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);
|
||||
|
|
|
@ -551,25 +551,18 @@
|
|||
}
|
||||
|
||||
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"]));
|
||||
|
@ -611,12 +604,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
$num_feeds = count($subscribed);
|
||||
|
||||
print "<rpc-reply>";
|
||||
print "<num-feeds value='$num_feeds'/>";
|
||||
print "</rpc-reply>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -345,7 +345,7 @@
|
|||
$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'>
|
||||
|
|
|
@ -1362,9 +1362,10 @@
|
|||
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1436,7 +1437,7 @@
|
|||
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>
|
||||
|
@ -1479,7 +1480,7 @@
|
|||
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>";
|
||||
|
@ -1491,10 +1492,10 @@
|
|||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue