1 |
efrain |
1 |
define(
|
|
|
2 |
[
|
|
|
3 |
'jquery',
|
|
|
4 |
'block_configurable_reports/jquery.tablesorter',
|
|
|
5 |
'block_configurable_reports/jquery.dataTables',
|
|
|
6 |
'block_configurable_reports/codemirror',
|
|
|
7 |
'block_configurable_reports/sql'
|
|
|
8 |
], function ($, tablesorter, dataTable, CodeMirror) {
|
|
|
9 |
return {
|
|
|
10 |
js_order: function (params) {
|
|
|
11 |
$(params.selector).tablesorter();
|
|
|
12 |
$(params.selector + ' th.header').css({
|
|
|
13 |
'background-image': 'url(' + params.background + ')',
|
|
|
14 |
'background-position': 'right center',
|
|
|
15 |
'background-repeat': 'no-repeat',
|
|
|
16 |
'cursor': 'pointer'
|
|
|
17 |
});
|
|
|
18 |
|
|
|
19 |
$(params.selector + ' th.headerSortUp').css({
|
|
|
20 |
'background-image': 'url(' + params.backgroundasc + ')'
|
|
|
21 |
});
|
|
|
22 |
|
|
|
23 |
$(params.selector + ' th.headerSortDown').css({
|
|
|
24 |
'background-image': 'url(' + params.backgrounddesc + ')'
|
|
|
25 |
});
|
|
|
26 |
},
|
|
|
27 |
add_jsdatatables: function (params) {
|
|
|
28 |
$(params.selector).dataTable({
|
|
|
29 |
'bAutoWidth': false,
|
|
|
30 |
'sPaginationType': 'full_numbers',
|
|
|
31 |
'fixedHeader': true,
|
|
|
32 |
'aaSorting': [],
|
|
|
33 |
'oLanguage': {
|
|
|
34 |
'oAria': {
|
|
|
35 |
'sSortAscending': M.str.block_configurable_reports.datatables_sortascending,
|
|
|
36 |
'sSortDescending': M.str.block_configurable_reports.datatables_sortdescending,
|
|
|
37 |
},
|
|
|
38 |
'oPaginate': {
|
|
|
39 |
'sFirst': M.str.block_configurable_reports.datatables_first,
|
|
|
40 |
'sLast': M.str.block_configurable_reports.datatables_last,
|
|
|
41 |
'sNext': M.str.block_configurable_reports.datatables_next,
|
|
|
42 |
'sPrevious': M.str.block_configurable_reports.datatables_previous
|
|
|
43 |
},
|
|
|
44 |
'sEmptyTable': M.str.block_configurable_reports.datatables_emptytable,
|
|
|
45 |
'sInfo': M.str.block_configurable_reports.datatables_info,
|
|
|
46 |
'sInfoEmpty': M.str.block_configurable_reports.datatables_infoempty,
|
|
|
47 |
'sInfoFiltered': M.str.block_configurable_reports.datatables_infofiltered,
|
|
|
48 |
'sInfoThousands': M.str.langconfig.thousandssep,
|
|
|
49 |
'sLengthMenu': M.str.block_configurable_reports.datatables_lengthmenu,
|
|
|
50 |
'sLoadingRecords': M.str.block_configurable_reports.datatables_loadingrecords,
|
|
|
51 |
'sProcessing': M.str.block_configurable_reports.datatables_processing,
|
|
|
52 |
'sSearch': M.str.block_configurable_reports.datatables_search,
|
|
|
53 |
'sZeroRecords': M.str.block_configurable_reports.datatables_zerorecords
|
|
|
54 |
}
|
|
|
55 |
});
|
|
|
56 |
},
|
|
|
57 |
cmirror: function() {
|
|
|
58 |
// Documentation can be found @ http://codemirror.net/
|
|
|
59 |
CodeMirror.fromTextArea(document.getElementById('id_querysql'), {
|
|
|
60 |
mode: "text/x-mysql",
|
|
|
61 |
rtlMoveVisually: true,
|
|
|
62 |
indentWithTabs: true,
|
|
|
63 |
smartIndent: true,
|
|
|
64 |
lineNumbers: true,
|
|
|
65 |
autofocus: true,
|
|
|
66 |
});
|
|
|
67 |
|
|
|
68 |
CodeMirror.fromTextArea(document.getElementById('id_remotequerysql'), {
|
|
|
69 |
mode: "text/x-mysql",
|
|
|
70 |
rtlMoveVisually: true,
|
|
|
71 |
indentWithTabs: true,
|
|
|
72 |
smartIndent: true,
|
|
|
73 |
lineNumbers: true,
|
|
|
74 |
// autofocus: true
|
|
|
75 |
});
|
|
|
76 |
}
|
|
|
77 |
};
|
|
|
78 |
});
|