|
Lines 1776-1781
Link Here
|
| 1776 |
[% Asset.js( "js/mana.js" ) | $raw %] |
1776 |
[% Asset.js( "js/mana.js" ) | $raw %] |
| 1777 |
[% Asset.js( "js/throttledButton.js" ) | $raw %] |
1777 |
[% Asset.js( "js/throttledButton.js" ) | $raw %] |
| 1778 |
[% INCLUDE 'select2.inc' %] |
1778 |
[% INCLUDE 'select2.inc' %] |
|
|
1779 |
<script> |
| 1780 |
let op = ""; |
| 1781 |
[% IF create %] |
| 1782 |
op = "create"; |
| 1783 |
[% ELSIF editsql %] |
| 1784 |
op = "editsql"; |
| 1785 |
[% ELSIF save %] |
| 1786 |
op = "save"; |
| 1787 |
[% ELSIF showsql %] |
| 1788 |
op = "showsql"; |
| 1789 |
[% ELSIF showreport %] |
| 1790 |
op = "showreport"; |
| 1791 |
[% END %] |
| 1792 |
|
| 1793 |
let saved1 = [% saved1 ? 1 : 0 | html %]; |
| 1794 |
const interface = "[% interface | html %]"; |
| 1795 |
const theme = "[% theme | html %]"; |
| 1796 |
const has_errors = [% errors ? 1 : 0 | html %]; |
| 1797 |
const original_results = [% results.json || '[]'| $raw %]; |
| 1798 |
const all_results = [% allresults.json || '[]' | $raw %]; |
| 1799 |
const header_row = [% header_row.json || '[]' | $raw %]; |
| 1800 |
const unlimited_total = [% unlimited_total || 0 | $raw %]; |
| 1801 |
|
| 1802 |
var group_subgroups = {}; |
| 1803 |
[% FOREACH group IN groups_with_subgroups %] |
| 1804 |
var gid = "[% group.id | html %]" |
| 1805 |
group_subgroups[gid] = new Array(); |
| 1806 |
[% FOREACH subgroup IN group.subgroups %] |
| 1807 |
var sgid = "[% subgroup.id | html %]"; |
| 1808 |
var sgname = "[% subgroup.name | html %]"; |
| 1809 |
group_subgroups[gid].push([sgid, sgname]); |
| 1810 |
[% END %] |
| 1811 |
[% END %] |
| 1812 |
|
| 1813 |
var table_settings = [% TablesSettings.GetTableSettings( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %]; |
| 1814 |
|
| 1815 |
const tables = [% To.json(tables || []) | $raw %]; |
| 1816 |
</script> |
| 1817 |
|
| 1779 |
<script> |
1818 |
<script> |
| 1780 |
// if the report param form has multiselects override default form submission |
1819 |
// if the report param form has multiselects override default form submission |
| 1781 |
if( $('#report_param_form').find('select[multiple]').length ) { |
1820 |
if( $('#report_param_form').find('select[multiple]').length ) { |
|
Lines 1825-1842
Link Here
|
| 1825 |
} |
1864 |
} |
| 1826 |
|
1865 |
|
| 1827 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); |
1866 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); |
| 1828 |
var group_subgroups = {}; |
|
|
| 1829 |
[% FOREACH group IN groups_with_subgroups %] |
| 1830 |
var gid = "[% group.id | html %]" |
| 1831 |
group_subgroups[gid] = new Array(); |
| 1832 |
[% FOREACH subgroup IN group.subgroups %] |
| 1833 |
var sgid = "[% subgroup.id | html %]"; |
| 1834 |
var sgname = "[% subgroup.name | html %]"; |
| 1835 |
group_subgroups[gid].push([sgid, sgname]); |
| 1836 |
[% END %] |
| 1837 |
[% END %] |
| 1838 |
|
1867 |
|
| 1839 |
[% IF ( create || editsql || save ) %] |
1868 |
if (op == "create" || op == "editsql" || op == "save" ) { |
| 1840 |
|
1869 |
|
| 1841 |
var editor = CodeMirror.fromTextArea(sql, { |
1870 |
var editor = CodeMirror.fromTextArea(sql, { |
| 1842 |
lineNumbers: true, |
1871 |
lineNumbers: true, |
|
Lines 1849-1855
Link Here
|
| 1849 |
}, |
1878 |
}, |
| 1850 |
hint: CodeMirror.hint.sql, |
1879 |
hint: CodeMirror.hint.sql, |
| 1851 |
hintOptions: { |
1880 |
hintOptions: { |
| 1852 |
tables: [% To.json(tables) | $raw %] |
1881 |
tables |
| 1853 |
} |
1882 |
} |
| 1854 |
}); |
1883 |
}); |
| 1855 |
var ExcludedTriggerKeys = { //key-code combinations of keys that will not fire the auto-complete script |
1884 |
var ExcludedTriggerKeys = { //key-code combinations of keys that will not fire the auto-complete script |
|
Lines 1925-1933
Link Here
|
| 1925 |
validator.resetForm();//remove error class on name elements and clear history |
1954 |
validator.resetForm();//remove error class on name elements and clear history |
| 1926 |
validator.reset();//remove all error and success data |
1955 |
validator.reset();//remove all error and success data |
| 1927 |
} |
1956 |
} |
| 1928 |
[% END %] |
1957 |
} |
| 1929 |
|
1958 |
|
| 1930 |
[% IF ( showsql || showreport ) %] |
1959 |
if (op == "showsql" || op == "showreport") { |
| 1931 |
|
1960 |
|
| 1932 |
var editor = CodeMirror.fromTextArea(sql, { |
1961 |
var editor = CodeMirror.fromTextArea(sql, { |
| 1933 |
lineNumbers: false, |
1962 |
lineNumbers: false, |
|
Lines 1939-1945
Link Here
|
| 1939 |
"<<(.*?)>>":"style1" |
1968 |
"<<(.*?)>>":"style1" |
| 1940 |
}, |
1969 |
}, |
| 1941 |
}); |
1970 |
}); |
| 1942 |
[% END %] |
1971 |
} |
| 1943 |
|
1972 |
|
| 1944 |
function showParamModal( category ){ |
1973 |
function showParamModal( category ){ |
| 1945 |
var modal = $("#runtime_parameters"); |
1974 |
var modal = $("#runtime_parameters"); |
|
Lines 2050-2056
Link Here
|
| 2050 |
} |
2079 |
} |
| 2051 |
|
2080 |
|
| 2052 |
$("body").on('click',".fetch_chart_data",function(){ |
2081 |
$("body").on('click',".fetch_chart_data",function(){ |
| 2053 |
if( [% unlimited_total || 0 | $raw %] > 1000 ){ |
2082 |
if( unlimited_total > 1000 ){ |
| 2054 |
if( confirm( _("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?") ) ){ |
2083 |
if( confirm( _("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?") ) ){ |
| 2055 |
return true; |
2084 |
return true; |
| 2056 |
} else { |
2085 |
} else { |
|
Lines 2089-2095
Link Here
|
| 2089 |
$('#download-chart').hide(); |
2118 |
$('#download-chart').hide(); |
| 2090 |
var chart; |
2119 |
var chart; |
| 2091 |
|
2120 |
|
| 2092 |
[% IF results && !errors %] |
2121 |
if ( original_results && !has_errors ) { |
| 2093 |
$('#draw-chart').click(function() { |
2122 |
$('#draw-chart').click(function() { |
| 2094 |
|
2123 |
|
| 2095 |
var x_elements = $('select[name="x"]').val(); |
2124 |
var x_elements = $('select[name="x"]').val(); |
|
Lines 2098-2116
Link Here
|
| 2098 |
var lines = []; |
2127 |
var lines = []; |
| 2099 |
var options = {}; |
2128 |
var options = {}; |
| 2100 |
|
2129 |
|
| 2101 |
headers = [% header_row.json | $raw %]; |
2130 |
headers = header_row; |
| 2102 |
|
2131 |
|
| 2103 |
var results; |
2132 |
var results; |
| 2104 |
[% IF allresults.size %] |
2133 |
if (all_results.length){ |
| 2105 |
if ($('input[name="chart-include-all"]').prop('checked')) { |
2134 |
if ($('input[name="chart-include-all"]').prop('checked')) { |
| 2106 |
results = [% allresults.json | $raw %] |
2135 |
results = all_results; |
| 2107 |
} |
2136 |
} |
| 2108 |
else { |
2137 |
else { |
| 2109 |
results = [% results.json | $raw %] |
2138 |
results = original_results; |
| 2110 |
} |
2139 |
} |
| 2111 |
[% ELSE %] |
2140 |
} else { |
| 2112 |
results = [% results.json | $raw %]; |
2141 |
results = original_results; |
| 2113 |
[% END %] |
2142 |
} |
| 2114 |
|
2143 |
|
| 2115 |
if ($('input[name="chart-exclude-last"]').prop('checked')) { |
2144 |
if ($('input[name="chart-exclude-last"]').prop('checked')) { |
| 2116 |
results.splice(-1, 1); |
2145 |
results.splice(-1, 1); |
|
Lines 2163-2172
Link Here
|
| 2163 |
$("#toggle_chart_settings_vis").hide(); |
2192 |
$("#toggle_chart_settings_vis").hide(); |
| 2164 |
$("#chartModal").modal("hide"); |
2193 |
$("#chartModal").modal("hide"); |
| 2165 |
}); |
2194 |
}); |
| 2166 |
[% END %] |
2195 |
} |
| 2167 |
[% IF ( create ) %] |
2196 |
if (op == "create"){ |
| 2168 |
load_group_subgroups(); |
2197 |
load_group_subgroups(); |
| 2169 |
[% END %] |
2198 |
} |
| 2170 |
|
2199 |
|
| 2171 |
$('#limit').change(function() { |
2200 |
$('#limit').change(function() { |
| 2172 |
$('#limitselect').submit(); |
2201 |
$('#limitselect').submit(); |
|
Lines 2215-2222
Link Here
|
| 2215 |
delColumn(); |
2244 |
delColumn(); |
| 2216 |
}); |
2245 |
}); |
| 2217 |
|
2246 |
|
| 2218 |
[% IF (saved1) %] |
2247 |
if (saved1){ |
| 2219 |
var table_settings = [% TablesSettings.GetTableSettings( 'reports', 'saved-sql', 'table_reports', 'json' ) | $raw %]; |
|
|
| 2220 |
var rtable = $("#table_reports").kohaTable( |
2248 |
var rtable = $("#table_reports").kohaTable( |
| 2221 |
{ |
2249 |
{ |
| 2222 |
autoWidth: false, |
2250 |
autoWidth: false, |
|
Lines 2281-2295
Link Here
|
| 2281 |
|
2309 |
|
| 2282 |
$("#update_sql").on("hidden.bs.modal", function(){ |
2310 |
$("#update_sql").on("hidden.bs.modal", function(){ |
| 2283 |
$("#update_sql_label").html(""); |
2311 |
$("#update_sql_label").html(""); |
| 2284 |
$("#update_sql .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
2312 |
$("#update_sql .modal-body").html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>"); |
| 2285 |
}); |
2313 |
}); |
| 2286 |
[% END %] |
2314 |
} |
| 2287 |
|
2315 |
|
| 2288 |
[% IF ( showsql ) %] |
2316 |
if (op == "showsql"){ |
| 2289 |
$("#sql").focus(function() { |
2317 |
$("#sql").focus(function() { |
| 2290 |
$(this).select(); |
2318 |
$(this).select(); |
| 2291 |
}); |
2319 |
}); |
| 2292 |
[% END %] |
2320 |
} |
| 2293 |
|
2321 |
|
| 2294 |
$("#toggle_sql").click(function(){ |
2322 |
$("#toggle_sql").click(function(){ |
| 2295 |
var sql_output = $("#sql_output"); |
2323 |
var sql_output = $("#sql_output"); |
|
Lines 2313-2319
Link Here
|
| 2313 |
$("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle(); |
2341 |
$("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle(); |
| 2314 |
}); |
2342 |
}); |
| 2315 |
|
2343 |
|
| 2316 |
[% IF (create || editsql || save) %] |
2344 |
if (op == "create" || op == "editsql" || op == "save"){ |
| 2317 |
|
2345 |
|
| 2318 |
var validated_form = $("#sql_report_form").validate({ |
2346 |
var validated_form = $("#sql_report_form").validate({ |
| 2319 |
reportname: "required", |
2347 |
reportname: "required", |
|
Lines 2458-2464
Link Here
|
| 2458 |
$("#param_category").val( $(this).val() ); |
2486 |
$("#param_category").val( $(this).val() ); |
| 2459 |
}); |
2487 |
}); |
| 2460 |
|
2488 |
|
| 2461 |
[% END %] |
2489 |
} |
| 2462 |
|
2490 |
|
| 2463 |
$("#mana_search_form").submit(function(e){ |
2491 |
$("#mana_search_form").submit(function(e){ |
| 2464 |
e.preventDefault(); |
2492 |
e.preventDefault(); |
| 2465 |
- |
|
|