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

(-)a/installer/data/mysql/atomicupdate/Bug13485_RestrictedSitesPage.sql (+4 lines)
Line 0 Link Here
1
INSERT INTO systempreferences (variable,value,options,explanation,type)
2
VALUES ('RestrictedPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: \"127.0.0,127.0.2\")','Free'),
3
('RestrictedPageContent','',NULL,'HTML content of the restricted page','TextArea'),
4
('RestrictedPageTitle','',NULL,'Title of the restricted page (breadcrumb and header)','Free')
(-)a/installer/data/mysql/sysprefs.sql (+3 lines)
Lines 365-370 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
365
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
365
('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'),
366
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
366
('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'),
367
('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
367
('ReservesNeedReturns','1','','If ON, a hold placed on an item available in this library must be checked-in, otherwise, a hold on a specific item, that is in the library & available is considered available','YesNo'),
368
('RestrictedPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: "127.0.0,127.0.2")','Free'),
369
('RestrictedPageContent','',NULL,'HTML content of the restricted page','TextArea'),
370
('RestrictedPageTitle','',NULL,'Title of the restricted page (breadcrumb and header)','Free'),
368
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
371
('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'),
369
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
372
('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'),
370
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
373
('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref (+15 lines)
Lines 601-606 OPAC: Link Here
601
                  track: "Track"
601
                  track: "Track"
602
                  no: "Don't track"
602
                  no: "Don't track"
603
            - links that patrons click on
603
            - links that patrons click on
604
    Restricted page:
605
        -
606
            - "Access from IP addresses beginning with"
607
            - pref: RestrictedPageLocalIPs
608
            - "do not need to be authenticated (comma separated - ex: '127.0.0,127.0.1')"
609
        -
610
            - "HTML content of your restricted page"
611
            - pref: RestrictedPageContent
612
              type: textarea
613
              class: HTML
614
        -
615
            - Use
616
            - pref: RestrictedPageTitle
617
              class: long
618
            - "as title of your restricted page (appears in the breadcrumb and on the top of the restricted page)"
604
619
605
    Shelf Browser:
620
    Shelf Browser:
606
        -
621
        -
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-restrictedpage.tt (+50 lines)
Line 0 Link Here
1
[% USE Koha %]
2
[% USE KohaDates %]
3
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>
6
    [% IF ( LibraryNameTitle ) %]
7
        [% LibraryNameTitle %]
8
    [% ELSE %]
9
        Koha online
10
    [% END %]
11
    catalog
12
    [% IF RestrictedPageTitle %]
13
        &rsaquo; [% RestrictedPageTitle %]
14
    [% END %]
15
</title>
16
[% INCLUDE 'doc-head-close.inc' %]
17
[% BLOCK cssinclude %][% END %]
18
</head>
19
<body id="opac-account" class="scrollto">
20
[% INCLUDE 'masthead.inc' %]
21
22
<div class="main">
23
    <ul class="breadcrumb">
24
        <li><a href="/cgi-bin/koha/opac-main.pl">Home</a></li>
25
        [% IF ( RestrictedPageTitle ) %]
26
            <li> <span class="divider">&rsaquo;</span> [% RestrictedPageTitle %]</li>
27
        [% END %]
28
    </ul>
29
30
    <div class="container-fluid">
31
        <div class="row-fluid">
32
            <div class="span2">
33
                <div id="navigation">
34
                    [% INCLUDE 'navigation.inc' %]
35
                </div>
36
            </div>
37
            <div class="span10">
38
                <div id="restrictedcontent" class="maincontent">
39
                    [% IF ( RestrictedPageTitle ) %]
40
                        <h1>[% RestrictedPageTitle %]</h1>
41
                    [% END %]
42
                    [% RestrictedPageContent %]
43
                </div>
44
            </div> <!-- / .span10 -->
45
        </div> <!-- / .row-fluid -->
46
    </div> <!-- / .container-fluid -->
47
</div> <!-- / .main -->
48
49
[% INCLUDE 'opac-bottom.inc' %]
50
[% BLOCK jsinclude %][% END %]
(-)a/opac/opac-restrictedpage.pl (-1 / +53 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright Solutions inLibro inc 2014
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version .
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
use C4::Auth;
24
use C4::Output;
25
26
my $localNetwork  = C4::Context->preference('RestrictedPageLocalIPs');
27
my $userIP = $ENV{'REMOTE_ADDR'};
28
29
my $withinNetwork = 0;
30
foreach my $IPRange ( split( ',', $localNetwork ) )
31
{
32
    $withinNetwork = ( $userIP =~ /^$IPRange/ );
33
    last if $withinNetwork;
34
}
35
36
my $query = new CGI;
37
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
38
    {
39
        template_name   => "opac-restrictedpage.tt",
40
        query           => $query,
41
        type            => "opac",
42
        authnotrequired => $withinNetwork,
43
        flagsrequired   => { borrow => 1 },
44
        debug           => 1,
45
    }
46
);
47
48
$template->param(
49
                    RestrictedPageContent => C4::Context->preference('RestrictedPageContent'),
50
                    RestrictedPageTitle => C4::Context->preference('RestrictedPageTitle')
51
                );
52
53
output_html_with_http_headers $query, $cookie, $template->output;

Return to bug 13485