View | Details | Raw Unified | Return to bug 41582
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-98 / +119 lines)
Lines 1650-1665 Link Here
1650
    [% IF OpenLibraryCovers || OpenLibrarySearch %]
1650
    [% IF OpenLibraryCovers || OpenLibrarySearch %]
1651
        [% Asset.js("js/openlibrary.js") | $raw %]
1651
        [% Asset.js("js/openlibrary.js") | $raw %]
1652
    [% END %]
1652
    [% END %]
1653
    <script>
1654
        const interface = "[% interface | html %]";
1655
        addPrefs({
1656
            OpacHighlightedWords: "[% Koha.Preference('OpacHighlightedWords') | html %]",
1657
            NotHighlightedWords: "[% Koha.Preference('NotHighlightedWords') | html %]",
1658
            GoogleJackets: [% Koha.Preference('GoogleJackets') ? 1 : 0 | html %],
1659
            OpacCoce: [% Koha.Preference('OpacCoce') ? 1 : 0 | html %],
1660
            CoceHost: "[% Koha.Preference('CoceHost') | html %]",
1661
            CoceProviders: "[% Koha.Preference('CoceProviders') | html %]",
1662
            OpenLibraryCovers: [% Koha.Preference('OpenLibraryCovers') ? 1 : 0 | html %],
1663
            OPACLocalCoverImages: [% Koha.Preference('OPACLocalCoverImages') ? 1 : 0 | html %],
1664
            OPACPopupAuthorsSearch: [% Koha.Preference('OPACPopupAuthorsSearch') ? 1 : 0 | html %],
1665
            OPACDetailQRCode: [% Koha.Preference('OPACDetailQRCode') ? 1 : 0 | html %],
1666
            OpacBrowseResults: [% Koha.Preference('OpacBrowseResults') ? 1 : 0 | html %],
1667
            TagsInputEnabled: [% Koha.Preference('TagsInputEnabled') ? 1 : 0 | html %],
1668
            OPACURLOpenInNewWindow: [% Koha.Preference('OPACURLOpenInNewWindow') ? 1 : 0 | html %],
1669
            OPACShelfBrowser: [% Koha.Preference('OPACShelfBrowser') ? 1 : 0 | html %],
1670
        });
1671
        const busc = "[% busc | html %]";
1672
        const query_desc = "[% query_desc | html %]";
1673
        const loggedinusername = "[% loggedinusername | html %]";
1674
1675
        var holdingst_table_settings = [% TablesSettings.GetTableSettings( 'opac', 'biblio-detail', 'holdingst', 'json' ) | $raw %];
1676
        [% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]
1677
            // The default in the yaml file is 1 "Item type".
1678
            // If item-level_itypes is off the column will not appear, then select column 2 "Current library"
1679
            if (holdingst_table_settings.default_sort_order == 1) {
1680
                holdingst_table_settings.default_sort_order = 2;
1681
            }
1682
        [% END %]
1683
        var otherholdingst_table_settings = JSON.parse(JSON.stringify(holdingst_table_settings)); // Clone
1684
1685
        let column;
1686
        [% FOR k IN hidden_columns_force.holdingst %]
1687
            column = holdingst_table_settings.columns.find(c => c.columnname == '[% k | html %]');
1688
            column.is_hidden = 1;
1689
            column.cannot_be_toggled = 1;
1690
        [% END %]
1691
1692
        [% FOR k IN hidden_columns_force.otherholdingst %]
1693
            column = otherholdingst_table_settings.columns.find(c => c.columnname == '[% k | html %]');
1694
            column.is_hidden = 1;
1695
            column.cannot_be_toggled = 1;
1696
        [% END %]
1697
1698
        var serial_table_settings = [% TablesSettings.GetTableSettings( 'opac', 'biblio-detail', 'subscriptionst', 'json' ) | $raw %];
1699
1700
        const defaulttab = "[% defaulttab | html %]";
1701
    </script>
1702
1653
    <script>
1703
    <script>
1654
        window.emojiPicker = new EmojiPicker({
1704
        window.emojiPicker = new EmojiPicker({
1655
        emojiable_selector: '[data-emojiable=true]',
1705
        emojiable_selector: '[data-emojiable=true]',
1656
        assetsPath: '[% interface | html %]/lib/emoji-picker/img/',
1706
        assetsPath: `${interface}/lib/emoji-picker/img/`,
1657
        popupButtonClasses: 'fa-solid fa-face-smile'
1707
        popupButtonClasses: 'fa-solid fa-face-smile'
1658
        });
1708
        });
1659
        window.emojiPicker.discover();
1709
        window.emojiPicker.discover();
1660
1710
1661
        var OPACPopupAuthorsSearch = "[% Koha.Preference('OPACPopupAuthorsSearch') | html %]";
1711
        if (prefs.OpacHighlightedWords){
1662
        [% IF ( OpacHighlightedWords ) %]
1663
            var q_array = new Array();  // holds search terms if available
1712
            var q_array = new Array();  // holds search terms if available
1664
1713
1665
            function highlightOff() {
1714
            function highlightOff() {
Lines 1672-1678 Link Here
1672
                    if ( q_array[x].length > 0 ) {
1721
                    if ( q_array[x].length > 0 ) {
1673
                        q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
1722
                        q_array[x] = q_array[x].replace(/\w*:([\w])/, "$1");
1674
                        q_array[x] = q_array[x].toLowerCase();
1723
                        q_array[x] = q_array[x].toLowerCase();
1675
                        var myStopwords = "[% Koha.Preference('NotHighlightedWords') | html %]".toLowerCase().split('|');
1724
                        var myStopwords = prefs.NotHighlightedWords.toLowerCase().split('|');
1676
                        if( $.inArray(q_array[x], myStopwords) == -1 ) {
1725
                        if( $.inArray(q_array[x], myStopwords) == -1 ) {
1677
                            $("#marcnotes").highlight(q_array[x]);
1726
                            $("#marcnotes").highlight(q_array[x]);
1678
                            $(".title").highlight(q_array[x]);
1727
                            $(".title").highlight(q_array[x]);
Lines 1683-1689 Link Here
1683
                }
1732
                }
1684
                $(".highlight_toggle").toggle();
1733
                $(".highlight_toggle").toggle();
1685
            }
1734
            }
1686
        [% END # /IF OpacHighlightedWords %]
1735
        }
1687
1736
1688
        function verify_cover_images() {
1737
        function verify_cover_images() {
1689
            // Loop over each container in the template which contains covers
1738
            // Loop over each container in the template which contains covers
Lines 1825-1847 Link Here
1825
            var loaded = 1;
1874
            var loaded = 1;
1826
            counter_wait++;
1875
            counter_wait++;
1827
1876
1828
            [% IF GoogleJackets %]
1877
            if (prefs.GoogleJackets){
1829
                if ( loaded ) {
1878
                if ( loaded ) {
1830
                    loaded = KOHA.Google.done;
1879
                    loaded = KOHA.Google.done;
1831
                }
1880
                }
1832
            [% END %]
1881
            }
1833
1882
1834
            [% IF OpenLibraryCovers %]
1883
            if (prefs.OpenLibraryCovers){
1835
                if ( loaded ) {
1884
                if ( loaded ) {
1836
                    loaded = KOHA.OpenLibrary.done;
1885
                    loaded = KOHA.OpenLibrary.done;
1837
                }
1886
                }
1838
            [% END %]
1887
            }
1839
1888
1840
            [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
1889
            if (prefs.OpacCoce && prefs.CoceProviders){
1841
                if ( loaded ) {
1890
                if ( loaded ) {
1842
                    loaded = KOHA.coce.done;
1891
                    loaded = KOHA.coce.done;
1843
                }
1892
                }
1844
            [% END %]
1893
            }
1845
1894
1846
            if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds
1895
            if (!loaded && counter_wait < 50) {// Do not wait more than 5 seconds
1847
                window.setTimeout(function(){wait_for_images(cb);}, 100);
1896
                window.setTimeout(function(){wait_for_images(cb);}, 100);
Lines 1859-1865 Link Here
1859
1908
1860
        $(document).ready(function() {
1909
        $(document).ready(function() {
1861
1910
1862
            [% IF ( Koha.Preference('OPACDetailQRCode') ) %]
1911
            if (prefs.OPACDetailQRCode){
1863
1912
1864
                var link_canonical = document.querySelector("link[rel=canonical]");
1913
                var link_canonical = document.querySelector("link[rel=canonical]");
1865
1914
Lines 1883-1906 Link Here
1883
                        qrcodeImg.addClass("d-none");
1932
                        qrcodeImg.addClass("d-none");
1884
                    }
1933
                    }
1885
                });
1934
                });
1886
            [% END # /IF OPACDetailQRCode %]
1935
            }
1887
1936
1888
            [% SWITCH defaulttab -%]
1937
            switch (defaulttab){
1889
            [%   CASE 'holdings' -%]
1938
                case 'holdings':
1890
                showBsTab("bibliodescriptions", "holdings");
1939
                case 'descriptions':
1891
            [%   CASE 'components' -%]
1940
                case 'subscriptions':
1892
                showBsTab("bibliodescriptions", "components");
1941
                case 'serialcollection':
1893
            [%   CASE 'descriptions' -%]
1942
                    showBsTab("bibliodescriptions", defaulttab);
1894
                showBsTab("bibliodescriptions", "descriptions");
1943
                    break
1895
            [%   CASE 'subscriptions' -%]
1944
                case 'media'
1896
                showBsTab("bibliodescriptions", "subscriptions");
1945
                    showBsTab("bibliodescriptions", "html5media");
1897
            [%   CASE 'serialcollection' -%]
1946
                    break
1898
                showBsTab("bibliodescriptions", "serialcollection");
1947
                case:
1899
            [%   CASE 'media' -%]
1948
                    showBsTab("bibliodescriptions", "holdings");
1900
                showBsTab("bibliodescriptions", "html5media");
1949
            }
1901
            [%   CASE  -%]
1902
                showBsTab("bibliodescriptions", "holdings");
1903
            [% END -%]
1904
1950
1905
            let urlParams = new URLSearchParams(window.location.search);
1951
            let urlParams = new URLSearchParams(window.location.search);
1906
            if ( urlParams.has('tab') ) {
1952
            if ( urlParams.has('tab') ) {
Lines 1910-1916 Link Here
1910
                }
1956
                }
1911
            }
1957
            }
1912
1958
1913
            [% IF ( Koha.Preference('OpacBrowseResults') && busc ) %]
1959
            if (prefs.OpacBrowseResults && busc){
1914
                $(".l_Results").show();
1960
                $(".l_Results").show();
1915
                $("#a_listResults").on("click", function(e){
1961
                $("#a_listResults").on("click", function(e){
1916
                    e.preventDefault();
1962
                    e.preventDefault();
Lines 1921-1950 Link Here
1921
                    e.preventDefault();
1967
                    e.preventDefault();
1922
                    $(".results-pagination, .close_pagination, .pg_menu").toggle();
1968
                    $(".results-pagination, .close_pagination, .pg_menu").toggle();
1923
                });
1969
                });
1924
            [% END # /IF OpacBrowseResults %]
1970
            }
1925
1926
            var holdingst_table_settings = [% TablesSettings.GetTableSettings( 'opac', 'biblio-detail', 'holdingst', 'json' ) | $raw %];
1927
            [% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]
1928
                // The default in the yaml file is 1 "Item type".
1929
                // If item-level_itypes is off the column will not appear, then select column 2 "Current library"
1930
                if (holdingst_table_settings.default_sort_order == 1) {
1931
                    holdingst_table_settings.default_sort_order = 2;
1932
                }
1933
            [% END %]
1934
            var otherholdingst_table_settings = JSON.parse(JSON.stringify(holdingst_table_settings)); // Clone
1935
1936
            let column;
1937
            [% FOR k IN hidden_columns_force.holdingst %]
1938
                column = holdingst_table_settings.columns.find(c => c.columnname == '[% k | html %]');
1939
                column.is_hidden = 1;
1940
                column.cannot_be_toggled = 1;
1941
            [% END %]
1942
1943
            [% FOR k IN hidden_columns_force.otherholdingst %]
1944
                column = otherholdingst_table_settings.columns.find(c => c.columnname == '[% k | html %]');
1945
                column.is_hidden = 1;
1946
                column.cannot_be_toggled = 1;
1947
            [% END %]
1948
1971
1949
            $("#holdingst").kohaTable(
1972
            $("#holdingst").kohaTable(
1950
                {
1973
                {
Lines 1967-1974 Link Here
1967
                otherholdingst_table_settings,
1990
                otherholdingst_table_settings,
1968
            );
1991
            );
1969
1992
1970
            var serial_table_settings = [% TablesSettings.GetTableSettings( 'opac', 'biblio-detail', 'subscriptionst', 'json' ) | $raw %];
1971
1972
            $(".subscriptionst").kohaTable(
1993
            $(".subscriptionst").kohaTable(
1973
                {
1994
                {
1974
                    dom: '<"clearfix">t',
1995
                    dom: '<"clearfix">t',
Lines 1986-1992 Link Here
1986
                dTables.DataTable().responsive.recalc();
2007
                dTables.DataTable().responsive.recalc();
1987
            } );
2008
            } );
1988
2009
1989
            [% IF ( TagsInputEnabled && loggedinusername ) %]
2010
            if (prefs.TagsInputEnabled && loggedinusername){
1990
                    $(".tag_add").click(function(){
2011
                    $(".tag_add").click(function(){
1991
                        var thisid = $(this).attr("id");
2012
                        var thisid = $(this).attr("id");
1992
                        thisid = thisid.replace("tag_add","");
2013
                        thisid = thisid.replace("tag_add","");
Lines 2015-2044 Link Here
2015
                        KOHA.Tags.add_tag_button(thisid, tag);
2036
                        KOHA.Tags.add_tag_button(thisid, tag);
2016
                        return false;
2037
                        return false;
2017
                    });
2038
                    });
2018
            [% END %]
2039
            }
2019
2040
2020
            [% IF ( query_desc ) %]
2041
            if (query_desc){
2021
                [% IF ( OpacHighlightedWords ) %]
2042
                if (prefs.OpacHighlightedWords){
2022
                    var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
2043
                    var query_desc_replaced = query_desc.replace("'", "\'").replace('\n', '\\n').replace('\r', '\\r');
2023
                    q_array = query_desc.split(" ");
2044
                    q_array = query_desc_replaced.split(" ");
2024
                    q_array = q_array.filter(function(n){ return n }); // Remove empty strings
2045
                    q_array = q_array.filter(function(n){ return n }); // Remove empty strings
2025
                    highlightOn();
2046
                    highlightOn();
2026
                    $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ; return false;});
2047
                    $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ; return false;});
2027
                    $("#highlight_toggle_off").show().click(function() {highlightOff(); return false;});
2048
                    $("#highlight_toggle_off").show().click(function() {highlightOff(); return false;});
2028
                [% END %]
2049
                }
2029
            [% END %]
2050
            }
2030
2051
2031
            [% IF ( GoogleJackets ) %]
2052
            if (prefs.GoogleJackets){
2032
                KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]);
2053
                KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2033
            [% END %]
2054
            }
2034
2055
2035
            [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
2056
            if (prefs.OpacCoce && prefs.CoceProviders){
2036
                KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $('#biblio-cover-slider') );
2057
                KOHA.coce.getURL(prefs.CoceHost, prefs_CoceProviders, $('#biblio-cover-slider') );
2037
            [% END %]
2058
            }
2038
2059
2039
            [% IF OpenLibraryCovers %]
2060
            if (prefs.OpenLibraryCovers){
2040
                KOHA.OpenLibrary.GetCoverFromIsbn();
2061
                KOHA.OpenLibrary.GetCoverFromIsbn();
2041
            [% END %]
2062
            }
2042
2063
2043
            [% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %]
2064
            [% IF ( NovelistSelectProfile && ( normalized_isbn || normalized_upc ) ) %]
2044
                novSelect.loadContentForQuery(
2065
                novSelect.loadContentForQuery(
Lines 2056-2062 Link Here
2056
                    });
2077
                    });
2057
            [% END %]
2078
            [% END %]
2058
2079
2059
            [% IF ( OPACShelfBrowser ) %]
2080
            if (prefs.OPACShelfBrowser){
2060
                // Focus on shelf browser if present
2081
                // Focus on shelf browser if present
2061
                var shelfbrowser = $("#shelfbrowser");
2082
                var shelfbrowser = $("#shelfbrowser");
2062
                if (shelfbrowser.length > 0) {
2083
                if (shelfbrowser.length > 0) {
Lines 2082-2099 Link Here
2082
                            },
2103
                            },
2083
                            success: function(data){
2104
                            success: function(data){
2084
                                $("#shelfbrowser").replaceWith(data);
2105
                                $("#shelfbrowser").replaceWith(data);
2085
                                [% IF ( GoogleJackets ) %]
2106
                                if (prefs.GoogleJackets){
2086
                                    KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]);
2107
                                    KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2087
                                [% END %]
2108
                                }
2088
                                [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
2109
                                if (prefs.OpacCoce && prefs.CoceProviders){
2089
                                    KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $("#bibliodescriptions"));
2110
                                    KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#bibliodescriptions"));
2090
                                [% END %]
2111
                                }
2091
                                [% IF OpenLibraryCovers %]
2112
                                if (prefs.OpenLibraryCovers){
2092
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2113
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2093
                                [% END %]
2114
                                }
2094
                                [% IF OPACLocalCoverImages %]
2115
                                if (OPACLocalCoverImages){
2095
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2116
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2096
                                [% END %]
2117
                                }
2097
                            }
2118
                            }
2098
                        });
2119
                        });
2099
                    });
2120
                    });
Lines 2107-2129 Link Here
2107
                            },
2128
                            },
2108
                            success: function(data){
2129
                            success: function(data){
2109
                                $("#shelfbrowser").replaceWith(data);
2130
                                $("#shelfbrowser").replaceWith(data);
2110
                                [% IF ( GoogleJackets ) %]
2131
                                if (prefs.GoogleJackets){
2111
                                    KOHA.Google.GetCoverFromIsbn([% covernewwindow | html %]);
2132
                                    KOHA.Google.GetCoverFromIsbn(prefs.OPACURLOpenInNewWindow);
2112
                                [% END %]
2133
                                }
2113
                                [% IF ( Koha.Preference('OpacCoce') && Koha.Preference('CoceProviders') ) %]
2134
                                if (prefs.OpacCoce && prefs.CoceProviders){
2114
                                    KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]', $("#bibliodescriptions"));
2135
                                    KOHA.coce.getURL(prefs.CoceHost, prefs.CoceProviders, $("#bibliodescriptions"));
2115
                                [% END %]
2136
                                }
2116
                                [% IF OpenLibraryCovers %]
2137
                                if (prefs.OpenLibraryCovers){
2117
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2138
                                    KOHA.OpenLibrary.GetCoverFromIsbn();
2118
                                [% END %]
2139
                                }
2119
                                [% IF OPACLocalCoverImages %]
2140
                                if (prefs.OPACLocalCoverImages){
2120
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2141
                                    KOHA.LocalCover.GetCoverFromBibnumber(true);
2121
                                [% END %]
2142
                                }
2122
                            }
2143
                            }
2123
                        });
2144
                        });
2124
                    });
2145
                    });
2125
                }());
2146
            }());
2126
            [% END # /IF ( OPACShelfBrowser ) %]
2147
        }
2127
2148
2128
            $(".edit_comment").on("click", function(e){
2149
            $(".edit_comment").on("click", function(e){
2129
                e.preventDefault();
2150
                e.preventDefault();
Lines 2132-2138 Link Here
2132
        });
2153
        });
2133
2154
2134
        $(document).ready(function() {
2155
        $(document).ready(function() {
2135
            if( OPACPopupAuthorsSearch == "1" ){
2156
            if( prefs.OPACPopupAuthorsSearch ){
2136
                var terms = {
2157
                var terms = {
2137
                    contributors : {
2158
                    contributors : {
2138
                        "label" : "author",
2159
                        "label" : "author",
Lines 2194-2200 Link Here
2194
                    e.preventDefault();
2215
                    e.preventDefault();
2195
                    multiSearchRequest();
2216
                    multiSearchRequest();
2196
                });
2217
                });
2197
            } /* if( OPACPopupAuthorsSearch == "1" ) */
2218
            }
2198
2219
2199
            $(".library_info").on("click", function(e){
2220
            $(".library_info").on("click", function(e){
2200
                e.preventDefault();
2221
                e.preventDefault();
(-)a/opac/opac-detail.pl (-10 lines)
Lines 1180-1194 if ( C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pre Link Here
1180
    );
1180
    );
1181
}
1181
}
1182
1182
1183
if ( C4::Context->preference("OPACURLOpenInNewWindow") ) {
1184
1185
    # These values are going to be read by Javascript, at least in the case
1186
    # of the google covers
1187
    $template->param( covernewwindow => 'true' );
1188
} else {
1189
    $template->param( covernewwindow => 'false' );
1190
}
1191
1192
$template->param( borrowernumber => $borrowernumber );
1183
$template->param( borrowernumber => $borrowernumber );
1193
1184
1194
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
1185
if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) {
1195
- 

Return to bug 41582