|
Lines 1808-2042
Link Here
|
| 1808 |
|
1808 |
|
| 1809 |
const tables = [% To.json(tables || []) | $raw %]; |
1809 |
const tables = [% To.json(tables || []) | $raw %]; |
| 1810 |
</script> |
1810 |
</script> |
| 1811 |
|
|
|
| 1812 |
<script> |
1811 |
<script> |
| 1813 |
// if the report param form has multiselects override default form submission |
1812 |
// if the report param form has multiselects override default form submission |
| 1814 |
if( $('#report_param_form').find('select[multiple]').length ) { |
1813 |
if ($("#report_param_form").find("select[multiple]").length) { |
| 1815 |
$('#report_param_form').on('submit', function(e) { |
1814 |
$("#report_param_form").on("submit", function (e) { |
| 1816 |
$('#report_param_form').find('select[multiple]').each( function (i) { |
1815 |
$("#report_param_form") |
| 1817 |
$(this).find('option:first').prop('disabled', false); |
1816 |
.find("select[multiple]") |
| 1818 |
var selection; |
1817 |
.each(function (i) { |
| 1819 |
if( $(this).find('option:selected').length === 0 ) { |
1818 |
$(this).find("option:first").prop("disabled", false); |
| 1820 |
selection = $(this).find('option:first').val(); |
1819 |
var selection; |
| 1821 |
$(this).val(selection); |
1820 |
if ($(this).find("option:selected").length === 0) { |
| 1822 |
} else if( $(this).find('option:selected').length > 1 ) { |
1821 |
selection = $(this).find("option:first").val(); |
| 1823 |
selection = $(this).val().join('\n'); |
1822 |
$(this).val(selection); |
| 1824 |
$(this).find('option:selected').prop('selected', false); |
1823 |
} else if ($(this).find("option:selected").length > 1) { |
| 1825 |
$(this).find('option:first').val(selection); |
1824 |
selection = $(this).val().join("\n"); |
| 1826 |
$(this).find('option:first').prop('selected', 'selected'); |
1825 |
$(this).find("option:selected").prop("selected", false); |
| 1827 |
} |
1826 |
$(this).find("option:first").val(selection); |
| 1828 |
}); |
1827 |
$(this).find("option:first").prop("selected", "selected"); |
|
|
1828 |
} |
| 1829 |
}); |
| 1829 |
}); |
1830 |
}); |
| 1830 |
} |
1831 |
} |
| 1831 |
|
1832 |
|
| 1832 |
function hide_bar_element() { |
1833 |
function hide_bar_element() { |
| 1833 |
$('#chart-column-horizontal').hide() |
1834 |
$("#chart-column-horizontal").hide(); |
| 1834 |
$('.chart-column-group').each(function( index ) { |
1835 |
$(".chart-column-group").each(function (index) { |
| 1835 |
$( this ).hide(); |
1836 |
$(this).hide(); |
| 1836 |
}); |
1837 |
}); |
| 1837 |
$('.chart-column-line').each(function( index ) { |
1838 |
$(".chart-column-line").each(function (index) { |
| 1838 |
$( this ).hide() |
1839 |
$(this).hide(); |
| 1839 |
}); |
1840 |
}); |
| 1840 |
} |
1841 |
} |
| 1841 |
|
1842 |
|
| 1842 |
function show_bar_element() { |
1843 |
function show_bar_element() { |
| 1843 |
$('#chart-column-horizontal').show() |
1844 |
$("#chart-column-horizontal").show(); |
| 1844 |
$('.chart-column-group').each(function( index ) { |
1845 |
$(".chart-column-group").each(function (index) { |
| 1845 |
$( this ).show() |
1846 |
$(this).show(); |
| 1846 |
}); |
1847 |
}); |
| 1847 |
$('.chart-column-line').each(function( index ) { |
1848 |
$(".chart-column-line").each(function (index) { |
| 1848 |
$( this ).show() |
1849 |
$(this).show(); |
| 1849 |
}); |
1850 |
}); |
| 1850 |
} |
1851 |
} |
| 1851 |
|
1852 |
|
| 1852 |
function removeColumn(id) { |
1853 |
function removeColumn(id) { |
| 1853 |
$('#'+id).remove(); |
1854 |
$("#" + id).remove(); |
| 1854 |
|
1855 |
|
| 1855 |
if ( $('.chart-column-conf').length == 1 ) { |
1856 |
if ($(".chart-column-conf").length == 1) { |
| 1856 |
$('.chart-column-delete').remove(); |
1857 |
$(".chart-column-delete").remove(); |
| 1857 |
} |
1858 |
} |
| 1858 |
} |
1859 |
} |
| 1859 |
|
1860 |
|
| 1860 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); |
1861 |
var MSG_CONFIRM_DELETE = _("Are you sure you want to delete this report? This cannot be undone."); |
| 1861 |
|
1862 |
|
| 1862 |
if (op == "create" || op == "editsql" || op == "save" ) { |
1863 |
if (op == "create" || op == "editsql" || op == "save") { |
| 1863 |
|
|
|
| 1864 |
var editor = CodeMirror.fromTextArea(sql, { |
1864 |
var editor = CodeMirror.fromTextArea(sql, { |
| 1865 |
lineNumbers: true, |
1865 |
lineNumbers: true, |
| 1866 |
mode: "text/x-sql", |
1866 |
mode: "text/x-sql", |
| 1867 |
lineWrapping: true, |
1867 |
lineWrapping: true, |
| 1868 |
smartIndent: false, |
1868 |
smartIndent: false, |
| 1869 |
keyword: { // Custom highlighting for items bounded in [[ ]] or << >>. |
1869 |
keyword: { |
| 1870 |
"\\[\\[(.*?)\\]\\]":"style1", |
1870 |
// Custom highlighting for items bounded in [[ ]] or << >>. |
| 1871 |
"<<(.*?)>>":"style1" |
1871 |
"\\[\\[(.*?)\\]\\]": "style1", |
|
|
1872 |
"<<(.*?)>>": "style1", |
| 1872 |
}, |
1873 |
}, |
| 1873 |
hint: CodeMirror.hint.sql, |
1874 |
hint: CodeMirror.hint.sql, |
| 1874 |
hintOptions: { |
1875 |
hintOptions: { |
| 1875 |
tables |
1876 |
tables, |
| 1876 |
} |
1877 |
}, |
| 1877 |
}); |
1878 |
}); |
| 1878 |
var ExcludedTriggerKeys = { //key-code combinations of keys that will not fire the auto-complete script |
1879 |
var ExcludedTriggerKeys = { |
| 1879 |
"8": "backspace", |
1880 |
//key-code combinations of keys that will not fire the auto-complete script |
| 1880 |
"9": "tab", |
1881 |
8: "backspace", |
| 1881 |
"13": "enter", |
1882 |
9: "tab", |
| 1882 |
"16": "shift", |
1883 |
13: "enter", |
| 1883 |
"17": "ctrl", |
1884 |
16: "shift", |
| 1884 |
"18": "alt", |
1885 |
17: "ctrl", |
| 1885 |
"19": "pause", |
1886 |
18: "alt", |
| 1886 |
"20": "capslock", |
1887 |
19: "pause", |
| 1887 |
"27": "escape", |
1888 |
20: "capslock", |
| 1888 |
"33": "pageup", |
1889 |
27: "escape", |
| 1889 |
"32": "spacebar", |
1890 |
33: "pageup", |
| 1890 |
"34": "pagedown", |
1891 |
32: "spacebar", |
| 1891 |
"35": "end", |
1892 |
34: "pagedown", |
| 1892 |
"36": "home", |
1893 |
35: "end", |
| 1893 |
"37": "left", |
1894 |
36: "home", |
| 1894 |
"38": "up", |
1895 |
37: "left", |
| 1895 |
"39": "right", |
1896 |
38: "up", |
| 1896 |
"40": "down", |
1897 |
39: "right", |
| 1897 |
"45": "insert", |
1898 |
40: "down", |
| 1898 |
"46": "delete", |
1899 |
45: "insert", |
| 1899 |
"56": "asterisk", |
1900 |
46: "delete", |
| 1900 |
"59": "semicolon", |
1901 |
56: "asterisk", |
| 1901 |
"91": "left window key", |
1902 |
59: "semicolon", |
| 1902 |
"92": "right window key", |
1903 |
91: "left window key", |
| 1903 |
"93": "select", |
1904 |
92: "right window key", |
| 1904 |
"106": "asterisk", |
1905 |
93: "select", |
| 1905 |
"107": "add", |
1906 |
106: "asterisk", |
| 1906 |
"109": "subtract", |
1907 |
107: "add", |
| 1907 |
"110": "decimal point", |
1908 |
109: "subtract", |
| 1908 |
"111": "divide", |
1909 |
110: "decimal point", |
| 1909 |
"112": "f1", |
1910 |
111: "divide", |
| 1910 |
"113": "f2", |
1911 |
112: "f1", |
| 1911 |
"114": "f3", |
1912 |
113: "f2", |
| 1912 |
"115": "f4", |
1913 |
114: "f3", |
| 1913 |
"116": "f5", |
1914 |
115: "f4", |
| 1914 |
"117": "f6", |
1915 |
116: "f5", |
| 1915 |
"118": "f7", |
1916 |
117: "f6", |
| 1916 |
"119": "f8", |
1917 |
118: "f7", |
| 1917 |
"120": "f9", |
1918 |
119: "f8", |
| 1918 |
"121": "f10", |
1919 |
120: "f9", |
| 1919 |
"122": "f11", |
1920 |
121: "f10", |
| 1920 |
"123": "f12", |
1921 |
122: "f11", |
| 1921 |
"144": "numlock", |
1922 |
123: "f12", |
| 1922 |
"145": "scrolllock", |
1923 |
144: "numlock", |
| 1923 |
"186": "semicolon", |
1924 |
145: "scrolllock", |
| 1924 |
"187": "equalsign", |
1925 |
186: "semicolon", |
| 1925 |
"188": "comma", |
1926 |
187: "equalsign", |
| 1926 |
"189": "dash", |
1927 |
188: "comma", |
| 1927 |
"191": "slash", |
1928 |
189: "dash", |
| 1928 |
"192": "graveaccent", |
1929 |
191: "slash", |
| 1929 |
"220": "backslash", |
1930 |
192: "graveaccent", |
| 1930 |
"222": "quote" |
1931 |
220: "backslash", |
| 1931 |
} |
1932 |
222: "quote", |
|
|
1933 |
}; |
| 1932 |
//Trigger auto-complete on all keys not in dictionary of exclusions above. |
1934 |
//Trigger auto-complete on all keys not in dictionary of exclusions above. |
| 1933 |
editor.on("keyup", function(cm, e) { |
1935 |
editor.on("keyup", function (cm, e) { |
| 1934 |
if (ExcludedTriggerKeys[e.keyCode] == undefined) { |
1936 |
if (ExcludedTriggerKeys[e.keyCode] == undefined) { |
| 1935 |
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); |
1937 |
CodeMirror.commands.autocomplete(editor, null, { completeSingle: false }); |
| 1936 |
} |
1938 |
} |
| 1937 |
}) |
1939 |
}); |
| 1938 |
|
1940 |
|
| 1939 |
// https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232 |
1941 |
// https://stackoverflow.com/questions/2086287/how-to-clear-jquery-validation-error-messages#answer-16025232 |
| 1940 |
function clearValidation( formElement ){ |
1942 |
function clearValidation(formElement) { |
| 1941 |
// formElement should be a jQuery object |
1943 |
// formElement should be a jQuery object |
| 1942 |
var validator = formElement.validate(); |
1944 |
var validator = formElement.validate(); |
| 1943 |
// Iterate through named elements inside of the form, and mark them as error free |
1945 |
// Iterate through named elements inside of the form, and mark them as error free |
| 1944 |
$('[name]',formElement).each(function(){ |
1946 |
$("[name]", formElement).each(function () { |
| 1945 |
validator.successList.push(this);//mark as error free |
1947 |
validator.successList.push(this); //mark as error free |
| 1946 |
validator.showErrors();//remove error messages if present |
1948 |
validator.showErrors(); //remove error messages if present |
| 1947 |
}); |
1949 |
}); |
| 1948 |
validator.resetForm();//remove error class on name elements and clear history |
1950 |
validator.resetForm(); //remove error class on name elements and clear history |
| 1949 |
validator.reset();//remove all error and success data |
1951 |
validator.reset(); //remove all error and success data |
| 1950 |
} |
1952 |
} |
| 1951 |
} |
1953 |
} |
| 1952 |
|
1954 |
|
| 1953 |
if (op == "showsql" || op == "showreport") { |
1955 |
if (op == "showsql" || op == "showreport") { |
| 1954 |
|
|
|
| 1955 |
var editor = CodeMirror.fromTextArea(sql, { |
1956 |
var editor = CodeMirror.fromTextArea(sql, { |
| 1956 |
lineNumbers: false, |
1957 |
lineNumbers: false, |
| 1957 |
mode: "text/x-sql", |
1958 |
mode: "text/x-sql", |
| 1958 |
lineWrapping: true, |
1959 |
lineWrapping: true, |
| 1959 |
readOnly: true, |
1960 |
readOnly: true, |
| 1960 |
keyword: { // Custom highlighting for items bounded in [[ ]] or << >>. |
1961 |
keyword: { |
| 1961 |
"\\[\\[(.*?)\\]\\]":"style2", |
1962 |
// Custom highlighting for items bounded in [[ ]] or << >>. |
| 1962 |
"<<(.*?)>>":"style1" |
1963 |
"\\[\\[(.*?)\\]\\]": "style2", |
| 1963 |
}, |
1964 |
"<<(.*?)>>": "style1", |
|
|
1965 |
}, |
| 1964 |
}); |
1966 |
}); |
| 1965 |
} |
1967 |
} |
| 1966 |
|
1968 |
|
| 1967 |
function showParamModal( category ){ |
1969 |
function showParamModal(category) { |
| 1968 |
var modal = $("#runtime_parameters"); |
1970 |
var modal = $("#runtime_parameters"); |
| 1969 |
var modalTitle = $("#runtime_parametersLabel"); |
1971 |
var modalTitle = $("#runtime_parametersLabel"); |
| 1970 |
switch ( category ){ |
1972 |
switch (category) { |
| 1971 |
case "insertAuthVal": |
1973 |
case "insertAuthVal": |
| 1972 |
modalTitle.text( _("Insert authorized value parameter") ); |
1974 |
modalTitle.text(_("Insert authorized value parameter")); |
| 1973 |
$("#paramLabel").val( _("Authorized value") ); |
1975 |
$("#paramLabel").val(_("Authorized value")); |
| 1974 |
$("#authorised_value_category").show(); |
1976 |
$("#authorised_value_category").show(); |
| 1975 |
$("label[for='authorised_value']").addClass("required"); |
1977 |
$("label[for='authorised_value']").addClass("required"); |
| 1976 |
$("#authorised_value").prop("required", true ).attr("required", "required").addClass("required"); |
1978 |
$("#authorised_value").prop("required", true).attr("required", "required").addClass("required"); |
| 1977 |
$("#runtime_param_options").show(); |
1979 |
$("#runtime_param_options").show(); |
| 1978 |
break; |
1980 |
break; |
| 1979 |
case "insertCnSource": |
1981 |
case "insertCnSource": |
| 1980 |
modalTitle.text( _("Insert classification source parameter") ); |
1982 |
modalTitle.text(_("Insert classification source parameter")); |
| 1981 |
$("#paramLabel").val( _("Source of classification or shelving scheme") ); |
1983 |
$("#paramLabel").val(_("Source of classification or shelving scheme")); |
| 1982 |
$("#param_category").val("cn_source"); |
1984 |
$("#param_category").val("cn_source"); |
| 1983 |
$("#runtime_param_options").show(); |
1985 |
$("#runtime_param_options").show(); |
| 1984 |
break; |
1986 |
break; |
| 1985 |
case "insertFramework": |
1987 |
case "insertFramework": |
| 1986 |
modalTitle.text( _("Insert bibliographic framework parameter") ); |
1988 |
modalTitle.text(_("Insert bibliographic framework parameter")); |
| 1987 |
$("#paramLabel").val( _("Framework") ); |
1989 |
$("#paramLabel").val(_("Framework")); |
| 1988 |
$("#param_category").val("biblio_framework"); |
1990 |
$("#param_category").val("biblio_framework"); |
| 1989 |
$("#runtime_param_options").show(); |
1991 |
$("#runtime_param_options").show(); |
| 1990 |
break; |
1992 |
break; |
| 1991 |
case "insertDate": |
1993 |
case "insertDate": |
| 1992 |
modalTitle.text( _("Insert date parameter") ); |
1994 |
modalTitle.text(_("Insert date parameter")); |
| 1993 |
$("#paramLabel").val( _("Date") ); |
1995 |
$("#paramLabel").val(_("Date")); |
| 1994 |
$("#param_category").val("date"); |
1996 |
$("#param_category").val("date"); |
| 1995 |
break; |
1997 |
break; |
| 1996 |
case "insertItemtypes": |
1998 |
case "insertItemtypes": |
| 1997 |
modalTitle.text( _("Insert item types parameter") ); |
1999 |
modalTitle.text(_("Insert item types parameter")); |
| 1998 |
$("#paramLabel").val( _("Item type") ); |
2000 |
$("#paramLabel").val(_("Item type")); |
| 1999 |
$("#param_category").val("itemtypes"); |
2001 |
$("#param_category").val("itemtypes"); |
| 2000 |
$("#runtime_param_options").show(); |
2002 |
$("#runtime_param_options").show(); |
| 2001 |
break; |
2003 |
break; |
| 2002 |
case "insertBranches": |
2004 |
case "insertBranches": |
| 2003 |
modalTitle.text( _("Insert libraries parameter") ); |
2005 |
modalTitle.text(_("Insert libraries parameter")); |
| 2004 |
$("#paramLabel").val( _("Library") ); |
2006 |
$("#paramLabel").val(_("Library")); |
| 2005 |
$("#param_category").val("branches"); |
2007 |
$("#param_category").val("branches"); |
| 2006 |
$("#runtime_param_options").show(); |
2008 |
$("#runtime_param_options").show(); |
| 2007 |
break; |
2009 |
break; |
| 2008 |
case "insertCategorycode": |
2010 |
case "insertCategorycode": |
| 2009 |
modalTitle.text( _("Insert patron category parameter") ); |
2011 |
modalTitle.text(_("Insert patron category parameter")); |
| 2010 |
$("#paramLabel").val( _("Patron category") ); |
2012 |
$("#paramLabel").val(_("Patron category")); |
| 2011 |
$("#param_category").val("categorycode"); |
2013 |
$("#param_category").val("categorycode"); |
| 2012 |
$("#runtime_param_options").show(); |
2014 |
$("#runtime_param_options").show(); |
| 2013 |
break; |
2015 |
break; |
| 2014 |
case "insertCashregister": |
2016 |
case "insertCashregister": |
| 2015 |
modalTitle.text( _("Insert cash register parameter") ); |
2017 |
modalTitle.text(_("Insert cash register parameter")); |
| 2016 |
$("#paramLabel").val( _("Cash register") ); |
2018 |
$("#paramLabel").val(_("Cash register")); |
| 2017 |
$("#param_category").val("cash_registers"); |
2019 |
$("#param_category").val("cash_registers"); |
| 2018 |
$("#runtime_param_options").show(); |
2020 |
$("#runtime_param_options").show(); |
| 2019 |
break; |
2021 |
break; |
| 2020 |
case "insertDebittypes": |
2022 |
case "insertDebittypes": |
| 2021 |
modalTitle.text( _("Insert debit type parameter") ); |
2023 |
modalTitle.text(_("Insert debit type parameter")); |
| 2022 |
$("#paramLabel").val( _("Debit type") ); |
2024 |
$("#paramLabel").val(_("Debit type")); |
| 2023 |
$("#param_category").val("debit_types"); |
2025 |
$("#param_category").val("debit_types"); |
| 2024 |
$("#runtime_param_options").show(); |
2026 |
$("#runtime_param_options").show(); |
| 2025 |
break; |
2027 |
break; |
| 2026 |
case "insertCredittypes": |
2028 |
case "insertCredittypes": |
| 2027 |
modalTitle.text( _("Insert credit type parameter") ); |
2029 |
modalTitle.text(_("Insert credit type parameter")); |
| 2028 |
$("#paramLabel").val( _("Credit type") ); |
2030 |
$("#paramLabel").val(_("Credit type")); |
| 2029 |
$("#param_category").val("credit_types"); |
2031 |
$("#param_category").val("credit_types"); |
| 2030 |
$("#runtime_param_options").show(); |
2032 |
$("#runtime_param_options").show(); |
| 2031 |
break; |
2033 |
break; |
| 2032 |
case "insertList": |
2034 |
case "insertList": |
| 2033 |
modalTitle.text( _("Insert list parameter") ); |
2035 |
modalTitle.text(_("Insert list parameter")); |
| 2034 |
$("#paramLabel").val( _("List of values") ); |
2036 |
$("#paramLabel").val(_("List of values")); |
| 2035 |
$("#param_category").val("list"); |
2037 |
$("#param_category").val("list"); |
| 2036 |
break; |
2038 |
break; |
| 2037 |
case "insertText": |
2039 |
case "insertText": |
| 2038 |
modalTitle.text( _("Insert text parameter") ); |
2040 |
modalTitle.text(_("Insert text parameter")); |
| 2039 |
$("#paramLabel").val( _("Text") ); |
2041 |
$("#paramLabel").val(_("Text")); |
| 2040 |
$("#param_category").val(""); |
2042 |
$("#param_category").val(""); |
| 2041 |
break; |
2043 |
break; |
| 2042 |
} |
2044 |
} |
|
Lines 2044-2080
Link Here
|
| 2044 |
modal.modal("show"); |
2046 |
modal.modal("show"); |
| 2045 |
} |
2047 |
} |
| 2046 |
|
2048 |
|
| 2047 |
function load_group_subgroups () { |
2049 |
function load_group_subgroups() { |
| 2048 |
var group = $("#group_select").val(); |
2050 |
var group = $("#group_select").val(); |
| 2049 |
var subgroup = $("#subgroup_select").val(); |
2051 |
var subgroup = $("#subgroup_select").val(); |
| 2050 |
var sg = $("#subgroup"); |
2052 |
var sg = $("#subgroup"); |
| 2051 |
$(sg).find('option[value!=""]').each(function() { |
2053 |
$(sg) |
| 2052 |
$(this).remove(); |
2054 |
.find('option[value!=""]') |
| 2053 |
}); |
2055 |
.each(function () { |
|
|
2056 |
$(this).remove(); |
| 2057 |
}); |
| 2054 |
$(sg).hide(); |
2058 |
$(sg).hide(); |
| 2055 |
if (group) { |
2059 |
if (group) { |
| 2056 |
var select = $(sg).find('select')[0]; |
2060 |
var select = $(sg).find("select")[0]; |
| 2057 |
$.each( group_subgroups[group], function(index, value) { |
2061 |
$.each(group_subgroups[group], function (index, value) { |
| 2058 |
if ( value[0] == subgroup ) { |
2062 |
if (value[0] == subgroup) { |
| 2059 |
$('<option selected="selected" value="' + value[0] + '">' + value[1] + '</option>').appendTo(select); |
2063 |
$('<option selected="selected" value="' + value[0] + '">' + value[1] + "</option>").appendTo(select); |
| 2060 |
} else { |
2064 |
} else { |
| 2061 |
$('<option value="' + value[0] + '">' + value[1] + '</option>').appendTo(select); |
2065 |
$('<option value="' + value[0] + '">' + value[1] + "</option>").appendTo(select); |
| 2062 |
} |
2066 |
} |
| 2063 |
} ); |
2067 |
}); |
| 2064 |
$("#subgroup, #subgroup *").show(); |
2068 |
$("#subgroup, #subgroup *").show(); |
| 2065 |
} |
2069 |
} |
| 2066 |
} |
2070 |
} |
| 2067 |
|
2071 |
|
| 2068 |
$(document).ready(function(){ |
2072 |
$(document).ready(function () { |
| 2069 |
|
|
|
| 2070 |
var activeTab = localStorage.getItem("sql_reports_activetab"); |
2073 |
var activeTab = localStorage.getItem("sql_reports_activetab"); |
| 2071 |
if( activeTab == 0 ){ |
2074 |
if (activeTab == 0) { |
| 2072 |
$("#subgroup_filter_block").hide(); |
2075 |
$("#subgroup_filter_block").hide(); |
| 2073 |
} |
2076 |
} |
| 2074 |
|
2077 |
|
| 2075 |
$("body").on('click',".fetch_chart_data",function(){ |
2078 |
$("body").on("click", ".fetch_chart_data", function () { |
| 2076 |
if( unlimited_total > 1000 ){ |
2079 |
if (unlimited_total > 1000) { |
| 2077 |
if( confirm( _("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?") ) ){ |
2080 |
if (confirm(_("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you want to chart this report?"))) { |
| 2078 |
return true; |
2081 |
return true; |
| 2079 |
} else { |
2082 |
} else { |
| 2080 |
return false; |
2083 |
return false; |
|
Lines 2085-2120
Link Here
|
| 2085 |
var showsql; |
2088 |
var showsql; |
| 2086 |
hide_bar_element(); |
2089 |
hide_bar_element(); |
| 2087 |
|
2090 |
|
| 2088 |
if ( $('.chart-column-conf').length == 1 ) { |
2091 |
if ($(".chart-column-conf").length == 1) { |
| 2089 |
$('.chart-column-delete').remove(); |
2092 |
$(".chart-column-delete").remove(); |
| 2090 |
} |
2093 |
} |
| 2091 |
|
2094 |
|
| 2092 |
$(".chart-column-delete").on('click', function(e){ |
2095 |
$(".chart-column-delete").on("click", function (e) { |
| 2093 |
e.preventDefault(); |
2096 |
e.preventDefault(); |
| 2094 |
removeColumn('column_' + $(this).data('column')); |
2097 |
removeColumn("column_" + $(this).data("column")); |
| 2095 |
}) |
2098 |
}); |
| 2096 |
|
2099 |
|
| 2097 |
$('#download-chart').click(function() { |
2100 |
$("#download-chart").click(function () { |
| 2098 |
var svg = '<svg>' + $('#chart svg').html() + '</svg>'; |
2101 |
var svg = "<svg>" + $("#chart svg").html() + "</svg>"; |
| 2099 |
this.href = 'data:application/octet-stream;base64,' + btoa(svg); |
2102 |
this.href = "data:application/octet-stream;base64," + btoa(svg); |
| 2100 |
this.setAttribute('download', 'chart.svg'); |
2103 |
this.setAttribute("download", "chart.svg"); |
| 2101 |
}); |
2104 |
}); |
| 2102 |
|
2105 |
|
| 2103 |
$('#chart-type').change(function() { |
2106 |
$("#chart-type").change(function () { |
| 2104 |
if ($(this).val() == 'bar') { |
2107 |
if ($(this).val() == "bar") { |
| 2105 |
show_bar_element(); |
2108 |
show_bar_element(); |
| 2106 |
} |
2109 |
} else { |
| 2107 |
else { |
|
|
| 2108 |
hide_bar_element(); |
2110 |
hide_bar_element(); |
| 2109 |
} |
2111 |
} |
| 2110 |
}); |
2112 |
}); |
| 2111 |
|
2113 |
|
| 2112 |
$('#download-chart').hide(); |
2114 |
$("#download-chart").hide(); |
| 2113 |
var chart; |
2115 |
var chart; |
| 2114 |
|
2116 |
|
| 2115 |
if ( original_results && !has_errors ) { |
2117 |
if (original_results && !has_errors) { |
| 2116 |
$('#draw-chart').click(function() { |
2118 |
$("#draw-chart").click(function () { |
| 2117 |
|
|
|
| 2118 |
var x_elements = $('select[name="x"]').val(); |
2119 |
var x_elements = $('select[name="x"]').val(); |
| 2119 |
var y_elements = []; |
2120 |
var y_elements = []; |
| 2120 |
var groups = []; |
2121 |
var groups = []; |
|
Lines 2124-2184
Link Here
|
| 2124 |
headers = header_row; |
2125 |
headers = header_row; |
| 2125 |
|
2126 |
|
| 2126 |
var results; |
2127 |
var results; |
| 2127 |
if (all_results.length){ |
2128 |
if (all_results.length) { |
| 2128 |
if ($('input[name="chart-include-all"]').prop('checked')) { |
2129 |
if ($('input[name="chart-include-all"]').prop("checked")) { |
| 2129 |
results = all_results; |
2130 |
results = all_results; |
| 2130 |
} |
2131 |
} else { |
| 2131 |
else { |
|
|
| 2132 |
results = original_results; |
2132 |
results = original_results; |
| 2133 |
} |
2133 |
} |
| 2134 |
} else { |
2134 |
} else { |
| 2135 |
results = original_results; |
2135 |
results = original_results; |
| 2136 |
} |
2136 |
} |
| 2137 |
|
2137 |
|
| 2138 |
if ($('input[name="chart-exclude-last"]').prop('checked')) { |
2138 |
if ($('input[name="chart-exclude-last"]').prop("checked")) { |
| 2139 |
results.splice(-1, 1); |
2139 |
results.splice(-1, 1); |
| 2140 |
} |
2140 |
} |
| 2141 |
|
2141 |
|
| 2142 |
$('select[name="y"]').each(function( index ) { |
2142 |
$('select[name="y"]').each(function (index) { |
| 2143 |
y_elements.push( $(this).val() ); |
2143 |
y_elements.push($(this).val()); |
| 2144 |
}); |
2144 |
}); |
| 2145 |
$('select[name="group"]').each(function( index ) { |
2145 |
$('select[name="group"]').each(function (index) { |
| 2146 |
groups.push( $(this).val() ); |
2146 |
groups.push($(this).val()); |
| 2147 |
}); |
2147 |
}); |
| 2148 |
$('.column-line').each(function( index ) { |
2148 |
$(".column-line").each(function (index) { |
| 2149 |
if ($(this).prop('checked')) { |
2149 |
if ($(this).prop("checked")) { |
| 2150 |
lines.push( $(this).attr('name') ); |
2150 |
lines.push($(this).attr("name")); |
| 2151 |
} |
2151 |
} |
| 2152 |
}); |
2152 |
}); |
| 2153 |
|
2153 |
|
| 2154 |
// Remove deleted columns from headers and results. |
2154 |
// Remove deleted columns from headers and results. |
| 2155 |
var deleted_indexes = []; |
2155 |
var deleted_indexes = []; |
| 2156 |
var kept_headers = []; |
2156 |
var kept_headers = []; |
| 2157 |
$.each(headers, function(index, value) { |
2157 |
$.each(headers, function (index, value) { |
| 2158 |
if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) { |
2158 |
if (value.cell != x_elements && $.inArray(value.cell, y_elements) === -1) { |
| 2159 |
// This header is neither a x element nor in y elements. Don't need it. |
2159 |
// This header is neither a x element nor in y elements. Don't need it. |
| 2160 |
deleted_indexes.push(index); |
2160 |
deleted_indexes.push(index); |
| 2161 |
} |
2161 |
} else { |
| 2162 |
else { |
2162 |
kept_headers.push({ cell: value.cell }); |
| 2163 |
kept_headers.push({cell: value.cell}); |
|
|
| 2164 |
} |
2163 |
} |
| 2165 |
}); |
2164 |
}); |
| 2166 |
|
2165 |
|
| 2167 |
// Remove corresponding cells. |
2166 |
// Remove corresponding cells. |
| 2168 |
var kept_results = []; |
2167 |
var kept_results = []; |
| 2169 |
$.each(results, function(index, value) { |
2168 |
$.each(results, function (index, value) { |
| 2170 |
var line = {}; |
2169 |
var line = {}; |
| 2171 |
line['cells'] = []; |
2170 |
line["cells"] = []; |
| 2172 |
$.each(value.cells, function(i, val) { |
2171 |
$.each(value.cells, function (i, val) { |
| 2173 |
if ($.inArray(i, deleted_indexes) === -1) { |
2172 |
if ($.inArray(i, deleted_indexes) === -1) { |
| 2174 |
line['cells'].push({cell: val.cell}); |
2173 |
line["cells"].push({ cell: val.cell }); |
| 2175 |
} |
2174 |
} |
| 2176 |
}); |
2175 |
}); |
| 2177 |
kept_results.push(line); |
2176 |
kept_results.push(line); |
| 2178 |
}); |
2177 |
}); |
| 2179 |
|
2178 |
|
| 2180 |
options.type = $('select[name="chart-type"]').val(); |
2179 |
options.type = $('select[name="chart-type"]').val(); |
| 2181 |
options.horizontal = $('input[name="column-horizontal"]').prop('checked'); |
2180 |
options.horizontal = $('input[name="column-horizontal"]').prop("checked"); |
| 2182 |
options.lines = lines; |
2181 |
options.lines = lines; |
| 2183 |
|
2182 |
|
| 2184 |
chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options); |
2183 |
chart = create_chart(kept_headers, kept_results, x_elements, y_elements, groups, options); |
|
Lines 2187-2221
Link Here
|
| 2187 |
$("#chartModal").modal("hide"); |
2186 |
$("#chartModal").modal("hide"); |
| 2188 |
}); |
2187 |
}); |
| 2189 |
} |
2188 |
} |
| 2190 |
if (op == "create"){ |
2189 |
if (op == "create") { |
| 2191 |
load_group_subgroups(); |
2190 |
load_group_subgroups(); |
| 2192 |
} |
2191 |
} |
| 2193 |
|
2192 |
|
| 2194 |
$('#limit').change(function() { |
2193 |
$("#limit").change(function () { |
| 2195 |
$('#limitselect').submit(); |
2194 |
$("#limitselect").submit(); |
| 2196 |
}); |
2195 |
}); |
| 2197 |
|
2196 |
|
| 2198 |
$(document).click(function() { |
2197 |
$(document).click(function () { |
| 2199 |
$('#report_updated').hide(); |
2198 |
$("#report_updated").hide(); |
| 2200 |
}); |
2199 |
}); |
| 2201 |
|
2200 |
|
| 2202 |
$(".goback").on("click",function(e){ |
2201 |
$(".goback").on("click", function (e) { |
| 2203 |
e.preventDefault(); |
2202 |
e.preventDefault(); |
| 2204 |
window.history.back(); |
2203 |
window.history.back(); |
| 2205 |
}); |
2204 |
}); |
| 2206 |
|
2205 |
|
| 2207 |
$("body").on("click", ".mana_search_button", function(){ |
2206 |
$("body").on("click", ".mana_search_button", function () { |
| 2208 |
$("#mana-loading").show(); |
2207 |
$("#mana-loading").show(); |
| 2209 |
mana_search($("#mana_search_field").val()); |
2208 |
mana_search($("#mana_search_field").val()); |
| 2210 |
}); |
2209 |
}); |
| 2211 |
|
2210 |
|
| 2212 |
$(".ShareButton").on("click", function(){ |
2211 |
$(".ShareButton").on("click", function () { |
| 2213 |
$("#note-error").hide(); |
2212 |
$("#note-error").hide(); |
| 2214 |
if($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20){ |
2213 |
if ($(this).closest("tr").find(".report_notes").text().length < 20 || $(this).closest("tr").find(".report_name").text().length < 20) { |
| 2215 |
$(".shared_infos").hide(); |
2214 |
$(".shared_infos").hide(); |
| 2216 |
$("#note-error").show(); |
2215 |
$("#note-error").show(); |
| 2217 |
} |
2216 |
} else { |
| 2218 |
else{ |
|
|
| 2219 |
$("#reportid").val($(this).closest("tr").find(".report_id").text()); |
2217 |
$("#reportid").val($(this).closest("tr").find(".report_id").text()); |
| 2220 |
$("#shared_id").html($(this).closest("tr").find(".report_id").text()); |
2218 |
$("#shared_id").html($(this).closest("tr").find(".report_id").text()); |
| 2221 |
$("#shared_name").html($(this).closest("tr").find(".report_name").text()); |
2219 |
$("#shared_name").html($(this).closest("tr").find(".report_name").text()); |
|
Lines 2226-2244
Link Here
|
| 2226 |
} |
2224 |
} |
| 2227 |
}); |
2225 |
}); |
| 2228 |
|
2226 |
|
| 2229 |
$("#mana_share_report").on("hidden.bs.modal", function(){ |
2227 |
$("#mana_share_report").on("hidden.bs.modal", function () { |
| 2230 |
$(".shared_infos").show(); |
2228 |
$(".shared_infos").show(); |
| 2231 |
}); |
2229 |
}); |
| 2232 |
|
2230 |
|
| 2233 |
$("#addColumn").on("click",function(){ |
2231 |
$("#addColumn").on("click", function () { |
| 2234 |
addColumn(); |
2232 |
addColumn(); |
| 2235 |
}); |
2233 |
}); |
| 2236 |
|
2234 |
|
| 2237 |
$("#delColumn").on("click",function(){ |
2235 |
$("#delColumn").on("click", function () { |
| 2238 |
delColumn(); |
2236 |
delColumn(); |
| 2239 |
}); |
2237 |
}); |
| 2240 |
|
2238 |
|
| 2241 |
if (saved1){ |
2239 |
if (saved1) { |
| 2242 |
var rtable = $("#table_reports").kohaTable( |
2240 |
var rtable = $("#table_reports").kohaTable( |
| 2243 |
{ |
2241 |
{ |
| 2244 |
autoWidth: false, |
2242 |
autoWidth: false, |
|
Lines 2253-2368
Link Here
|
| 2253 |
let table_dt = rtable.DataTable(); |
2251 |
let table_dt = rtable.DataTable(); |
| 2254 |
|
2252 |
|
| 2255 |
$("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
2253 |
$("#tabs a[data-bs-toggle='tab']").on("shown.bs.tab", function (e) { |
| 2256 |
tabsInit( $(e.target).parent(), rtable ); |
2254 |
tabsInit($(e.target).parent(), rtable); |
| 2257 |
}); |
2255 |
}); |
| 2258 |
|
2256 |
|
| 2259 |
if( activeTab ){ |
2257 |
if (activeTab) { |
| 2260 |
$("#tabs li:eq(" + activeTab + ") a").tab("show"); |
2258 |
$("#tabs li:eq(" + activeTab + ") a").tab("show"); |
| 2261 |
} |
2259 |
} |
| 2262 |
|
2260 |
|
| 2263 |
$("#subgroup_filter").change(function() { |
2261 |
$("#subgroup_filter").change(function () { |
| 2264 |
var selected = $(this).find('option:selected'); |
2262 |
var selected = $(this).find("option:selected"); |
| 2265 |
var sg_id = $(selected).val(); |
2263 |
var sg_id = $(selected).val(); |
| 2266 |
let col = table_dt.columns(5); |
2264 |
let col = table_dt.columns(5); |
| 2267 |
if (sg_id.length > 0) { |
2265 |
if (sg_id.length > 0) { |
| 2268 |
col.search(sg_id, {exact:true}).visible(false).draw(); |
2266 |
col.search(sg_id, { exact: true }).visible(false).draw(); |
| 2269 |
} else { |
2267 |
} else { |
| 2270 |
col.search("").visible(true).draw(); |
2268 |
col.search("").visible(true).draw(); |
| 2271 |
} |
2269 |
} |
| 2272 |
}); |
2270 |
}); |
| 2273 |
|
2271 |
|
| 2274 |
$("#reports_form").submit(function(){ |
2272 |
$("#reports_form").submit(function () { |
| 2275 |
var checkedItems = $("input[name=id]:checked"); |
2273 |
var checkedItems = $("input[name=id]:checked"); |
| 2276 |
if ($(checkedItems).size() == 0) { |
2274 |
if ($(checkedItems).size() == 0) { |
| 2277 |
alert(_("You must select one or more reports to delete")); |
2275 |
alert(_("You must select one or more reports to delete")); |
| 2278 |
return false; |
2276 |
return false; |
| 2279 |
} |
2277 |
} |
| 2280 |
$(checkedItems).parents('tr').addClass("warn"); |
2278 |
$(checkedItems).parents("tr").addClass("warn"); |
| 2281 |
if( confirm(_("Are you sure you want to delete the selected reports?")) ) { |
2279 |
if (confirm(_("Are you sure you want to delete the selected reports?"))) { |
| 2282 |
return true; |
2280 |
return true; |
| 2283 |
} else { |
2281 |
} else { |
| 2284 |
$(checkedItems).parents('tr').removeClass("warn"); |
2282 |
$(checkedItems).parents("tr").removeClass("warn"); |
| 2285 |
return false; |
2283 |
return false; |
| 2286 |
} |
2284 |
} |
| 2287 |
}); |
2285 |
}); |
| 2288 |
|
2286 |
|
| 2289 |
$("body").on("click", ".update_sql", function(e){ |
2287 |
$("body").on("click", ".update_sql", function (e) { |
| 2290 |
e.preventDefault(); |
2288 |
e.preventDefault(); |
| 2291 |
var ltitle = $(this).text(); |
2289 |
var ltitle = $(this).text(); |
| 2292 |
var report_id = $(this).data("report_id"); |
2290 |
var report_id = $(this).data("report_id"); |
| 2293 |
var page = $(this).attr("href"); |
2291 |
var page = $(this).attr("href"); |
| 2294 |
$("#update_sql .modal-body").load(page + " div", function(){ |
2292 |
$("#update_sql .modal-body").load(page + " div", function () { |
| 2295 |
var diff1 = $("#col1 .show_sql").text(); |
2293 |
var diff1 = $("#col1 .show_sql").text(); |
| 2296 |
var diff2 = $("#col2 .show_sql").text(); |
2294 |
var diff2 = $("#col2 .show_sql").text(); |
| 2297 |
var diffs = diffString( escape(diff1), escape(diff2) ); |
2295 |
var diffs = diffString(escape(diff1), escape(diff2)); |
| 2298 |
$("#col1 .show_sql,#col2 .show_sql").html(diffs); |
2296 |
$("#col1 .show_sql,#col2 .show_sql").html(diffs); |
| 2299 |
}); |
2297 |
}); |
| 2300 |
$('#update_sql').modal('show'); |
2298 |
$("#update_sql").modal("show"); |
| 2301 |
$("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?op=convert&id=" + report_id); |
2299 |
$("#update_sql_button").attr("href", "/cgi-bin/koha/reports/guided_reports.pl?op=convert&id=" + report_id); |
| 2302 |
}); |
2300 |
}); |
| 2303 |
|
2301 |
|
| 2304 |
$("#update_sql").on("hidden.bs.modal", function(){ |
2302 |
$("#update_sql").on("hidden.bs.modal", function () { |
| 2305 |
$("#update_sql_label").html(""); |
2303 |
$("#update_sql_label").html(""); |
| 2306 |
$("#update_sql .modal-body").html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>"); |
2304 |
$("#update_sql .modal-body").html('<div id="loading"><img src="' + interface + "/" + theme + '/img/spinner-small.gif" alt="" /> ' + _("Loading") + "</div>"); |
| 2307 |
}); |
2305 |
}); |
| 2308 |
} |
2306 |
} |
| 2309 |
|
2307 |
|
| 2310 |
if (op == "showsql"){ |
2308 |
if (op == "showsql") { |
| 2311 |
$("#sql").focus(function() { |
2309 |
$("#sql").focus(function () { |
| 2312 |
$(this).select(); |
2310 |
$(this).select(); |
| 2313 |
}); |
2311 |
}); |
| 2314 |
} |
2312 |
} |
| 2315 |
|
2313 |
|
| 2316 |
$("#toggle_sql").click(function(){ |
2314 |
$("#toggle_sql").click(function () { |
| 2317 |
var sql_output = $("#sql_output"); |
2315 |
var sql_output = $("#sql_output"); |
| 2318 |
sql_output.toggle(); |
2316 |
sql_output.toggle(); |
| 2319 |
if( sql_output.is(":visible") ){ |
2317 |
if (sql_output.is(":visible")) { |
| 2320 |
$(this).button('complete'); |
2318 |
$(this).button("complete"); |
| 2321 |
} else { |
2319 |
} else { |
| 2322 |
$(this).button('reset'); |
2320 |
$(this).button("reset"); |
| 2323 |
} |
2321 |
} |
| 2324 |
if( !showsql ){ |
2322 |
if (!showsql) { |
| 2325 |
showsql = CodeMirror.fromTextArea(sql, { |
2323 |
showsql = CodeMirror.fromTextArea(sql, { |
| 2326 |
lineNumbers: false, |
2324 |
lineNumbers: false, |
| 2327 |
mode: "text/x-sql", |
2325 |
mode: "text/x-sql", |
| 2328 |
lineWrapping: true, |
2326 |
lineWrapping: true, |
| 2329 |
readOnly: true |
2327 |
readOnly: true, |
| 2330 |
}); |
2328 |
}); |
| 2331 |
} |
2329 |
} |
| 2332 |
}); |
2330 |
}); |
| 2333 |
|
2331 |
|
| 2334 |
$(".toggle_chart_settings").click(function(){ |
2332 |
$(".toggle_chart_settings").click(function () { |
| 2335 |
$("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle(); |
2333 |
$("#chart, #toggle_chart_settings_hid, #toggle_chart_settings_vis").toggle(); |
| 2336 |
}); |
2334 |
}); |
| 2337 |
|
2335 |
|
| 2338 |
if (op == "create" || op == "editsql" || op == "save"){ |
2336 |
if (op == "create" || op == "editsql" || op == "save") { |
| 2339 |
|
|
|
| 2340 |
var validated_form = $("#sql_report_form").validate({ |
2337 |
var validated_form = $("#sql_report_form").validate({ |
| 2341 |
reportname: "required", |
2338 |
reportname: "required", |
| 2342 |
group_input: { |
2339 |
group_input: { |
| 2343 |
required: { |
2340 |
required: { |
| 2344 |
depends: function(element) { |
2341 |
depends: function (element) { |
| 2345 |
return $("#create_group").prop("checked") && $("#groupdesc_input").val() != ''; |
2342 |
return $("#create_group").prop("checked") && $("#groupdesc_input").val() != ""; |
| 2346 |
} |
2343 |
}, |
| 2347 |
} |
2344 |
}, |
| 2348 |
}, |
2345 |
}, |
| 2349 |
groupdesc_input: { |
2346 |
groupdesc_input: { |
| 2350 |
required: { |
2347 |
required: { |
| 2351 |
depends: function(element) { |
2348 |
depends: function (element) { |
| 2352 |
return $("#create_group").prop("checked") && $("#group_input").val() != ''; |
2349 |
return $("#create_group").prop("checked") && $("#group_input").val() != ""; |
| 2353 |
} |
2350 |
}, |
| 2354 |
} |
2351 |
}, |
| 2355 |
} |
2352 |
}, |
| 2356 |
}); |
2353 |
}); |
| 2357 |
|
2354 |
|
| 2358 |
$("#select_group").change(function() { |
2355 |
$("#select_group").change(function () { |
| 2359 |
if($(this).prop('checked')) { |
2356 |
if ($(this).prop("checked")) { |
| 2360 |
$("#group_input").attr("class","").prop('disabled', true).prop("required", false); |
2357 |
$("#group_input").attr("class", "").prop("disabled", true).prop("required", false); |
| 2361 |
$("#groupdesc_input").attr("class","").prop('disabled', true).prop("required", false); |
2358 |
$("#groupdesc_input").attr("class", "").prop("disabled", true).prop("required", false); |
| 2362 |
$("#group_select").prop('disabled', false); |
2359 |
$("#group_select").prop("disabled", false); |
| 2363 |
clearValidation( $("#sql_report_form") ); |
2360 |
clearValidation($("#sql_report_form")); |
| 2364 |
if ($("#group_select").val().length > 0) { |
2361 |
if ($("#group_select").val().length > 0) { |
| 2365 |
$("#select_subgroup").prop('checked', true); |
2362 |
$("#select_subgroup").prop("checked", true); |
| 2366 |
$("#select_subgroup").change(); |
2363 |
$("#select_subgroup").change(); |
| 2367 |
$("#subgroup, #subgroup *").show(); |
2364 |
$("#subgroup, #subgroup *").show(); |
| 2368 |
} else { |
2365 |
} else { |
|
Lines 2370-2444
Link Here
|
| 2370 |
} |
2367 |
} |
| 2371 |
} |
2368 |
} |
| 2372 |
}); |
2369 |
}); |
| 2373 |
$("#create_group").change(function() { |
2370 |
$("#create_group").change(function () { |
| 2374 |
if($(this).prop('checked')) { |
2371 |
if ($(this).prop("checked")) { |
| 2375 |
$("#group_input").prop('disabled', false).prop("required", true ); |
2372 |
$("#group_input").prop("disabled", false).prop("required", true); |
| 2376 |
$("#groupdesc_input").prop('disabled', false).prop("required", true ); |
2373 |
$("#groupdesc_input").prop("disabled", false).prop("required", true); |
| 2377 |
$("#group_select").prop('disabled', true); |
2374 |
$("#group_select").prop("disabled", true); |
| 2378 |
// $("#create_subgroup").prop('checked', true).change(); |
2375 |
// $("#create_subgroup").prop('checked', true).change(); |
| 2379 |
$("#subgroup_select").hide(); |
2376 |
$("#subgroup_select").hide(); |
| 2380 |
$("#subgroup input[type='radio']").hide(); |
2377 |
$("#subgroup input[type='radio']").hide(); |
| 2381 |
$("#subgroup label[for]").hide(); |
2378 |
$("#subgroup label[for]").hide(); |
| 2382 |
$("#subgroup_input").prop("required", false ).prop("disabled", false).show(); |
2379 |
$("#subgroup_input").prop("required", false).prop("disabled", false).show(); |
| 2383 |
$("#subgroupdesc_input").prop("required", false ).prop("disabled", false).show(); |
2380 |
$("#subgroupdesc_input").prop("required", false).prop("disabled", false).show(); |
| 2384 |
$("#subgroup").show(); |
2381 |
$("#subgroup").show(); |
| 2385 |
// Add validation rules for fields which were previously hidden |
2382 |
// Add validation rules for fields which were previously hidden |
| 2386 |
$("#subgroup_input").rules("add", { |
2383 |
$("#subgroup_input").rules("add", { |
| 2387 |
required: { |
2384 |
required: { |
| 2388 |
depends: function(element) { |
2385 |
depends: function (element) { |
| 2389 |
return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != ''; |
2386 |
return $("#create_group").prop("checked") && $("#subgroupdesc_input").val() != ""; |
| 2390 |
} |
2387 |
}, |
| 2391 |
} |
2388 |
}, |
| 2392 |
}); |
2389 |
}); |
| 2393 |
$("#subgroupdesc_input").rules("add", { |
2390 |
$("#subgroupdesc_input").rules("add", { |
| 2394 |
required: { |
2391 |
required: { |
| 2395 |
depends: function(element) { |
2392 |
depends: function (element) { |
| 2396 |
return $("#create_group").prop("checked") && $("#subgroup_input").val() != ''; |
2393 |
return $("#create_group").prop("checked") && $("#subgroup_input").val() != ""; |
| 2397 |
} |
2394 |
}, |
| 2398 |
} |
2395 |
}, |
| 2399 |
}); |
2396 |
}); |
| 2400 |
} |
2397 |
} |
| 2401 |
}); |
2398 |
}); |
| 2402 |
$("#select_subgroup").change(function() { |
2399 |
$("#select_subgroup").change(function () { |
| 2403 |
if($(this).prop('checked')) { |
2400 |
if ($(this).prop("checked")) { |
| 2404 |
$("#subgroup_select").prop('disabled', false); |
2401 |
$("#subgroup_select").prop("disabled", false); |
| 2405 |
$("#subgroup_input").prop('disabled', true).prop("required", false ); |
2402 |
$("#subgroup_input").prop("disabled", true).prop("required", false); |
| 2406 |
$("#subgroupdesc_input").prop('disabled', true).prop("required", false ); |
2403 |
$("#subgroupdesc_input").prop("disabled", true).prop("required", false); |
| 2407 |
clearValidation( $("#sql_report_form") ); |
2404 |
clearValidation($("#sql_report_form")); |
| 2408 |
} |
2405 |
} |
| 2409 |
}); |
2406 |
}); |
| 2410 |
$("#create_subgroup").change(function() { |
2407 |
$("#create_subgroup").change(function () { |
| 2411 |
if($(this).prop('checked')) { |
2408 |
if ($(this).prop("checked")) { |
| 2412 |
$("#subgroup_input").prop('disabled', false).prop("required", true ); |
2409 |
$("#subgroup_input").prop("disabled", false).prop("required", true); |
| 2413 |
$("#subgroupdesc_input").prop('disabled', false).prop("required", true ); |
2410 |
$("#subgroupdesc_input").prop("disabled", false).prop("required", true); |
| 2414 |
$("#subgroup_select").val("").prop('disabled', true); |
2411 |
$("#subgroup_select").val("").prop("disabled", true); |
| 2415 |
} |
2412 |
} |
| 2416 |
}); |
2413 |
}); |
| 2417 |
$("#select_group").change(); |
2414 |
$("#select_group").change(); |
| 2418 |
$("#select_subgroup").change(); |
2415 |
$("#select_subgroup").change(); |
| 2419 |
$("#group_select").on("change",function(){ |
2416 |
$("#group_select").on("change", function () { |
| 2420 |
load_group_subgroups(); |
2417 |
load_group_subgroups(); |
| 2421 |
}); |
2418 |
}); |
| 2422 |
|
2419 |
|
| 2423 |
$(".insertParam").on("click", function(e){ |
2420 |
$(".insertParam").on("click", function (e) { |
| 2424 |
e.preventDefault(); |
2421 |
e.preventDefault(); |
| 2425 |
var category = this.id; |
2422 |
var category = this.id; |
| 2426 |
showParamModal( category ); |
2423 |
showParamModal(category); |
| 2427 |
}); |
2424 |
}); |
| 2428 |
|
2425 |
|
| 2429 |
$("#runtime_parameters").on("shown.bs.modal", function(){ |
2426 |
$("#runtime_parameters").on("shown.bs.modal", function () { |
| 2430 |
$("#paramLabel").focus(); |
2427 |
$("#paramLabel").focus(); |
| 2431 |
}); |
2428 |
}); |
| 2432 |
|
2429 |
|
| 2433 |
$("#runtime_parameters").on("hide.bs.modal", function(){ |
2430 |
$("#runtime_parameters").on("hide.bs.modal", function () { |
| 2434 |
$("#send_runtime_parameter")[0].reset(); |
2431 |
$("#send_runtime_parameter")[0].reset(); |
| 2435 |
$("#authorised_value_category").val("").hide(); |
2432 |
$("#authorised_value_category").val("").hide(); |
| 2436 |
$("#runtime_param_options").val("").hide(); |
2433 |
$("#runtime_param_options").val("").hide(); |
| 2437 |
$("label[for='authorised_value']").removeClass("required"); |
2434 |
$("label[for='authorised_value']").removeClass("required"); |
| 2438 |
$("#authorised_value").prop("required", false ).removeAttr("required").removeClass("required"); |
2435 |
$("#authorised_value").prop("required", false).removeAttr("required").removeClass("required"); |
| 2439 |
}); |
2436 |
}); |
| 2440 |
|
2437 |
|
| 2441 |
$("#send_runtime_parameter").on("submit", function(e){ |
2438 |
$("#send_runtime_parameter").on("submit", function (e) { |
| 2442 |
e.preventDefault(); |
2439 |
e.preventDefault(); |
| 2443 |
/* Get form values */ |
2440 |
/* Get form values */ |
| 2444 |
var paramLabel = $("#paramLabel").val(); |
2441 |
var paramLabel = $("#paramLabel").val(); |
|
Lines 2451-2473
Link Here
|
| 2451 |
var cursor = doc.getCursor(); |
2448 |
var cursor = doc.getCursor(); |
| 2452 |
var pos = { |
2449 |
var pos = { |
| 2453 |
line: cursor.line, |
2450 |
line: cursor.line, |
| 2454 |
ch: cursor.ch |
2451 |
ch: cursor.ch, |
| 2455 |
} |
2452 |
}; |
| 2456 |
/* Build runtime parameter text string */ |
2453 |
/* Build runtime parameter text string */ |
| 2457 |
var text = ""; |
2454 |
var text = ""; |
| 2458 |
if( paramLabel && param_category ){ |
2455 |
if (paramLabel && param_category) { |
| 2459 |
text += paramLabel + "|" + param_category; |
2456 |
text += paramLabel + "|" + param_category; |
| 2460 |
} else if( paramLabel ) { |
2457 |
} else if (paramLabel) { |
| 2461 |
text += paramLabel; |
2458 |
text += paramLabel; |
| 2462 |
} else if( param_category ){ |
2459 |
} else if (param_category) { |
| 2463 |
text += param_category; |
2460 |
text += param_category; |
| 2464 |
} |
2461 |
} |
| 2465 |
if( param_option ){ |
2462 |
if (param_option) { |
| 2466 |
text += param_option; |
2463 |
text += param_option; |
| 2467 |
} |
2464 |
} |
| 2468 |
if( text != "" ){ |
2465 |
if (text != "") { |
| 2469 |
text = " <<" + text + ">> "; |
2466 |
text = " <<" + text + ">> "; |
| 2470 |
if( selection.length > 0){ |
2467 |
if (selection.length > 0) { |
| 2471 |
editor.replaceSelection(text); |
2468 |
editor.replaceSelection(text); |
| 2472 |
} else { |
2469 |
} else { |
| 2473 |
doc.replaceRange(text, pos); |
2470 |
doc.replaceRange(text, pos); |
|
Lines 2476-2549
Link Here
|
| 2476 |
$("#runtime_parameters").modal("hide"); |
2473 |
$("#runtime_parameters").modal("hide"); |
| 2477 |
}); |
2474 |
}); |
| 2478 |
|
2475 |
|
| 2479 |
$("#authorised_value").on("change", function(){ |
2476 |
$("#authorised_value").on("change", function () { |
| 2480 |
$("#param_category").val( $(this).val() ); |
2477 |
$("#param_category").val($(this).val()); |
| 2481 |
}); |
2478 |
}); |
| 2482 |
|
|
|
| 2483 |
} |
2479 |
} |
| 2484 |
|
2480 |
|
| 2485 |
$("#mana_search_form").submit(function(e){ |
2481 |
$("#mana_search_form").submit(function (e) { |
| 2486 |
e.preventDefault(); |
2482 |
e.preventDefault(); |
| 2487 |
}); |
2483 |
}); |
| 2488 |
|
2484 |
|
| 2489 |
$("#column_submit").submit(function() { |
2485 |
$("#column_submit").submit(function () { |
| 2490 |
if ($("#selectedColumns option").size() < 1) { |
2486 |
if ($("#selectedColumns option").size() < 1) { |
| 2491 |
alert(_("No columns selected!")); |
2487 |
alert(_("No columns selected!")); |
| 2492 |
return false; |
2488 |
return false; |
| 2493 |
} |
2489 |
} |
| 2494 |
$("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns |
2490 |
$("#selectedColumns option").attr("selected", "selected"); // Select everything still in #selectedColumns |
| 2495 |
return true; |
2491 |
return true; |
| 2496 |
}); |
2492 |
}); |
| 2497 |
|
2493 |
|
| 2498 |
// Mana KB |
2494 |
// Mana KB |
| 2499 |
$("body").on("click", ".mana-use", function(e) { |
2495 |
$("body").on("click", ".mana-use", function (e) { |
| 2500 |
e.preventDefault(); |
2496 |
e.preventDefault(); |
| 2501 |
$(this).find("i").attr("class","fa-solid fa-rotate fa-spin"); |
2497 |
$(this).find("i").attr("class", "fa-solid fa-rotate fa-spin"); |
| 2502 |
mana_use( $(this).data("report_id") ); |
2498 |
mana_use($(this).data("report_id")); |
| 2503 |
}); |
2499 |
}); |
| 2504 |
|
2500 |
|
| 2505 |
$("#mana_search_result").on("shown.bs.modal", function(){ |
2501 |
$("#mana_search_result").on("shown.bs.modal", function () { |
| 2506 |
$("#mana_search_field").focus(); |
2502 |
$("#mana_search_field").focus(); |
| 2507 |
}); |
2503 |
}); |
| 2508 |
|
2504 |
|
| 2509 |
$("#mana_search_result").on("hide.bs.modal", function(){ |
2505 |
$("#mana_search_result").on("hide.bs.modal", function () { |
| 2510 |
$("#mana_result_content").html(""); |
2506 |
$("#mana_result_content").html(""); |
| 2511 |
$("#mana_search_field").val(""); |
2507 |
$("#mana_search_field").val(""); |
| 2512 |
}); |
2508 |
}); |
| 2513 |
|
2509 |
|
| 2514 |
$(".batch_op").on("click", function(e){ |
2510 |
$(".batch_op").on("click", function (e) { |
| 2515 |
e.preventDefault(); |
2511 |
e.preventDefault(); |
| 2516 |
var target_form = $(this).data("submit"); |
2512 |
var target_form = $(this).data("submit"); |
| 2517 |
$("#" + target_form ).submit(); |
2513 |
$("#" + target_form).submit(); |
| 2518 |
}); |
2514 |
}); |
| 2519 |
|
2515 |
|
| 2520 |
$("#batch_add_to_list").on("submit", function(e){ |
2516 |
$("#batch_add_to_list").on("submit", function (e) { |
| 2521 |
e.preventDefault(); |
2517 |
e.preventDefault(); |
| 2522 |
addToList(); |
2518 |
addToList(); |
| 2523 |
}); |
2519 |
}); |
| 2524 |
|
2520 |
|
| 2525 |
$("body").on("click", ".preview_sql", function(e){ |
2521 |
$("body").on("click", ".preview_sql", function (e) { |
| 2526 |
e.preventDefault(); |
2522 |
e.preventDefault(); |
| 2527 |
var reportid = $(this).data("reportid"); |
2523 |
var reportid = $(this).data("reportid"); |
| 2528 |
previewSql( reportid ); |
2524 |
previewSql(reportid); |
| 2529 |
}); |
2525 |
}); |
| 2530 |
$(".limitselect").on("click", function(){ |
2526 |
$(".limitselect").on("click", function () { |
| 2531 |
var limit = $(this).data("limit"); |
2527 |
var limit = $(this).data("limit"); |
| 2532 |
$("#limit").val( limit ); |
2528 |
$("#limit").val(limit); |
| 2533 |
$("#limitselect").submit(); |
2529 |
$("#limitselect").submit(); |
| 2534 |
}); |
2530 |
}); |
| 2535 |
|
2531 |
|
| 2536 |
// Apply select2 to all select fields having a "multiple" attribute |
2532 |
// Apply select2 to all select fields having a "multiple" attribute |
| 2537 |
let selectFields = document.querySelectorAll('#report_param_form select[multiple]'); |
2533 |
let selectFields = document.querySelectorAll("#report_param_form select[multiple]"); |
| 2538 |
selectFields.forEach((selectField) => { |
2534 |
selectFields.forEach(selectField => { |
| 2539 |
selectField.style.minWidth = '320px'; |
2535 |
selectField.style.minWidth = "320px"; |
| 2540 |
$(selectField).select2(); |
2536 |
$(selectField).select2(); |
| 2541 |
}); |
2537 |
}); |
| 2542 |
}); |
2538 |
}); |
| 2543 |
|
2539 |
|
| 2544 |
$("#toggle_auto_links").on("click", function(e){ |
2540 |
$("#toggle_auto_links").on("click", function (e) { |
| 2545 |
e.preventDefault(); |
2541 |
e.preventDefault(); |
| 2546 |
if( $(".data-plain").is(":visible") ){ |
2542 |
if ($(".data-plain").is(":visible")) { |
| 2547 |
/* if a data-plain element is visible, this click hides it and shows auto-links */ |
2543 |
/* if a data-plain element is visible, this click hides it and shows auto-links */ |
| 2548 |
localStorage.removeItem("reports_auto_link_off"); |
2544 |
localStorage.removeItem("reports_auto_link_off"); |
| 2549 |
} else { |
2545 |
} else { |
|
Lines 2552-2567
Link Here
|
| 2552 |
} |
2548 |
} |
| 2553 |
$(".data-plain,.autolink").toggle(); |
2549 |
$(".data-plain,.autolink").toggle(); |
| 2554 |
}); |
2550 |
}); |
| 2555 |
if ( localStorage.getItem("reports_auto_link_off") == 1 ){ |
2551 |
if (localStorage.getItem("reports_auto_link_off") == 1) { |
| 2556 |
$("#toggle_auto_links").click(); |
2552 |
$("#toggle_auto_links").click(); |
| 2557 |
} |
2553 |
} |
| 2558 |
|
2554 |
|
| 2559 |
function tabsInit( tab, rtable ){ |
2555 |
function tabsInit(tab, rtable) { |
| 2560 |
var activeTab = tab.index(); |
2556 |
var activeTab = tab.index(); |
| 2561 |
localStorage.setItem("sql_reports_activetab", activeTab ); |
2557 |
localStorage.setItem("sql_reports_activetab", activeTab); |
| 2562 |
|
2558 |
|
| 2563 |
$("#subgroup_filter option").each(function() { |
2559 |
$("#subgroup_filter option").each(function () { |
| 2564 |
if($(this).val().length > 0) { |
2560 |
if ($(this).val().length > 0) { |
| 2565 |
$(this).remove(); |
2561 |
$(this).remove(); |
| 2566 |
} |
2562 |
} |
| 2567 |
}); |
2563 |
}); |
|
Lines 2572-2589
Link Here
|
| 2572 |
col5.search("").visible(true); |
2568 |
col5.search("").visible(true); |
| 2573 |
|
2569 |
|
| 2574 |
var g_id = tab.find("a").data("tabname"); |
2570 |
var g_id = tab.find("a").data("tabname"); |
| 2575 |
if (g_id === 'reports') { |
2571 |
if (g_id === "reports") { |
| 2576 |
g_id = ''; |
2572 |
g_id = ""; |
| 2577 |
} |
2573 |
} |
| 2578 |
|
2574 |
|
| 2579 |
if (g_id !== null && g_id !== undefined && g_id.toString().length > 0) { |
2575 |
if (g_id !== null && g_id !== undefined && g_id.toString().length > 0) { |
| 2580 |
col4.search(g_id, {exact:true}).visible(false); |
2576 |
col4.search(g_id, { exact: true }).visible(false); |
| 2581 |
if( group_subgroups[g_id] && group_subgroups[g_id].length > 0 ){ |
2577 |
if (group_subgroups[g_id] && group_subgroups[g_id].length > 0) { |
| 2582 |
for(var i in group_subgroups[g_id]) { |
2578 |
for (var i in group_subgroups[g_id]) { |
| 2583 |
$("#subgroup_filter").append( |
2579 |
$("#subgroup_filter").append('<option value="' + group_subgroups[g_id][i][0] + '">' + group_subgroups[g_id][i][1] + "</option>"); |
| 2584 |
'<option value="' + group_subgroups[g_id][i][0] + '">' |
|
|
| 2585 |
+ group_subgroups[g_id][i][1] + '</option>' |
| 2586 |
); |
| 2587 |
} |
2580 |
} |
| 2588 |
$("#subgroup_filter_block").show(); |
2581 |
$("#subgroup_filter_block").show(); |
| 2589 |
} else { |
2582 |
} else { |
|
Lines 2603-2681
Link Here
|
| 2603 |
} |
2596 |
} |
| 2604 |
|
2597 |
|
| 2605 |
// Mana KB |
2598 |
// Mana KB |
| 2606 |
function mana_use( mana_id ){ |
2599 |
function mana_use(mana_id) { |
| 2607 |
$.ajax( { |
2600 |
$.ajax({ |
| 2608 |
type:"POST", |
2601 |
type: "POST", |
| 2609 |
url: "/cgi-bin/koha/svc/mana/use", |
2602 |
url: "/cgi-bin/koha/svc/mana/use", |
| 2610 |
data: {id:mana_id, resource: 'report', saveinbase: 1, csrf_token: $('meta[name="csrf-token"]').attr('content')}, |
2603 |
data: { id: mana_id, resource: "report", saveinbase: 1, csrf_token: $('meta[name="csrf-token"]').attr("content") }, |
| 2611 |
dataType: "json", |
2604 |
dataType: "json", |
| 2612 |
}) |
2605 |
}) |
| 2613 |
.done( function (result){ |
2606 |
.done(function (result) { |
| 2614 |
if ( result.errmsg ){ |
2607 |
if (result.errmsg) { |
| 2615 |
alert( result.errmsg ); |
2608 |
alert(result.errmsg); |
| 2616 |
} |
2609 |
} else { |
| 2617 |
else{ |
2610 |
window.location = "/cgi-bin/koha/reports/guided_reports.pl?id=".concat(result.id).concat("&op=show&mana_success=1"); |
| 2618 |
window.location = ("/cgi-bin/koha/reports/guided_reports.pl?id=").concat(result.id).concat("&op=show&mana_success=1"); |
2611 |
} |
| 2619 |
} |
2612 |
}) |
| 2620 |
}) |
2613 |
.fail(function (error) { |
| 2621 |
.fail(function( error ) { |
2614 |
$(".mana_use_status").hide(); |
| 2622 |
$(".mana_use_status").hide(); |
2615 |
$("#mana_use_errortext").html(error.status + " " + error.statusText); |
| 2623 |
$("#mana_use_errortext").html( error.status + " " + error.statusText ); |
2616 |
$("#mana_use_failed").show(); |
| 2624 |
$("#mana_use_failed").show(); |
2617 |
$(".mana-use i").attr("class", "fa fa-download"); |
| 2625 |
$(".mana-use i").attr("class","fa fa-download"); |
2618 |
}); |
| 2626 |
}); |
|
|
| 2627 |
} |
2619 |
} |
| 2628 |
|
2620 |
|
| 2629 |
function mana_search( textquery ){ |
2621 |
function mana_search(textquery) { |
| 2630 |
$(".mana_search_status").hide(); |
2622 |
$(".mana_search_status").hide(); |
| 2631 |
$("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", "resource=report&usecomments=1&id=" + textquery, function( response, status, xhr ) { |
2623 |
$("#mana_result_content").load("/cgi-bin/koha/svc/mana/search #mana_results", "resource=report&usecomments=1&id=" + textquery, function (response, status, xhr) { |
| 2632 |
|
2624 |
if (status == "error") { |
| 2633 |
if ( status == "error" ) { |
2625 |
$("#mana_search_errortext").html(xhr.status + " " + xhr.statusText); |
| 2634 |
$("#mana_search_errortext").html( xhr.status + " " + xhr.statusText ); |
2626 |
$("#mana_search_failed").show(); |
| 2635 |
$("#mana_search_failed").show(); |
2627 |
$("#mana-loading").hide(); |
| 2636 |
$("#mana-loading").hide(); |
2628 |
} else { |
| 2637 |
} else { |
2629 |
$(".mana_search_status").hide(); |
| 2638 |
$(".mana_search_status").hide(); |
2630 |
$("#mana_search_result_label").text(_("Results from Mana Knowledge Base")); |
| 2639 |
$("#mana_search_result_label").text(_("Results from Mana Knowledge Base")); |
2631 |
$("#mana-loading").hide(); |
| 2640 |
$("#mana-loading").hide(); |
2632 |
$("#mana_results_datatable").kohaTable({ |
| 2641 |
$("#mana_results_datatable").kohaTable({ |
2633 |
pagingType: "full", |
| 2642 |
pagingType: "full", |
2634 |
autoWidth: false, |
| 2643 |
autoWidth: false, |
2635 |
columnDefs: [{ width: "35%", targets: 1 }], |
| 2644 |
columnDefs: [ |
2636 |
}); |
| 2645 |
{ "width": "35%", targets: 1 } |
|
|
| 2646 |
], |
| 2647 |
}); |
| 2648 |
|
2637 |
|
| 2649 |
$(".showbutton").on("click", function(e){ |
2638 |
$(".showbutton").on("click", function (e) { |
| 2650 |
e.preventDefault(); |
2639 |
e.preventDefault(); |
| 2651 |
$(this).parent().hide(); |
2640 |
$(this).parent().hide(); |
| 2652 |
$(this).parent().next().show(); |
2641 |
$(this).parent().next().show(); |
| 2653 |
}); |
2642 |
}); |
| 2654 |
|
2643 |
|
| 2655 |
$(".hidebutton").on("click", function(e){ |
2644 |
$(".hidebutton").on("click", function (e) { |
| 2656 |
e.preventDefault(); |
2645 |
e.preventDefault(); |
| 2657 |
$(this).parent().hide(); |
2646 |
$(this).parent().hide(); |
| 2658 |
$(this).parent().prev().show(); |
2647 |
$(this).parent().prev().show(); |
| 2659 |
}); |
2648 |
}); |
| 2660 |
|
2649 |
|
| 2661 |
if($("td.dataTables_empty").length == 0){ |
2650 |
if ($("td.dataTables_empty").length == 0) { |
| 2662 |
$("#mana_search_message").show(); |
2651 |
$("#mana_search_message").show(); |
| 2663 |
} |
|
|
| 2664 |
} |
2652 |
} |
| 2665 |
}); |
2653 |
} |
|
|
2654 |
}); |
| 2666 |
} |
2655 |
} |
| 2667 |
|
2656 |
|
| 2668 |
function addToList() { |
2657 |
function addToList() { |
| 2669 |
var biblionumbers = []; |
2658 |
var biblionumbers = []; |
| 2670 |
$(".bib_to_list").each(function() { |
2659 |
$(".bib_to_list").each(function () { |
| 2671 |
var biblionumber = Number( $(this).val() ); |
2660 |
var biblionumber = Number($(this).val()); |
| 2672 |
if( biblionumbers.indexOf( biblionumber ) < 0 ){ |
2661 |
if (biblionumbers.indexOf(biblionumber) < 0) { |
| 2673 |
biblionumbers.push( biblionumber ); |
2662 |
biblionumbers.push(biblionumber); |
| 2674 |
} |
2663 |
} |
| 2675 |
}); |
2664 |
}); |
| 2676 |
bibs = biblionumbers.join("/"); |
2665 |
bibs = biblionumbers.join("/"); |
| 2677 |
var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs; |
2666 |
var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs; |
| 2678 |
window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes'); |
2667 |
window.open(url, "Add_to_virtualshelf", "width=500, height=400, toolbar=false, scrollbars=yes"); |
| 2679 |
return false; |
2668 |
return false; |
| 2680 |
} |
2669 |
} |
| 2681 |
|
2670 |
|
|
Lines 2683-2723
Link Here
|
| 2683 |
function previewSql(reportid) { |
2672 |
function previewSql(reportid) { |
| 2684 |
var yes_label = ""; |
2673 |
var yes_label = ""; |
| 2685 |
var no_label = ""; |
2674 |
var no_label = ""; |
| 2686 |
var message = $("#previewSql" + reportid ).val(); |
2675 |
var message = $("#previewSql" + reportid).val(); |
| 2687 |
var title = $("#previewSql" + reportid ).data("title"); |
2676 |
var title = $("#previewSql" + reportid).data("title"); |
| 2688 |
if( $("#preview-sql-modal").length > 0) { |
2677 |
if ($("#preview-sql-modal").length > 0) { |
| 2689 |
$("#preview-sql-modal").remove(); |
2678 |
$("#preview-sql-modal").remove(); |
| 2690 |
} |
2679 |
} |
| 2691 |
$("body").append('<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\ |
2680 |
$("body").append( |
|
|
2681 |
'<div id="preview-sql-modal" tabindex="-1" role="dialog" aria-hidden="true" class="modal">\ |
| 2692 |
<div class="modal-dialog modal-xl">\ |
2682 |
<div class="modal-dialog modal-xl">\ |
| 2693 |
<div class="modal-content">\ |
2683 |
<div class="modal-content">\ |
| 2694 |
<div class="modal-header" style="min-height:40px;">\ |
2684 |
<div class="modal-header" style="min-height:40px;">\ |
| 2695 |
<h1 class="modal-title">' + title + '</h1>\ |
2685 |
<h1 class="modal-title">' + |
| 2696 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="' + _("Close") + '"></button>\ |
2686 |
title + |
|
|
2687 |
'</h1>\ |
| 2688 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="' + |
| 2689 |
_("Close") + |
| 2690 |
'"></button>\ |
| 2697 |
</div>\ |
2691 |
</div>\ |
| 2698 |
<div class="modal-body"><textarea id="code' + reportid + '">' + message + '</textarea>\ |
2692 |
<div class="modal-body"><textarea id="code' + |
|
|
2693 |
reportid + |
| 2694 |
'">' + |
| 2695 |
message + |
| 2696 |
'</textarea>\ |
| 2699 |
</div>\ |
2697 |
</div>\ |
| 2700 |
<div class="modal-footer">\ |
2698 |
<div class="modal-footer">\ |
| 2701 |
<a id="preview-modal-editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?id=' + reportid + '&op=edit_form"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>\ |
2699 |
<a id="preview-modal-editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?id=' + |
| 2702 |
<a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?op=duplicate&id=' + reportid + '"><i class="fa fa-copy" aria-hidden="true"></i> ' + _("Duplicate") + '</a>\ |
2700 |
reportid + |
| 2703 |
<a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=' + reportid + '"><i class="fa-solid fa-clock" aria-hidden="true"></i> ' + _("Schedule") + '</a>\ |
2701 |
'&op=edit_form"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + |
| 2704 |
<a class="btn btn-default submit-form-link" href="#" data-id="' + reportid + '" data-action="guided_reports.pl" data-method="post" data-op="cud-delete" data-confirmation-msg="' + _("Are you sure you want to delete this report?") + '"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + _("Delete") + '</a>\ |
2702 |
_("Edit") + |
| 2705 |
<a id="preview-modal-runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?id=' + reportid + '&op=run"><i class="fa fa-play" aria-hidden="true"></i> ' + _("Run report") + '</a>\ |
2703 |
'</a>\ |
| 2706 |
<a href="#" id="preview-sql-modal-cancel" data-bs-dismiss="modal" class="btn btn-default"><i class="fa fa-times" aria-hidden="true"></i> ' + _("Close") + '</a>\ |
2704 |
<a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?op=duplicate&id=' + |
|
|
2705 |
reportid + |
| 2706 |
'"><i class="fa fa-copy" aria-hidden="true"></i> ' + |
| 2707 |
_("Duplicate") + |
| 2708 |
'</a>\ |
| 2709 |
<a id="preview-modal-duplicate" class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=' + |
| 2710 |
reportid + |
| 2711 |
'"><i class="fa-solid fa-clock" aria-hidden="true"></i> ' + |
| 2712 |
_("Schedule") + |
| 2713 |
'</a>\ |
| 2714 |
<a class="btn btn-default submit-form-link" href="#" data-id="' + |
| 2715 |
reportid + |
| 2716 |
'" data-action="guided_reports.pl" data-method="post" data-op="cud-delete" data-confirmation-msg="' + |
| 2717 |
_("Are you sure you want to delete this report?") + |
| 2718 |
'"><i class="fa fa-trash-can" aria-hidden="true"></i> ' + |
| 2719 |
_("Delete") + |
| 2720 |
'</a>\ |
| 2721 |
<a id="preview-modal-runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?id=' + |
| 2722 |
reportid + |
| 2723 |
'&op=run"><i class="fa fa-play" aria-hidden="true"></i> ' + |
| 2724 |
_("Run report") + |
| 2725 |
'</a>\ |
| 2726 |
<a href="#" id="preview-sql-modal-cancel" data-bs-dismiss="modal" class="btn btn-default"><i class="fa fa-times" aria-hidden="true"></i> ' + |
| 2727 |
_("Close") + |
| 2728 |
"</a>\ |
| 2707 |
</div>\ |
2729 |
</div>\ |
| 2708 |
</div>\ |
2730 |
</div>\ |
| 2709 |
</div>\ |
2731 |
</div>\ |
| 2710 |
</div>'); |
2732 |
</div>" |
| 2711 |
|
2733 |
); |
| 2712 |
$("#preview-sql-modal").on("shown.bs.modal", function(){ |
2734 |
|
| 2713 |
CodeMirror.fromTextArea( document.getElementById("code" + reportid ), { |
2735 |
$("#preview-sql-modal") |
| 2714 |
lineNumbers: false, |
2736 |
.on("shown.bs.modal", function () { |
| 2715 |
mode: "text/x-sql", |
2737 |
CodeMirror.fromTextArea(document.getElementById("code" + reportid), { |
| 2716 |
lineWrapping: true, |
2738 |
lineNumbers: false, |
| 2717 |
readOnly: true |
2739 |
mode: "text/x-sql", |
| 2718 |
}); |
2740 |
lineWrapping: true, |
| 2719 |
}) |
2741 |
readOnly: true, |
| 2720 |
.modal('show'); |
2742 |
}); |
|
|
2743 |
}) |
| 2744 |
.modal("show"); |
| 2721 |
} |
2745 |
} |
| 2722 |
</script> |
2746 |
</script> |
| 2723 |
[% END %] |
2747 |
[% END %] |
| 2724 |
- |
|
|