]> git.wh0rd.org Git - tt-rss.git/commitdiff
rpc: move labelops to article
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 2 Apr 2013 10:56:08 +0000 (14:56 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 2 Apr 2013 10:56:08 +0000 (14:56 +0400)
classes/article.php
classes/rpc.php
js/viewfeed.js

index e75af0e7a457375cf0fef0e501d7f996dab695f1..9a0970140a81c0f8c07fd71644431bc232214f49 100644 (file)
@@ -300,5 +300,47 @@ class Article extends Handler_Protected {
                print "</ul>";
        }
 
+       function assigntolabel() {
+               return $this->labelops(true);
+       }
+
+       function removefromlabel() {
+               return $this->labelops(false);
+       }
+
+       private function labelops($assign) {
+               $reply = array();
+
+               $ids = explode(",", db_escape_string($this->link, $_REQUEST["ids"]));
+               $label_id = db_escape_string($this->link, $_REQUEST["lid"]);
+
+               $label = db_escape_string($this->link, label_find_caption($this->link, $label_id,
+               $_SESSION["uid"]));
+
+               $reply["info-for-headlines"] = array();
+
+               if ($label) {
+
+                       foreach ($ids as $id) {
+
+                               if ($assign)
+                                       label_add_article($this->link, $id, $label, $_SESSION["uid"]);
+                               else
+                                       label_remove_article($this->link, $id, $label, $_SESSION["uid"]);
+
+                               $labels = get_article_labels($this->link, $id, $_SESSION["uid"]);
+
+                               array_push($reply["info-for-headlines"],
+                               array("id" => $id, "labels" => format_article_labels($labels, $id)));
+
+                       }
+               }
+
+               $reply["message"] = "UPDATE_COUNTERS";
+
+               print json_encode($reply);
+       }
+
+
 
 }
index de52a9e8ca32143e3494d942676ece7ccbcc4d0a..a6339209583ac8189dbd29bafa6501f8b00d1d60 100644 (file)
@@ -378,47 +378,6 @@ class RPC extends Handler_Protected {
                }
        }
 
-       function assigntolabel() {
-               return $this->labelops(true);
-       }
-
-       function removefromlabel() {
-               return $this->labelops(false);
-       }
-
-       function labelops($assign) {
-               $reply = array();
-
-               $ids = explode(",", db_escape_string($this->link, $_REQUEST["ids"]));
-               $label_id = db_escape_string($this->link, $_REQUEST["lid"]);
-
-               $label = db_escape_string($this->link, label_find_caption($this->link, $label_id,
-               $_SESSION["uid"]));
-
-               $reply["info-for-headlines"] = array();
-
-               if ($label) {
-
-                       foreach ($ids as $id) {
-
-                               if ($assign)
-                                       label_add_article($this->link, $id, $label, $_SESSION["uid"]);
-                               else
-                                       label_remove_article($this->link, $id, $label, $_SESSION["uid"]);
-
-                               $labels = get_article_labels($this->link, $id, $_SESSION["uid"]);
-
-                               array_push($reply["info-for-headlines"],
-                               array("id" => $id, "labels" => format_article_labels($labels, $id)));
-
-                       }
-               }
-
-               $reply["message"] = "UPDATE_COUNTERS";
-
-               print json_encode($reply);
-       }
-
        function updateFeedBrowser() {
                $search = db_escape_string($this->link, $_REQUEST["search"]);
                $limit = db_escape_string($this->link, $_REQUEST["limit"]);
index 31eff1b8a87e89c6d8b33dcd0ec20e3a7d6b61a1..48137a1360eb8d4285c48cfd16d68789d2e9bb47 100644 (file)
@@ -678,7 +678,7 @@ function selectionRemoveLabel(id, ids) {
                        return;
                }
 
-               var query = "?op=rpc&method=removeFromLabel&ids=" +
+               var query = "?op=article&method=removeFromLabel&ids=" +
                        param_escape(ids.toString()) + "&lid=" + param_escape(id);
 
                console.log(query);
@@ -706,7 +706,7 @@ function selectionAssignLabel(id, ids) {
                        return;
                }
 
-               var query = "?op=rpc&method=assignToLabel&ids=" +
+               var query = "?op=article&method=assignToLabel&ids=" +
                        param_escape(ids.toString()) + "&lid=" + param_escape(id);
 
                console.log(query);