From 0fe841efb91d208b2a348b4849a652ed346357d0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 29 Nov 2010 16:22:08 +0300 Subject: rpc/digest-get-contents: use JSON --- digest.js | 9 ++++++--- modules/backend-rpc.php | 14 ++++---------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/digest.js b/digest.js index 729b66141..1b62b1418 100644 --- a/digest.js +++ b/digest.js @@ -134,9 +134,12 @@ function zoom(elem, article_id) { onComplete: function(transport) { fatal_error_check(transport); - if (transport.responseXML) { - var article = transport.responseXML.getElementsByTagName('article')[0]; - elem.innerHTML = article.firstChild.nodeValue; + var reply = JSON.parse(transport.responseText); + + if (reply) { + var article = reply['article']; + + elem.innerHTML = article.content; new Effect.BlindDown(elem, {duration : 0.5}); diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index 7c26d2ec4..fe4b6d302 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -608,24 +608,18 @@ } if ($subop == "digest-get-contents") { + header("Content-Type: text/plain"); + $article_id = db_escape_string($_REQUEST['article_id']); $result = db_query($link, "SELECT content FROM ttrss_entries, ttrss_user_entries WHERE id = '$article_id' AND ref_id = id AND owner_uid = ".$_SESSION['uid']); - print ""; - - print "
"; - - print "
"; - + print json_encode(array("article" => + array("id" => $id, "content" => $content))); return; } -- cgit v1.2.3