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

(-)a/Koha/Library.pm (-2 / +2 lines)
Lines 377-383 sub to_api_mapping { Link Here
377
377
378
    $library->opac_info({ lang => $lang });
378
    $library->opac_info({ lang => $lang });
379
379
380
Returns additional contents block OpacLibraryInfo for $lang or 'default'.
380
Returns all additional contents blocks OpacLibraryInfo by library and $lang (or 'default').
381
381
382
Note: This replaces the former branches.opac_info column.
382
Note: This replaces the former branches.opac_info column.
383
383
Lines 385-391 Note: This replaces the former branches.opac_info column. Link Here
385
385
386
sub opac_info {
386
sub opac_info {
387
    my ( $self, $params ) = @_;
387
    my ( $self, $params ) = @_;
388
    return Koha::AdditionalContents->find_best_match(
388
    return Koha::AdditionalContents->search_for_display(
389
        {
389
        {
390
            category   => 'html_customizations',
390
            category   => 'html_customizations',
391
            location   => 'OpacLibraryInfo',
391
            location   => 'OpacLibraryInfo',
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-4 / +42 lines)
Lines 29-34 Link Here
29
[% INCLUDE 'doc-head-close.inc' %]
29
[% INCLUDE 'doc-head-close.inc' %]
30
[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
30
[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
31
[% Asset.css("lib/codemirror/lint.min.css") | $raw %]
31
[% Asset.css("lib/codemirror/lint.min.css") | $raw %]
32
[% FILTER collapse %]
33
    <style>
34
        .opac-library-info {
35
            border: 1px solid #dedede;
36
            border-radius: 2px;
37
            padding: 0.375rem 0.75rem;
38
        }
39
        .opac-library-info + .opac-library-info {
40
            margin-top: 0.5rem;
41
        }
42
    </style>
43
[% END %]
32
</head>
44
</head>
33
45
34
<body id="admin_branches" class="admin">
46
<body id="admin_branches" class="admin">
Lines 330-339 Link Here
330
                    <div class="fg-input">
342
                    <div class="fg-input">
331
                        [% IF OpacLibraryInfo %]
343
                        [% IF OpacLibraryInfo %]
332
                            <!-- opac_info -->
344
                            <!-- opac_info -->
333
                            <div>[% OpacLibraryInfo.content | $raw %]</div>
345
                            [% FOREACH info IN OpacLibraryInfo %]
334
                            <a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&id=[% OpacLibraryInfo.id | $raw %]&editmode=wysiwyg" target="_blank">Edit HTML content</a>
346
                                [% IF library.branchcode == info.branchcode %]
347
                                    <div id="opac_library_info_[% info.additional_content_id | $raw %]" class="opac-library-info">[% info.content | $raw %]</div>
348
                                    [% IF ( CAN_user_tools_edit_additional_contents ) %]
349
                                        <a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&id=[% info.additional_content_id | $raw %]&editmode=wysiwyg" target="_blank">
350
                                            <i class="fa fa-pencil"></i> Edit HTML content
351
                                        </a>
352
                                    [% END %]
353
                                [% END %]
354
                            [% END %]
335
                        [% ELSE %]
355
                        [% ELSE %]
336
                            <a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&editmode=wysiwyg" target="_blank">Add HTML content</a>
356
                            [% IF ( CAN_user_tools_edit_additional_contents ) %]
357
                                <a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&editmode=wysiwyg" target="_blank"> <i class="fa fa-plus"></i> Add HTML content </a>
358
                            [% END %]
337
                        [% END %]
359
                        [% END %]
338
                    </div>
360
                    </div>
339
                </div>
361
                </div>
Lines 741-747 Link Here
741
            <div class="row page-section">
763
            <div class="row page-section">
742
                <div class="col-sm-12">
764
                <div class="col-sm-12">
743
                    <h2>OPAC information</h2>
765
                    <h2>OPAC information</h2>
744
                    <div>[% OpacLibraryInfo.content | $raw %]</div>
766
                    [% IF OpacLibraryInfo %]
767
                        <!-- opac_info -->
768
                        [% FOREACH info IN OpacLibraryInfo %]
769
                            [% IF library.branchcode == info.branchcode %]
770
                                <div id="opac_library_info_[% info.additional_content_id | $raw %]" class="opac-library-info">[% info.content | $raw %]</div>
771
                                [% IF ( CAN_user_tools_edit_additional_contents ) %]
772
                                    <a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&id=[% info.additional_content_id | $raw %]&editmode=wysiwyg" target="_blank">
773
                                        <i class="fa fa-pencil"></i> Edit HTML content
774
                                    </a>
775
                                [% END %]
776
                            [% END %]
777
                        [% END %]
778
                    [% ELSE %]
779
                        [% IF ( CAN_user_tools_edit_additional_contents ) %]
780
                            <a class="btn btn-link" href="/cgi-bin/koha/tools/additional-contents.pl?category=html_customizations&op=add_form&editmode=wysiwyg" target="_blank"> <i class="fa fa-plus"></i> Add HTML content </a>
781
                        [% END %]
782
                    [% END %]
745
                </div>
783
                </div>
746
            </div>
784
            </div>
747
        [% END %]
785
        [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/css/src/opac.scss (+6 lines)
Lines 907-912 div { Link Here
907
    background-color: #333333;
907
    background-color: #333333;
908
}
908
}
909
909
910
.library-description {
911
    & + .library-description {
912
        margin-top: .5rem;
913
    }
914
}
915
910
fieldset {
916
fieldset {
911
    &.rows {
917
    &.rows {
912
        clear: left;
918
        clear: left;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-37 / +23 lines)
Lines 1360-1369 Link Here
1360
                        <td class="location" property="seller" data-order="[% holding_library_name | html %]">
1360
                        <td class="location" property="seller" data-order="[% holding_library_name | html %]">
1361
                            <link property="itemOffered" href="#record" />
1361
                            <link property="itemOffered" href="#record" />
1362
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1362
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1363
1364
                            [% IF ( ITEM_RESULT.holding_library_info ) %]
1363
                            [% IF ( ITEM_RESULT.holding_library_info ) %]
1365
                                <a href="[% holding_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.holding_library_info | html %]" data-name="[% holding_library_name | html %]">
1364
                                <a href="[% holding_library_url | url %]" class="library_info" data-index="[% loop.index | html %]" data-name="[% holding_library_name | html %]">
1366
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %]
1365
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %][% my_library_info | html %]
1367
                                </a>
1366
                                </a>
1368
                            [% ELSIF holding_library_url %]
1367
                            [% ELSIF holding_library_url %]
1369
                                <a href="[% holding_library_url | url %]"> [% holding_library_name | html %] </a>
1368
                                <a href="[% holding_library_url | url %]"> [% holding_library_name | html %] </a>
Lines 1389-1395 Link Here
1389
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1388
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1390
1389
1391
                            [% IF ( ITEM_RESULT.home_library_info ) %]
1390
                            [% IF ( ITEM_RESULT.home_library_info ) %]
1392
                                <a href="[% home_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.home_library_info | html %]" data-name="[% home_library_name | html %]">
1391
                                <a href="[% home_library_url | url %]" class="library_info" data-index="[% loop.index | html %]" data-name="[% home_library_name | html %]">
1393
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %]
1392
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %]
1394
                                </a>
1393
                                </a>
1395
                            [% ELSIF home_library_url %]
1394
                            [% ELSIF home_library_url %]
Lines 1604-1609 Link Here
1604
            [% END %]
1603
            [% END %]
1605
        </tbody>
1604
        </tbody>
1606
    </table>
1605
    </table>
1606
1607
    [% FOREACH ITEM_RESULT IN items %]
1608
        [% IF ( ITEM_RESULT.holding_library_info ) %]
1609
            <div style="display:none" id="library_info_[% loop.index | html %]">
1610
                [% FOREACH info IN ITEM_RESULT.holding_library_info %]
1611
                    <div id="library_description_[% info.additional_content_id | $raw %]" class="library-description">[% info.content | $raw %]</div>
1612
                [% END %]
1613
            </div>
1614
        [% END %]
1615
    [% END %]
1607
[% END %][%# end of items_table block %]
1616
[% END %][%# end of items_table block %]
1608
1617
1609
[% IF Koha.Preference('OpacCatalogConcerns') %]
1618
[% IF Koha.Preference('OpacCatalogConcerns') %]
Lines 2189-2229 Link Here
2189
            $(".library_info").on("click", function(e){
2198
            $(".library_info").on("click", function(e){
2190
                e.preventDefault();
2199
                e.preventDefault();
2191
                var library_name = $(this).data("name");
2200
                var library_name = $(this).data("name");
2192
                var opac_info = $(this).data("info");
2201
                var index = $(this).data("index");
2193
                var url = $(this).attr("href");
2202
                var url = $(this).attr("href");
2194
                if( 1 ) {
2203
                let library_info = $("#library_info_" + index).html();
2195
                    $("#libraryInfoModalLabel").html( library_name );
2204
                $("#libraryInfoModalLabel").html( library_name );
2196
                    $("#libraryInfo").html( opac_info );
2205
                $("#libraryInfo").html( library_info );
2197
                    if( url ){
2206
                if( url ){
2198
                        $("#libraryInfoLink").attr("href", url );
2207
                    $("#libraryInfoLink").attr("href", url );
2199
                        $("#libraryInfoLink").show();
2208
                    $("#libraryInfoLink").show();
2200
                    } else {
2209
                } else {
2201
                        $("#libraryInfoLink").hide();
2210
                    $("#libraryInfoLink").hide();
2202
                    }
2203
                    $("#libraryInfoModal").modal("show");
2204
                } else { // FIXME Temporary disabled: see BZ 29144
2205
                    $.ajax({
2206
                        url: "/api/v1/public/libraries/" + branchcode,
2207
                        type: 'GET',
2208
                        dataType: 'json',
2209
                        success: function(result) {
2210
                            $("#libraryInfoModalLabel").html( result.name );
2211
                            $("#libraryInfo").html( opac_info );
2212
                            if( result.url ){
2213
                                $("#libraryInfoLink").attr("href", result.url );
2214
                                $("#libraryInfoLink").show();
2215
                            } else {
2216
                                $("#libraryInfoLink").hide();
2217
                            }
2218
                            $("#libraryInfoModal").modal("show");
2219
                        },
2220
                        error: function(xhr, status, error) {
2221
                            if( url ){
2222
                                location.href = url;
2223
                            }
2224
                        }
2225
                    });
2226
                }
2211
                }
2212
                $("#libraryInfoModal").modal("show");
2227
            });
2213
            });
2228
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2214
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2229
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2215
                $("#libraryInfoModalLabel, #libraryInfo").html("");
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt (-1 / +5 lines)
Lines 36-42 Link Here
36
[% INCLUDE 'masthead.inc' %]
36
[% INCLUDE 'masthead.inc' %]
37
37
38
[% BLOCK library_description %]
38
[% BLOCK library_description %]
39
    <div property="description"> [% IF OpacLibraryInfo %][% OpacLibraryInfo.content | $raw %][% END %] </div>
39
    <div property="description">
40
        [% FOREACH info IN OpacLibraryInfo %]
41
            <div id="library_description_[% info.additional_content_id | $raw %]" class="library-description">[% info.content | $raw %]</div>
42
        [% END %]
43
    </div>
40
[% END %]
44
[% END %]
41
45
42
[% BLOCK library_info %]
46
[% BLOCK library_info %]
(-)a/opac/opac-detail.pl (-3 / +2 lines)
Lines 718-725 if ( not $viewallitems and $items->count > $max_items_to_display ) { Link Here
718
        $library_info->{ $item->holdingbranch } = $opac_info_holding;
718
        $library_info->{ $item->holdingbranch } = $opac_info_holding;
719
        $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } );
719
        $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } );
720
        $library_info->{ $item->homebranch } = $opac_info_home;
720
        $library_info->{ $item->homebranch } = $opac_info_home;
721
        $item_info->{holding_library_info}   = $opac_info_holding->content if $opac_info_holding;
721
        $item_info->{holding_library_info}   = $opac_info_holding if $opac_info_holding;
722
        $item_info->{home_library_info}      = $opac_info_home->content    if $opac_info_home;
722
        $item_info->{home_library_info}      = $opac_info_home    if $opac_info_home;
723
723
724
        # We only need to check if we haven't determined holds can be placed
724
        # We only need to check if we haven't determined holds can be placed
725
        # and if we don't have patron, we have already decided
725
        # and if we don't have patron, we have already decided
726
- 

Return to bug 39482