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 912-917 div { Link Here
912
    background-color: #333333;
912
    background-color: #333333;
913
}
913
}
914
914
915
.library-description {
916
    & + .library-description {
917
        margin-top: .5rem;
918
    }
919
}
920
915
fieldset {
921
fieldset {
916
    &.rows {
922
    &.rows {
917
        clear: left;
923
        clear: left;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-37 / +23 lines)
Lines 1370-1379 Link Here
1370
                        <td class="location" property="seller" data-order="[% holding_library_name | html %]">
1370
                        <td class="location" property="seller" data-order="[% holding_library_name | html %]">
1371
                            <link property="itemOffered" href="#record" />
1371
                            <link property="itemOffered" href="#record" />
1372
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1372
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1373
1374
                            [% IF ( ITEM_RESULT.holding_library_info ) %]
1373
                            [% IF ( ITEM_RESULT.holding_library_info ) %]
1375
                                <a href="[% holding_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.holding_library_info | html %]" data-name="[% holding_library_name | html %]">
1374
                                <a href="[% holding_library_url | url %]" class="library_info" data-index="[% loop.index | html %]" data-name="[% holding_library_name | html %]">
1376
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %]
1375
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %][% my_library_info | html %]
1377
                                </a>
1376
                                </a>
1378
                            [% ELSIF holding_library_url %]
1377
                            [% ELSIF holding_library_url %]
1379
                                <a href="[% holding_library_url | url %]"> [% holding_library_name | html %] </a>
1378
                                <a href="[% holding_library_url | url %]"> [% holding_library_name | html %] </a>
Lines 1396-1402 Link Here
1396
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1395
                            <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut" />
1397
1396
1398
                            [% IF ( ITEM_RESULT.home_library_info ) %]
1397
                            [% IF ( ITEM_RESULT.home_library_info ) %]
1399
                                <a href="[% home_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.home_library_info | html %]" data-name="[% home_library_name | html %]">
1398
                                <a href="[% home_library_url | url %]" class="library_info" data-index="[% loop.index | html %]" data-name="[% home_library_name | html %]">
1400
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %]
1399
                                    <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %]
1401
                                </a>
1400
                                </a>
1402
                            [% ELSIF home_library_url %]
1401
                            [% ELSIF home_library_url %]
Lines 1557-1562 Link Here
1557
            [% END %]
1556
            [% END %]
1558
        </tbody>
1557
        </tbody>
1559
    </table>
1558
    </table>
1559
1560
    [% FOREACH ITEM_RESULT IN items %]
1561
        [% IF ( ITEM_RESULT.holding_library_info ) %]
1562
            <div style="display:none" id="library_info_[% loop.index | html %]">
1563
                [% FOREACH info IN ITEM_RESULT.holding_library_info %]
1564
                    <div id="library_description_[% info.additional_content_id | $raw %]" class="library-description">[% info.content | $raw %]</div>
1565
                [% END %]
1566
            </div>
1567
        [% END %]
1568
    [% END %]
1560
[% END %][%# end of items_table block %]
1569
[% END %][%# end of items_table block %]
1561
1570
1562
[% IF Koha.Preference('OpacCatalogConcerns') %]
1571
[% IF Koha.Preference('OpacCatalogConcerns') %]
Lines 2139-2179 Link Here
2139
            $(".library_info").on("click", function(e){
2148
            $(".library_info").on("click", function(e){
2140
                e.preventDefault();
2149
                e.preventDefault();
2141
                var library_name = $(this).data("name");
2150
                var library_name = $(this).data("name");
2142
                var opac_info = $(this).data("info");
2151
                var index = $(this).data("index");
2143
                var url = $(this).attr("href");
2152
                var url = $(this).attr("href");
2144
                if( 1 ) {
2153
                let library_info = $("#library_info_" + index).html();
2145
                    $("#libraryInfoModalLabel").html( library_name );
2154
                $("#libraryInfoModalLabel").html( library_name );
2146
                    $("#libraryInfo").html( opac_info );
2155
                $("#libraryInfo").html( library_info );
2147
                    if( url ){
2156
                if( url ){
2148
                        $("#libraryInfoLink").attr("href", url );
2157
                    $("#libraryInfoLink").attr("href", url );
2149
                        $("#libraryInfoLink").show();
2158
                    $("#libraryInfoLink").show();
2150
                    } else {
2159
                } else {
2151
                        $("#libraryInfoLink").hide();
2160
                    $("#libraryInfoLink").hide();
2152
                    }
2153
                    $("#libraryInfoModal").modal("show");
2154
                } else { // FIXME Temporary disabled: see BZ 29144
2155
                    $.ajax({
2156
                        url: "/api/v1/public/libraries/" + branchcode,
2157
                        type: 'GET',
2158
                        dataType: 'json',
2159
                        success: function(result) {
2160
                            $("#libraryInfoModalLabel").html( result.name );
2161
                            $("#libraryInfo").html( opac_info );
2162
                            if( result.url ){
2163
                                $("#libraryInfoLink").attr("href", result.url );
2164
                                $("#libraryInfoLink").show();
2165
                            } else {
2166
                                $("#libraryInfoLink").hide();
2167
                            }
2168
                            $("#libraryInfoModal").modal("show");
2169
                        },
2170
                        error: function(xhr, status, error) {
2171
                            if( url ){
2172
                                location.href = url;
2173
                            }
2174
                        }
2175
                    });
2176
                }
2161
                }
2162
                $("#libraryInfoModal").modal("show");
2177
            });
2163
            });
2178
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2164
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2179
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2165
                $("#libraryInfoModalLabel, #libraryInfo").html("");
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt (-1 / +5 lines)
Lines 41-47 Link Here
41
[% INCLUDE 'masthead.inc' %]
41
[% INCLUDE 'masthead.inc' %]
42
42
43
[% BLOCK library_description %]
43
[% BLOCK library_description %]
44
    <div property="description"> [% IF OpacLibraryInfo %][% OpacLibraryInfo.content | $raw %][% END %] </div>
44
    <div property="description">
45
        [% FOREACH info IN OpacLibraryInfo %]
46
            <div id="library_description_[% info.additional_content_id | $raw %]" class="library-description">[% info.content | $raw %]</div>
47
        [% END %]
48
    </div>
45
[% END %]
49
[% END %]
46
50
47
[% BLOCK library_info %]
51
[% BLOCK library_info %]
(-)a/opac/opac-detail.pl (-3 / +2 lines)
Lines 741-748 if ( not $viewallitems and $items->count > $max_items_to_display ) { Link Here
741
        $library_info->{ $item->holdingbranch } = $opac_info_holding;
741
        $library_info->{ $item->holdingbranch } = $opac_info_holding;
742
        $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } );
742
        $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } );
743
        $library_info->{ $item->homebranch } = $opac_info_home;
743
        $library_info->{ $item->homebranch } = $opac_info_home;
744
        $item_info->{holding_library_info}   = $opac_info_holding->content if $opac_info_holding;
744
        $item_info->{holding_library_info}   = $opac_info_holding if $opac_info_holding;
745
        $item_info->{home_library_info}      = $opac_info_home->content    if $opac_info_home;
745
        $item_info->{home_library_info}      = $opac_info_home    if $opac_info_home;
746
746
747
        # We only need to check if we haven't determined holds can be placed
747
        # We only need to check if we haven't determined holds can be placed
748
        # and if we don't have patron, we have already decided
748
        # and if we don't have patron, we have already decided
749
- 

Return to bug 39482