Debian Codegraph @

src/web/www/js/res_filt_dlg.js

raw symbols SCIP
1 function res_filt_dlg_show(cb_func, col_name) {
2 var qpanel = document['dlg_res_filt_p'];
3 qpanel['cb_func'] = cb_func;
4
5 var bnode = qpanel.bodyNode;
6
7 var qtype_node = bnode.one('#qtype');
8 qtype_node.set('value', col_name);
9
10 var sym_node = bnode.one('#symbol')
11 sym_node.set('value', '');
12
13 var arr = ['regex', 'negate', 'ignorecase'];
14 for (var inx = 0; inx < arr.length; inx++) {
15 var node = bnode.one('#' + arr[inx])
16 node.set('checked', false);
17 }
18
19 sym_node.select();
20 qpanel.show();
21 sym_node.focus();
22 }
23
24 YUI().use("panel", function (Y) {
25
26 var qtype = '<select id="qtype">' +
27 '<option value="tag"> Tag </option>' +
28 '<option value="file"> File </option>' +
29 '<option value="line"> Line </option>' +
30 '<option value="text"> Text </option>' +
31 '</select>';
32 var body = '<table>' +
33 '<tr> <td>Filter in </td> <td>' + qtype + '</td> </tr>' +
34 '<tr> <td>Filter for</td> <td><input type="text" id="symbol"></td> </tr>' +
35 '<tr> <td></td> <td><input type="checkbox" id="regex">Regex</td> </tr>' +
36 '<tr> <td></td> <td><input type="checkbox" id="negate">Negate search</td> </tr>' +
37 '<tr> <td></td> <td><input type="checkbox" id="ignorecase">Case Insensitive</td> </tr>' +
38 '</table>';
39
40 function okAction(e) {
41 e.preventDefault();
42 qpanel.hide();
43 var bnode = qpanel.bodyNode;
44
45 var qtype = bnode.one('#qtype').get('value');
46 if (!qtype) {
47 return;
48 }
49
50 var symbol = bnode.one('#symbol').get('value');
51 if (!symbol) {
52 return;
53 }
54
55 var opt = [];
56 var arr = ['regex', 'negate', 'ignorecase'];
57 for (var inx = 0; inx < arr.length; inx++) {
58 if (bnode.one('#' + arr[inx]).get('checked')) {
59 opt.push(arr[inx]);
60 }
61 }
62
63 var col_name = bnode.one('#qtype').get('value');
64
65 var cb_func = qpanel['cb_func'];
66 var q_args = {
67 qtype : qtype,
68 symbol : symbol,
69 opt : opt,
70 col_name : col_name,
71 };
72 if (!cb_func) {
73 return;
74 }
75 cb_func(q_args);
76 }
77
78 var qpanel = new Y.Panel({
79 bodyContent: body,
80 // width : 250,
81 zIndex : 6,
82 centered : true,
83 modal : true,
84 render : '#resFiltPanel',
85 buttons: [
86 {
87 value : 'Cancel',
88 section: Y.WidgetStdMod.FOOTER,
89 action : function (e) {
90 e.preventDefault();
91 qpanel.hide();
92 }
93 },
94 {
95 value : 'Ok',
96 section: Y.WidgetStdMod.FOOTER,
97 action : okAction,
98 }
99 ]
100 });
101
102 qpanel.bodyNode.on('key', okAction, 'enter');
103
104 qpanel.hide();
105
106 document['dlg_res_filt_y'] = Y;
107 document['dlg_res_filt_p'] = qpanel;
108 });