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

(-)a/installer/data/mysql/atomicupdate/bug_37221.pl (+31 lines)
Line 0 Link Here
1
use Modern::Perl;
2
use Koha::Installer::Output qw(say_warning say_failure say_success say_info);
3
4
return {
5
    bug_number  => "37221",
6
    description => "Add new system preference OPACOverDrive",
7
    up          => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        my $count_sql =
12
            q{SELECT count( value ) AS count FROM systempreferences WHERE variable IN ('OverDriveLibraryID', 'OverDriveClientKey', 'OverDriveClientSecret') AND value IS NOT NULL AND value != ''};
13
        my ($count) = $dbh->selectrow_array($count_sql);
14
        my $enabled =
15
            $count == 3 ? 1 : 0;    # If all 3 preferences are enabled OverDrive content has been previously enabled
16
17
        my $sth = $dbh->prepare(
18
            q{
19
            INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
20
            VALUES ('OPACOverDrive', ?, 'Enable OverDrive integration in the OPAC', '', 'YesNo')
21
        }
22
        );
23
        $sth->execute($enabled);
24
25
        if ($enabled) {
26
            say_success( $out, "Added and enabled new system preference 'OPACOverDrive'" );
27
        } else {
28
            say_success( $out, "Added new system preference 'OPACOverDrive'" );
29
        }
30
    },
31
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+1 lines)
Lines 526-531 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
526
('OPACnumSearchResults','20',NULL,'Specify the maximum number of results to display on a page of results','Integer'),
526
('OPACnumSearchResults','20',NULL,'Specify the maximum number of results to display on a page of results','Integer'),
527
('OPACnumSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in OPAC search results','YesNo'),
527
('OPACnumSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in OPAC search results','YesNo'),
528
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
528
('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'),
529
('OPACOverDrive','0',NULL,'Enable OverDrive integration in the OPAC','YesNo'),
529
('OpacPasswordChange','1',NULL,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)','YesNo'),
530
('OpacPasswordChange','1',NULL,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)','YesNo'),
530
('OPACPatronDetails','1','','If OFF the patron details tab in the OPAC is disabled.','YesNo'),
531
('OPACPatronDetails','1','','If OFF the patron details tab in the OPAC is disabled.','YesNo'),
531
('OPACpatronimages','0',NULL,'Enable patron images in the OPAC','YesNo'),
532
('OPACpatronimages','0',NULL,'Enable patron images in the OPAC','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+6 lines)
Lines 339-344 Enhanced content: Link Here
339
                  0: "Don't embed"
339
                  0: "Don't embed"
340
            - YouTube links as videos.
340
            - YouTube links as videos.
341
    OverDrive:
341
    OverDrive:
342
        -
343
            - pref: OPACOverDrive
344
              choices:
345
                  1: Enable
346
                  0: "Don't enable"
347
            - "OverDrive integration in the OPAC"
342
        -
348
        -
343
            - Include OverDrive availability information with the client key
349
            - Include OverDrive availability information with the client key
344
            - pref: OverDriveClientKey
350
            - pref: OverDriveClientKey
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-1 / +2 lines)
Lines 29-34 Link Here
29
    [% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %]
29
    [% SET OPACCustomCoverImages = ( Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') ) %]
30
    [% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %]
30
    [% SET OverDriveEnabled = Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') %]
31
[% END %]
31
[% END %]
32
[% SET OverDriveEnabled = ( Koha.Preference( "OPACOverDrive" ) && Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') ) %]
32
33
33
[% INCLUDE 'doc-head-open.inc' %]
34
[% INCLUDE 'doc-head-open.inc' %]
34
<title>
35
<title>
Lines 674-680 Link Here
674
                        highlightOff();
675
                        highlightOff();
675
                    });
676
                    });
676
                [% END # /IF OpacHighlightedWords %]
677
                [% END # /IF OpacHighlightedWords %]
677
                [% IF ( OverDriveEnabled ) %]
678
                [% IF ( OverDriveEnabled && firstPage ) %]
678
                    var $overdrive_results = $( '<div id="overdrive-results">' + _("Searching %s...").format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/[% theme | html %]/images/spinner-small.gif" /></div>' );
679
                    var $overdrive_results = $( '<div id="overdrive-results">' + _("Searching %s...").format('OverDrive') + ' <img class="throbber" src="[% interface | html %]/[% theme | html %]/images/spinner-small.gif" /></div>' );
679
                    $( '#numresults' ) .after( $overdrive_results );
680
                    $( '#numresults' ) .after( $overdrive_results );
680
                    //Clean querystring, first we remove CCL entities, then decode HTML entities, then swap double quotes for single quotes
681
                    //Clean querystring, first we remove CCL entities, then decode HTML entities, then swap double quotes for single quotes
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt (-21 / +22 lines)
Lines 10-18 Link Here
10
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
10
[% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
11
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
11
[% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %]
12
[% SET OpacMySummaryNote = AdditionalContents.get( location => "OpacMySummaryNote", lang => lang, library => branchcode ) %]
12
[% SET OpacMySummaryNote = AdditionalContents.get( location => "OpacMySummaryNote", lang => lang, library => branchcode ) %]
13
14
[% SET borrower_club_enrollments = logged_in_user.get_club_enrollments %]
13
[% SET borrower_club_enrollments = logged_in_user.get_club_enrollments %]
15
[% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1) %] <!-- 1 => OPAC -->
14
[% SET borrower_enrollable_clubs = logged_in_user.get_enrollable_clubs(1) %] <!-- 1 => OPAC -->
15
[% SET OverDriveEnabled = ( Koha.Preference( "OPACOverDrive" ) && Koha.Preference('OverDriveLibraryID') && Koha.Preference('OverDriveClientKey') && Koha.Preference('OverDriveClientSecret') ) %]
16
[% SET OverDriveCirculation = ( OverDriveEnabled && Koha.Preference( "OverDriveCirculation" ) ) %]
16
17
17
[% INCLUDE 'doc-head-open.inc' %]
18
[% INCLUDE 'doc-head-open.inc' %]
18
<title>Your library home &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
19
<title>Your library home &rsaquo; [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
Lines 1469-1495 Link Here
1469
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1470
        [% Asset.js("lib/jquery/plugins/jquery.barrating.min.js") | $raw %]
1470
        [% Asset.js("js/ratings.js") | $raw %]
1471
        [% Asset.js("js/ratings.js") | $raw %]
1471
    [% END %]
1472
    [% END %]
1472
    [% IF Koha.Preference('OverDriveCirculation') %]
1473
    [% IF OverDriveCirculation %]
1473
    [% Asset.js("js/overdrive.js") | $raw %]
1474
        [% Asset.js("js/overdrive.js") | $raw %]
1474
    <script>
1475
        <script>
1475
    [%- IF Koha.Preference('OverDrivePasswordRequired') -%]
1476
            [%- IF Koha.Preference('OverDrivePasswordRequired') -%]
1476
        var OD_password_required = 1;
1477
                var OD_password_required = 1;
1477
    [%- ELSE -%]
1478
            [%- ELSE -%]
1478
        var OD_password_required = 0;
1479
                var OD_password_required = 0;
1479
    [%- END -%]
1480
            [%- END -%]
1480
    $(document).ready(function() {
1481
            $(document).ready(function() {
1481
        [% IF ( overdrive_error ) %]
1482
                [% IF ( overdrive_error ) %]
1482
            KOHA.OverDriveCirculation.display_error("#opac-user-overdrive_panel", "[% overdrive_error.dquote | html %]");
1483
                    KOHA.OverDriveCirculation.display_error("#opac-user-overdrive_panel", "[% overdrive_error.dquote | html %]");
1483
        [% END %]
1484
                [% END %]
1484
1485
1485
        [% IF ( overdrive_tab ) %]
1486
                [% IF ( overdrive_tab ) %]
1486
            $("#opac-user-views a[href='#opac-user-overdrive_panel']").tab("show");
1487
                    $("#opac-user-views a[href='#opac-user-overdrive_panel']").tab("show");
1487
        [% END %]
1488
                [% END %]
1488
1489
1489
        $("#opac-user-overdrive_panel").each( function() {
1490
                $("#opac-user-overdrive_panel").each( function() {
1490
            KOHA.OverDriveCirculation.display_account_details(this);
1491
                    KOHA.OverDriveCirculation.display_account_details(this);
1491
        } );
1492
                } );
1492
    });
1493
            });
1493
    </script>
1494
        </script>
1494
    [% END %]
1495
    [% END %]
1495
[% END %]
1496
[% END %]
(-)a/opac/opac-overdrive-search.pl (+6 lines)
Lines 27-32 use C4::Output qw( output_html_with_http_headers ); Link Here
27
27
28
my $cgi = CGI->new;
28
my $cgi = CGI->new;
29
29
30
# if OPACOverDrive is disabled, leave immediately
31
if ( !C4::Context->preference('OPACOverDrive') ) {
32
    print $cgi->redirect("/cgi-bin/koha/errors/404.pl");
33
    exit;
34
}
35
30
# Getting the template and auth
36
# Getting the template and auth
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
38
    {
(-)a/opac/opac-user.pl (-2 lines)
Lines 358-364 if (C4::Context->preference("OPACAmazonCoverImages") or Link Here
358
}
358
}
359
359
360
$template->param(
360
$template->param(
361
    OverDriveCirculation => C4::Context->preference('OverDriveCirculation') || 0,
362
    overdrive_error      => scalar $query->param('overdrive_error') || undef,
361
    overdrive_error      => scalar $query->param('overdrive_error') || undef,
363
    overdrive_tab        => scalar $query->param('overdrive_tab') || 0,
362
    overdrive_tab        => scalar $query->param('overdrive_tab') || 0,
364
);
363
);
365
- 

Return to bug 37221