2015-06-17 07:36:11 +00:00
|
|
|
function bayesTrain(id, train_up) {
|
|
|
|
try {
|
|
|
|
|
|
|
|
var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=trainArticle&article_id=" + param_escape(id) +
|
2015-06-17 19:04:32 +00:00
|
|
|
"&train_up=" + param_escape(train_up);
|
2015-06-17 07:36:11 +00:00
|
|
|
|
|
|
|
new Ajax.Request("backend.php", {
|
|
|
|
parameters: query,
|
|
|
|
onComplete: function(transport) {
|
|
|
|
notify(transport.responseText);
|
2015-06-17 19:04:32 +00:00
|
|
|
updateScore(id);
|
2015-06-17 07:36:11 +00:00
|
|
|
} });
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("showTrgmRelated", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-17 13:50:21 +00:00
|
|
|
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);
|
2015-06-17 18:40:44 +00:00
|
|
|
bayesUpdateUI();
|
2015-06-17 13:50:21 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("showTrgmRelated", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-17 18:40:44 +00:00
|
|
|
function bayesUpdateUI() {
|
|
|
|
try {
|
|
|
|
|
|
|
|
var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=renderPrefsUI";
|
|
|
|
|
|
|
|
new Ajax.Request("backend.php", {
|
|
|
|
parameters: query,
|
|
|
|
onComplete: function (transport) {
|
|
|
|
dijit.byId("af_sort_bayes_prefs").attr("content", transport.responseText);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("showTrgmRelated", e);
|
|
|
|
}
|
|
|
|
}
|