]>
Commit | Line | Data |
---|---|---|
5b0cb9aa | 1 | function bayesTrain(id, train_up, event) { |
853cc128 AD |
2 | try { |
3 | ||
5b0cb9aa AD |
4 | event.stopPropagation(); |
5 | ||
853cc128 | 6 | var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=trainArticle&article_id=" + param_escape(id) + |
a72cd54c | 7 | "&train_up=" + param_escape(train_up); |
853cc128 | 8 | |
0f037312 AD |
9 | notify_progress("Loading, please wait..."); |
10 | ||
853cc128 AD |
11 | new Ajax.Request("backend.php", { |
12 | parameters: query, | |
13 | onComplete: function(transport) { | |
14 | notify(transport.responseText); | |
a72cd54c | 15 | updateScore(id); |
853cc128 AD |
16 | } }); |
17 | ||
18 | } catch (e) { | |
19 | exception_error("showTrgmRelated", e); | |
20 | } | |
21 | } | |
22 | ||
3c43def9 AD |
23 | function bayesClearDatabase() { |
24 | try { | |
25 | ||
26 | if (confirm(__("Clear classifier database?"))) { | |
27 | ||
28 | var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=clearDatabase"; | |
29 | ||
30 | new Ajax.Request("backend.php", { | |
31 | parameters: query, | |
32 | onComplete: function (transport) { | |
33 | notify(transport.responseText); | |
308c55c0 | 34 | bayesUpdateUI(); |
3c43def9 AD |
35 | } |
36 | }); | |
37 | } | |
38 | ||
39 | } catch (e) { | |
40 | exception_error("showTrgmRelated", e); | |
41 | } | |
42 | } | |
43 | ||
308c55c0 AD |
44 | function bayesUpdateUI() { |
45 | try { | |
46 | ||
47 | var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=renderPrefsUI"; | |
48 | ||
49 | new Ajax.Request("backend.php", { | |
50 | parameters: query, | |
51 | onComplete: function (transport) { | |
52 | dijit.byId("af_sort_bayes_prefs").attr("content", transport.responseText); | |
53 | } | |
54 | }); | |
55 | ||
56 | } catch (e) { | |
57 | exception_error("showTrgmRelated", e); | |
58 | } | |
59 | } | |
168e32b9 AD |
60 | |
61 | function bayesShow(id) { | |
62 | try { | |
63 | if (dijit.byId("bayesShowDlg")) | |
64 | dijit.byId("bayesShowDlg").destroyRecursive(); | |
65 | ||
66 | var query = "backend.php?op=pluginhandler&plugin=af_sort_bayes&method=showArticleStats&article_id=" + param_escape(id); | |
67 | ||
68 | dialog = new dijit.Dialog({ | |
69 | id: "bayesShowDlg", | |
70 | title: __("Classifier information"), | |
71 | style: "width: 600px", | |
72 | href: query}); | |
73 | ||
74 | dialog.show(); | |
75 | ||
76 | } catch (e) { | |
77 | exception_error("shareArticle", e); | |
78 | } | |
79 | } | |
80 | ||
81 |