2015-06-18 14:57:17 +02:00
|
|
|
function bayesTrain(id, train_up, event) {
|
2015-06-17 09:36:11 +02:00
|
|
|
try {
|
|
|
|
|
2015-06-18 14:57:17 +02:00
|
|
|
event.stopPropagation();
|
|
|
|
|
2015-06-17 09:36:11 +02:00
|
|
|
var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=trainArticle&article_id=" + param_escape(id) +
|
2015-06-17 21:04:32 +02:00
|
|
|
"&train_up=" + param_escape(train_up);
|
2015-06-17 09:36:11 +02:00
|
|
|
|
2015-06-18 14:58:09 +02:00
|
|
|
notify_progress("Loading, please wait...");
|
|
|
|
|
2015-06-17 09:36:11 +02:00
|
|
|
new Ajax.Request("backend.php", {
|
|
|
|
parameters: query,
|
|
|
|
onComplete: function(transport) {
|
|
|
|
notify(transport.responseText);
|
2015-06-17 21:04:32 +02:00
|
|
|
updateScore(id);
|
2015-06-17 09:36:11 +02:00
|
|
|
} });
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("showTrgmRelated", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-17 15:50:21 +02: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 20:40:44 +02:00
|
|
|
bayesUpdateUI();
|
2015-06-17 15:50:21 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
exception_error("showTrgmRelated", e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-17 20:40:44 +02: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);
|
|
|
|
}
|
|
|
|
}
|
2015-06-18 17:30:05 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|