From 24c14fb25c2bb38a9bb46022e92629a6e8f0d121 Mon Sep 17 00:00:00 2001 From: mxbeaulieu Date: Tue, 7 Jul 2015 11:00:38 -0400 Subject: [PATCH] Bug 13485 - Atomic Update + Rename Proxy page to Restricted page Test plan: I) Apply the patch II) Run updatedatabase.pl scenario I) 1) Add some content in RestrictedPageContent and RestrictedPageTitle sysprefs. 2) Add your machine ip (ex. 127.0.0) 3) Validate cgi-bin/koha/opac-restrictedpage.pl shows a page with RestrictedPageContent and RestrictedPageTitle contents. scenario II) 1) Logout opac page 2) Add some content in RestrictedPageContent and RestrictedPageTitle sysprefs. 3) Add a diffrent ip. 4) Validate: cgi-bin/koha/opac-restrictedpage.pl shows a login page. 5) Validate: cgi-bin/koha/opac-restrictedpage.pl shows a page with RestrictedPageContent and RestrictedPageTitle contents after login. new file: installer/data/mysql/atomicupdate/Bug13485_RestrictedSitesPage.sql modified: installer/data/mysql/sysprefs.sql modified: koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref renamed: koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-proxypage.tt -> koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-restrictedpage.tt renamed: opac/opac-proxypage.pl -> opac/opac-restrictedpage.pl --- .../atomicupdate/Bug13485_RestrictedSitesPage.sql | 4 +++ installer/data/mysql/sysprefs.sql | 6 ++--- .../prog/en/modules/admin/preferences/opac.pref | 12 ++++----- .../{opac-proxypage.tt => opac-restrictedpage.tt} | 28 +++++++++++++------- opac/{opac-proxypage.pl => opac-restrictedpage.pl} | 8 +++--- 5 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/Bug13485_RestrictedSitesPage.sql rename koha-tmpl/opac-tmpl/bootstrap/en/modules/{opac-proxypage.tt => opac-restrictedpage.tt} (55%) rename opac/{opac-proxypage.pl => opac-restrictedpage.pl} (82%) diff --git a/installer/data/mysql/atomicupdate/Bug13485_RestrictedSitesPage.sql b/installer/data/mysql/atomicupdate/Bug13485_RestrictedSitesPage.sql new file mode 100644 index 0000000..efbc4a8 --- /dev/null +++ b/installer/data/mysql/atomicupdate/Bug13485_RestrictedSitesPage.sql @@ -0,0 +1,4 @@ +INSERT INTO systempreferences (variable,value,options,explanation,type) +VALUES ('RestrictedPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: \"127.0.0,127.0.2\")','Free'), +('RestrictedPageContent','',NULL,'HTML content of the restricted page','TextArea'), +('RestrictedPageTitle','',NULL,'Title of the restricted page (breadcrumb and header)','Free') diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7240f1d..6c42b80 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -344,9 +344,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'), ('printcirculationslips','1','','If ON, enable printing circulation receipts','YesNo'), ('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'), -('ProxyPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: "127.0.0,127.0.2")','Free'), -('ProxyPageContent','',NULL,'HTML content of the proxy page','TextArea'), -('ProxyPageTitle','',NULL,'Title of the proxy page (breadcrumb and header)','Free'), ('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'), ('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'), ('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'), @@ -365,6 +362,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice'), ('ReservesMaxPickUpDelay','7','','Define the Maximum delay to pick up an item on hold','Integer'), ('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'), +('RestrictedPageLocalIPs','',NULL,'Beginning of IP addresses considered as local (comma separated ex: "127.0.0,127.0.2")','Free'), +('RestrictedPageContent','',NULL,'HTML content of the restricted page','TextArea'), +('RestrictedPageTitle','',NULL,'Title of the restricted page (breadcrumb and header)','Free'), ('ReturnBeforeExpiry','0',NULL,'If ON, checkout will be prevented if returndate is after patron card expiry','YesNo'), ('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'), ('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 2fd7b7f..2fd6867 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -601,21 +601,21 @@ OPAC: track: "Track" no: "Don't track" - links that patrons click on - Proxy page: + Restricted page: - - "Access from IP addresses beginning with" - - pref: ProxyPageLocalIPs + - pref: RestrictedPageLocalIPs - "do not need to be authenticated (comma separated - ex: '127.0.0,127.0.1')" - - - "HTML content of your proxy page" - - pref: ProxyPageContent + - "HTML content of your restricted page" + - pref: RestrictedPageContent type: textarea class: HTML - - Use - - pref: ProxyPageTitle + - pref: RestrictedPageTitle class: long - - "as title of your proxy page (appears in the breadcrumb and on the top of the proxy page)" + - "as title of your restricted page (appears in the breadcrumb and on the top of the restricted page)" Shelf Browser: - diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-proxypage.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-restrictedpage.tt similarity index 55% rename from koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-proxypage.tt rename to koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-restrictedpage.tt index 3ceae77..ac6765d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-proxypage.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-restrictedpage.tt @@ -1,8 +1,18 @@ [% USE Koha %] [% USE KohaDates %] -[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog[% IF ProxyPageTitle %] › [% ProxyPageTitle %][% END %] - +[% INCLUDE 'doc-head-open.inc' %] + + [% IF ( LibraryNameTitle ) %] + [% LibraryNameTitle %] + [% ELSE %] + Koha online + [% END %] + catalog + [% IF RestrictedPageTitle %] + › [% RestrictedPageTitle %] + [% END %] + [% INCLUDE 'doc-head-close.inc' %] [% BLOCK cssinclude %][% END %] @@ -12,8 +22,8 @@
@@ -25,11 +35,11 @@
-
- [% IF ( ProxyPageTitle ) %] -

[% ProxyPageTitle %]

+
+ [% IF ( RestrictedPageTitle ) %] +

[% RestrictedPageTitle %]

[% END %] - [% ProxyPageContent %] + [% RestrictedPageContent %]
@@ -37,4 +47,4 @@ [% INCLUDE 'opac-bottom.inc' %] -[% BLOCK jsinclude %][% END %] \ No newline at end of file +[% BLOCK jsinclude %][% END %] diff --git a/opac/opac-proxypage.pl b/opac/opac-restrictedpage.pl similarity index 82% rename from opac/opac-proxypage.pl rename to opac/opac-restrictedpage.pl index badd8d0..684b129 100755 --- a/opac/opac-proxypage.pl +++ b/opac/opac-restrictedpage.pl @@ -23,7 +23,7 @@ use CGI; use C4::Auth; use C4::Output; -my $localNetwork = C4::Context->preference('ProxyPageLocalIPs'); +my $localNetwork = C4::Context->preference('RestrictedPageLocalIPs'); my $userIP = $ENV{'REMOTE_ADDR'}; my $withinNetwork = 0; @@ -36,7 +36,7 @@ foreach my $IPRange ( split( ',', $localNetwork ) ) my $query = new CGI; my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { - template_name => "opac-proxypage.tt", + template_name => "opac-restrictedpage.tt", query => $query, type => "opac", authnotrequired => $withinNetwork, @@ -46,8 +46,8 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( ); $template->param( - ProxyPageContent => C4::Context->preference('ProxyPageContent'), - ProxyPageTitle => C4::Context->preference('ProxyPageTitle') + RestrictedPageContent => C4::Context->preference('RestrictedPageContent'), + RestrictedPageTitle => C4::Context->preference('RestrictedPageTitle') ); output_html_with_http_headers $query, $cookie, $template->output; -- 1.7.9.5