]> git.wh0rd.org - tt-rss.git/commitdiff
add headline menu entry to show article url
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 21 Mar 2013 19:29:06 +0000 (23:29 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 21 Mar 2013 19:29:06 +0000 (23:29 +0400)
classes/rpc.php
js/viewfeed.js

index 139f1fe49e0012503710f65dad3ffddefcf4a881..8144f6b978047219f61640375e998715036e6647 100644 (file)
@@ -829,5 +829,20 @@ class RPC extends Handler_Protected {
                }
        }
 
+       function getlinkbyid() {
+               $id = db_escape_string($_REQUEST['id']);
+
+               $result = db_query($this->link, "SELECT link FROM ttrss_entries, ttrss_user_entries
+                       WHERE ref_id = '$id' AND ref_id = id AND owner_uid = ". $_SESSION["uid"]);
+
+               if (db_num_rows($result) != 0) {
+                       $link = db_fetch_result($result, 0, "link");
+
+                       echo json_encode(array("link" => $link));
+               } else {
+                       echo json_encode(array("error" => "ARTICLE_NOT_FOUND"));
+               }
+       }
+
 }
 ?>
index 5567c717a6144ed45cdfeb93c43f4ec0332a8a2b..35c9c12a7e6ea420f825affd9b78effa303569d2 100644 (file)
@@ -1824,6 +1824,12 @@ function initHeadlinesMenu() {
                                openArticleInNewWindow(this.getParent().callerRowId);
                        }}));
 
+               menu.addChild(new dijit.MenuItem({
+                       label: __("Display article URL"),
+                       onClick: function(event) {
+                               displayArticleUrl(this.getParent().callerRowId);
+                       }}));
+
                menu.addChild(new dijit.MenuSeparator());
 
                menu.addChild(new dijit.MenuItem({
@@ -2035,3 +2041,21 @@ function changeScore(id, pic) {
                exception_error("changeScore", e);
        }
 }
+
+function displayArticleUrl(id) {
+       try {
+               var query = "op=rpc&method=getlinkbyid&id=" + param_escape(id);
+
+                       new Ajax.Request("backend.php", {
+                               parameters: query,
+                               onComplete: function(transport) {
+                                       var reply = JSON.parse(transport.responseText);
+
+                                       if (reply && reply.link) {
+                                               prompt(__("Article URL:"), reply.link);
+                                       }
+                               } });
+       } catch (e) {
+               exception_error("changeScore", e);
+       }
+}