diff --git a/plugins/af_sort_bayes/init.js b/plugins/af_sort_bayes/init.js index 461cdc7f..bb6bf595 100644 --- a/plugins/af_sort_bayes/init.js +++ b/plugins/af_sort_bayes/init.js @@ -57,3 +57,25 @@ function bayesUpdateUI() { exception_error("showTrgmRelated", e); } } + +function bayesShow(id) { + try { + if (dijit.byId("bayesShowDlg")) + dijit.byId("bayesShowDlg").destroyRecursive(); + + var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=showArticleStats&article_id=" + param_escape(id); + + dialog = new dijit.Dialog({ + id: "bayesShowDlg", + title: __("Classifier information"), + style: "width: 600px", + href: query}); + + dialog.show(); + + } catch (e) { + exception_error("shareArticle", e); + } +} + + diff --git a/plugins/af_sort_bayes/init.php b/plugins/af_sort_bayes/init.php index 51294b46..2293ea49 100644 --- a/plugins/af_sort_bayes/init.php +++ b/plugins/af_sort_bayes/init.php @@ -122,7 +122,11 @@ class Af_Sort_Bayes extends Plugin { ""; + class='tagsPic' title='".__('-1')."'>" . + ""; } @@ -345,6 +349,60 @@ class Af_Sort_Bayes extends Plugin { $nb->updateProbabilities(); } + function showArticleStats() { + $article_id = (int) $_REQUEST["article_id"]; + + $result = $this->dbh->query("SELECT score, guid, title, content FROM ttrss_entries, ttrss_user_entries WHERE ref_id = id AND id = " . + $article_id . " AND owner_uid = " . $_SESSION["uid"]); + + if ($this->dbh->num_rows($result) != 0) { + $guid = $this->dbh->fetch_result($result, 0, "guid"); + $title = $this->dbh->fetch_result($result, 0, "title"); + $content = mb_strtolower($title . " " . strip_tags($this->dbh->fetch_result($result, 0, "content"))); + + print "
" . T_sprintf("Currently stored as: %s", $current_cat) . "
"; + + $result = $nb->categorize($content); + + print "Category | Probability |
---|---|
" . $categories[$k]["category"] . " | "; + print "" . $v . " | "; + + print "