diff --git a/plugins/af_sort_bayes/init.js b/plugins/af_sort_bayes/init.js index a6335ef81..e6523bc4f 100644 --- a/plugins/af_sort_bayes/init.js +++ b/plugins/af_sort_bayes/init.js @@ -15,3 +15,23 @@ function bayesTrain(id, train_up) { } } +function bayesClearDatabase() { + try { + + if (confirm(__("Clear classifier database?"))) { + + var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=clearDatabase"; + + new Ajax.Request("backend.php", { + parameters: query, + onComplete: function (transport) { + notify(transport.responseText); + } + }); + } + + } catch (e) { + exception_error("showTrgmRelated", e); + } +} + diff --git a/plugins/af_sort_bayes/init.php b/plugins/af_sort_bayes/init.php index 79d287158..958127689 100644 --- a/plugins/af_sort_bayes/init.php +++ b/plugins/af_sort_bayes/init.php @@ -6,6 +6,7 @@ class Af_Sort_Bayes extends Plugin { private $filters = array(); private $dbh; private $score_modifier = 50; + private $sql_prefix = "ttrss_plugin_af_sort_bayes"; function about() { return array(1.0, @@ -71,6 +72,10 @@ class Af_Sort_Bayes extends Plugin { return file_get_contents(__DIR__ . "/init.js"); } + function get_prefs_js() { + return file_get_contents(__DIR__ . "/init.js"); + } + function hook_article_button($line) { return "sql_prefix; // TODO there probably should be a way for plugins to determine their schema version to upgrade tables @@ -163,7 +168,27 @@ class Af_Sort_Bayes extends Plugin { function hook_prefs_tab($args) { if ($args != "prefPrefs") return; - print "
Category | Probability | Word count |
---|---|---|
$v | "; + } + print "