implement ajax loading of cdm content when not in expand mode

master
Andrew Dolgov 14 years ago
parent 62b800b47c
commit dd1c068056

@ -5341,9 +5341,9 @@
title=\"".htmlspecialchars($line["feed_title"])."\"
onclick=\"viewfeed($feed_id)\">$feed_icon_img</span>";
}
print "</div>";
print "<div class=\"updPic\">$update_pic</div>";
print "</div>";
print "<input type=\"checkbox\" onclick=\"toggleSelectRowById(this,
'RROW-$id')\" class=\"feedCheckBox\" id=\"RCHK-$id\"/>";
@ -5418,14 +5418,14 @@
}
}
# if ($expand_cdm) {
if ($expand_cdm) {
$article_content = sanitize_rss($link, $line["content_preview"],
false, false, $feed_site_url);
if (!$article_content) $article_content = "&nbsp;";
# } else {
# $article_content = '';
# }
} else {
$article_content = '';
}
print "<div id=\"POSTNOTE-$id\">";
if ($line['note']) {

@ -1146,6 +1146,33 @@
return;
}
if ($subop == "cdmGetArticle") {
$id = db_escape_string($_REQUEST["id"]);
$result = db_query($link, "SELECT content,
ttrss_feeds.site_url AS site_url FROM ttrss_user_entries, ttrss_feeds,
ttrss_entries
WHERE feed_id = ttrss_feeds.id AND ref_id = '$id' AND
ttrss_entries.id = ref_id AND
ttrss_user_entries.owner_uid = ".$_SESSION["uid"]);
if (db_num_rows($result) != 0) {
$line = db_fetch_assoc($result);
$article_content = sanitize_rss($link, $line["content"],
false, false, $line['site_url']);
} else {
$article_content = '';
}
print "<rpc-reply><article id=\"$id\"><![CDATA[";
print "$article_content";
print "]]></article></rpc-reply>";
return;
}
print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
}
?>

@ -2001,8 +2001,33 @@ function cdmExpandArticle(id) {
elem = $("CICD-" + id);
if (!Element.visible(elem)) {
$("FUPDPIC-" + id).src = "images/indicator_tiny.gif";
$("CWRAP-" + id).innerHTML = "<div class=\"insensitive\">" +
__("Loading, please wait...") + "</div>";
Element.show(elem);
Element.hide("CEXC-" + id);
var query = "?op=rpc&subop=cdmGetArticle&id=" + param_escape(id);
//console.log(query);
new Ajax.Request("backend.php", {
parameters: query,
onComplete: function(transport) {
$("FUPDPIC-" + id).src = 'images/blank_icon.gif';
if (transport.responseXML) {
var article = transport.responseXML.getElementsByTagName("article")[0];
var recv_id = article.getAttribute("id");
if (recv_id == id)
$("CWRAP-" + id).innerHTML = article.firstChild.nodeValue;
} else {
$("CWRAP-" + id).innerHTML = __("Unable to load article.");
}
}});
}
var new_offset = $("RROW-" + id).offsetTop;

Loading…
Cancel
Save