implement showing related articles in 3panel mode when ngram stuff is enabled

This commit is contained in:
Andrew Dolgov 2012-07-09 20:24:05 +04:00
parent 2ea9bbfd07
commit d3d69daa3c
1 changed files with 26 additions and 1 deletions

View File

@ -3302,7 +3302,7 @@
</head><body>"; </head><body>";
} }
$rv['title'] = $line['title']; $title_escaped = db_escape_string($line['title']);
$rv['content'] .= "<div id=\"PTITLE-$id\" style=\"display : none\">" . $rv['content'] .= "<div id=\"PTITLE-$id\" style=\"display : none\">" .
truncate_string(strip_tags($line['title']), 15) . "</div>"; truncate_string(strip_tags($line['title']), 15) . "</div>";
@ -3434,6 +3434,31 @@
$rv['content'] .= "<div class=\"postContent\">"; $rv['content'] .= "<div class=\"postContent\">";
// N-grams
if (DB_TYPE == "pgsql" and defined('_NGRAM_TITLE_DUPLICATE_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_DUPLICATE_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/";
}
}
$article_content = sanitize($link, $line["content"], false, $owner_uid, $article_content = sanitize($link, $line["content"], false, $owner_uid,
$feed_site_url); $feed_site_url);