diff --git a/functions.php b/functions.php index 9df02f839..2865f68e2 100644 --- a/functions.php +++ b/functions.php @@ -5341,9 +5341,9 @@ title=\"".htmlspecialchars($line["feed_title"])."\" onclick=\"viewfeed($feed_id)\">$feed_icon_img"; } - print ""; - print "
$update_pic
"; + + print ""; print ""; @@ -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 = " "; -# } else { -# $article_content = ''; -# } + } else { + $article_content = ''; + } print "
"; if ($line['note']) { diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 874f547c3..a6d495feb 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -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 "
"; + + return; + } + print "Unknown method: $subop"; } ?> diff --git a/viewfeed.js b/viewfeed.js index a5654eb45..99f6f3e4c 100644 --- a/viewfeed.js +++ b/viewfeed.js @@ -2001,8 +2001,33 @@ function cdmExpandArticle(id) { elem = $("CICD-" + id); if (!Element.visible(elem)) { + $("FUPDPIC-" + id).src = "images/indicator_tiny.gif"; + $("CWRAP-" + id).innerHTML = "
" + + __("Loading, please wait...") + "
"; 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;