]> git.wh0rd.org Git - tt-rss.git/commitdiff
tag setting rpc: use JSON
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 29 Nov 2010 11:21:28 +0000 (14:21 +0300)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 29 Nov 2010 11:21:28 +0000 (14:21 +0300)
modules/backend-rpc.php
viewfeed.js

index e027ff39d1f906179a15c2c800ca91b8abf523d1..bf475e633ea8aa0316d0d0725b22d1f3dd949109 100644 (file)
                }
 
                if ($subop == "setArticleTags") {
+                       header("Content-Type: text/plain");
 
                        global $memcache;
 
 
                        $tags_str = format_tags_string(get_article_tags($link, $id), $id);
 
-                       print "<rpc-reply>
-                               <tags-str id=\"$id\"><![CDATA[$tags_str]]></tags-str>
-                               </rpc-reply>";
+                       print json_encode(array("tags_str" => array("id" => $id,
+                               "content" => $tags_str)));
 
                        return;
                }
index 22523fa10255d0439985b0954a93cc65add3c61f..7919fe35624a13499a9988c807cec1914aa07c89 100644 (file)
@@ -1065,15 +1065,6 @@ function catchupSelection() {
 }
 
 function editArticleTags(id) {
-/*     displayDlg('editArticleTags', id,
-                          function () {
-                                       $("tags_str").focus();
-
-                                       new Ajax.Autocompleter('tags_str', 'tags_choices',
-                                          "backend.php?op=rpc&subop=completeTags",
-                                          { tokens: ',', paramName: "search" });
-                          }); */
-
                var query = "backend.php?op=dlg&id=editArticleTags&param=" + param_escape(id);
 
                if (dijit.byId("editTagsDlg"))
@@ -1095,21 +1086,19 @@ function editArticleTags(id) {
                                                notify('');
                                                dialog.hide();
        
-                                               if (transport.responseXML) {
-                                                       var tags_str = transport.responseXML.getElementsByTagName("tags-str")[0];
-                                                       
-                                                       if (tags_str) {
-                                                               var id = tags_str.getAttribute("id");
-                               
-                                                               if (id) {
-                                                                       var tags = $("ATSTR-" + id);
-                                                                       if (tags) {
-                                                                               tags.innerHTML = tags_str.firstChild.nodeValue;
-                                                                       }
-       
-                                                                       cache_invalidate(id);
-                                                               }
+                                               var data = JSON.parse(transport.responseText);
+
+                                               if (data) {
+                                                       var tags_str = data.tags_str;
+                                                       var id = tags_str.id;
+
+                                                       var tags = $("ATSTR-" + id);
+
+                                                       if (tags) {
+                                                               tags.innerHTML = tags_str.content;
                                                        }
+
+                                                       cache_invalidate(id);
                                                }
        
                                        }});