$reply['content'] .= "</div>";
- $reply['content'] .= "<div id=\"PTITLE-FULL-$id\" style=\"display : none\">" .
- htmlspecialchars(strip_tags($line['title'])) . "</div>";
-
$reply['content'] .= "<span id=\"RTITLE-$id\"
onclick=\"return cdmClicked(event, $id);\"
class=\"titleWrap$hlc_suffix\">
}
}
- function getlinkbyid() {
+ function getlinktitlebyid() {
$id = db_escape_string($this->link, $_REQUEST['id']);
- $result = db_query($this->link, "SELECT link FROM ttrss_entries, ttrss_user_entries
+ $result = db_query($this->link, "SELECT link, title 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");
+ $title = db_fetch_result($result, 0, "title");
- echo json_encode(array("link" => $link));
+ echo json_encode(array("link" => $link, "title" => $title));
} else {
echo json_encode(array("error" => "ARTICLE_NOT_FOUND"));
}
</head><body>";
}
- $title_escaped = htmlspecialchars($line['title']);
-
- $rv['content'] .= "<div id=\"PTITLE-FULL-$id\" style=\"display : none\">" .
- strip_tags($line['title']) . "</div>";
-
$rv['content'] .= "<div class=\"postReply\" id=\"POST-$id\">";
$rv['content'] .= "<div class=\"postHeader\" id=\"POSTHDR-$id\">";
$rv['content'] .= "<div class=\"postContent\">";
- // N-grams
-
- if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_RELATED_THRESHOLD')) {
-
- $ngram_result = db_query($link, "SELECT id,title FROM
- ttrss_entries,ttrss_user_entries
- WHERE ref_id = id AND updated >= NOW() - INTERVAL '7 day'
- AND similarity(title, '$title_escaped') >= "._NGRAM_TITLE_RELATED_THRESHOLD."
- AND title != '$title_escaped'
- AND owner_uid = $owner_uid");
-
- if (db_num_rows($ngram_result) > 0) {
- $rv['content'] .= "<div dojoType=\"dijit.form.DropDownButton\">".
- "<span>" . __('Related')."</span>";
- $rv['content'] .= "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
-
- while ($nline = db_fetch_assoc($ngram_result)) {
- $rv['content'] .= "<div onclick=\"hlOpenInNewTab(null,".$nline['id'].")\"
- dojoType=\"dijit.MenuItem\">".$nline['title']."</div>";
-
- }
- $rv['content'] .= "</div></div><br/";
- }
- }
-
$rv['content'] .= $line["content"];
$rv['content'] .= format_article_enclosures($link, $id,
var lh = dojo.connect(dialog, "onLoad", function(){
dojo.disconnect(lh);
- var title = $("PTITLE-FULL-" + getActiveArticleId());
+ var query = "op=rpc&method=getlinktitlebyid&id=" + getActiveArticleId();
- if (title || getActiveFeedId() || activeFeedIsCat()) {
- if (title) title = title.innerHTML;
+ new Ajax.Request("backend.php", {
+ parameters: query,
+ onComplete: function(transport) {
+ var reply = JSON.parse(transport.responseText);
- console.log(title + " " + getActiveFeedId());
+ var title = false;
- var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
- getActiveFeedId();
+ if (reply && reply) title = reply.title;
- var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 };
+ if (title || getActiveFeedId() || activeFeedIsCat()) {
+
+ console.log(title + " " + getActiveFeedId());
+
+ var feed_id = activeFeedIsCat() ? 'CAT:' + parseInt(getActiveFeedId()) :
+ getActiveFeedId();
+
+ var rule = { reg_exp: title, feed_id: feed_id, filter_type: 1 };
+
+ addFilterRule(null, dojo.toJson(rule));
+ }
+
+ } });
- addFilterRule(null, dojo.toJson(rule));
- }
});
}
function displayArticleUrl(id) {
try {
- var query = "op=rpc&method=getlinkbyid&id=" + param_escape(id);
+ var query = "op=rpc&method=getlinktitlebyid&id=" + param_escape(id);
new Ajax.Request("backend.php", {
parameters: query,