Bugzilla – Attachment 34909 Details for
Bug 13485
Add a page to display links to restricted sites
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13485 - Add a proxy page
PASSED-QA-Bug-13485---Add-a-proxy-page.patch (text/plain), 8.21 KB, created by
Kyle M Hall (khall)
on 2015-01-02 16:29:37 UTC
(
hide
)
Description:
[PASSED QA] Bug 13485 - Add a proxy page
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-01-02 16:29:37 UTC
Size:
8.21 KB
patch
obsolete
>From 0cd4e5bc7ea0468ff4e42be395a6cae4f9e784c6 Mon Sep 17 00:00:00 2001 >From: simith <simith@inlibro.com> >Date: Fri, 19 Dec 2014 14:44:48 -0500 >Subject: [PATCH] [PASSED QA] Bug 13485 - Add a proxy page > >To test: > >I) Apply the patch >II) Run updatedatabase.pl > >scenario I) > >1) Add some content in ProxyPageContent and ProxyPageTitle sysprefs. >2) Add your machine ip (ex. 127.0.0) >3) Validate cgi-bin/koha/opac-proxypage.pl shows a page with ProxyPageContent and ProxyPageTitle contents. > >scenario II) > >1) Logout opac page >2) Add some content in ProxyPageContent and ProxyPageTitle sysprefs. >3) Add other ip that your machine ip. >4) Validate: cgi-bin/koha/opac-proxypage.pl shows a login page. >5) Validate: cgi-bin/koha/opac-proxypage.pl shows a page with ProxyPageContent and ProxyPageTitle contents after login. > >Followed both scenarios, works as expected. >Signed-off-by: Marc Veron <veron@veron.ch> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > installer/data/mysql/sysprefs.sql | 3 + > installer/data/mysql/updatedatabase.pl | 7 +++ > .../prog/en/modules/admin/preferences/opac.pref | 15 ++++++ > .../bootstrap/en/modules/opac-proxypage.tt | 40 ++++++++++++++ > opac/opac-proxypage.pl | 54 ++++++++++++++++++++ > 5 files changed, 119 insertions(+), 0 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-proxypage.tt > create mode 100755 opac/opac-proxypage.pl > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index db9fd84..d66a4d8 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -340,6 +340,9 @@ 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'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index c380800..93a3231 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -9628,6 +9628,13 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('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')"); >+ print "Upgrade done (Proxy page)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >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 45df9f8..16f1a6c 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 >@@ -595,6 +595,21 @@ OPAC: > track: "Track" > no: "Don't track" > - links that patrons click on >+ Proxy page: >+ - >+ - "Access from IP addresses beginning with" >+ - pref: ProxyPageLocalIPs >+ - "do not need to be authenticated (comma separated - ex: '127.0.0,127.0.1')" >+ - >+ - "HTML content of your proxy page" >+ - pref: ProxyPageContent >+ type: textarea >+ class: HTML >+ - >+ - Use >+ - pref: ProxyPageTitle >+ class: long >+ - "as title of your proxy page (appears in the breadcrumb and on the top of the proxy 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-proxypage.tt >new file mode 100644 >index 0000000..3ceae77 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-proxypage.tt >@@ -0,0 +1,40 @@ >+[% USE Koha %] >+[% USE KohaDates %] >+ >+[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog[% IF ProxyPageTitle %] › [% ProxyPageTitle %][% END %] >+ >+[% INCLUDE 'doc-head-close.inc' %] >+[% BLOCK cssinclude %][% END %] >+</head> >+<body id="opac-account" class="scrollto"> >+[% INCLUDE 'masthead.inc' %] >+ >+<div class="main"> >+ <ul class="breadcrumb"> >+ <li><a href="/cgi-bin/koha/opac-main.pl">Home</a></li> >+ [% IF ( ProxyPageTitle ) %] >+ <li> <span class="divider">›</span> [% ProxyPageTitle %]</li> >+ [% END %] >+ </ul> >+ >+ <div class="container-fluid"> >+ <div class="row-fluid"> >+ <div class="span2"> >+ <div id="navigation"> >+ [% INCLUDE 'navigation.inc' %] >+ </div> >+ </div> >+ <div class="span10"> >+ <div id="proxycontent" class="maincontent"> >+ [% IF ( ProxyPageTitle ) %] >+ <h1>[% ProxyPageTitle %]</h1> >+ [% END %] >+ [% ProxyPageContent %] >+ </div> >+ </div> <!-- / .span10 --> >+ </div> <!-- / .row-fluid --> >+ </div> <!-- / .container-fluid --> >+</div> <!-- / .main --> >+ >+[% INCLUDE 'opac-bottom.inc' %] >+[% BLOCK jsinclude %][% END %] >\ No newline at end of file >diff --git a/opac/opac-proxypage.pl b/opac/opac-proxypage.pl >new file mode 100755 >index 0000000..f2f175b >--- /dev/null >+++ b/opac/opac-proxypage.pl >@@ -0,0 +1,54 @@ >+#!/usr/bin/perl >+ >+# Copyright Solutions inLibro inc 2014 >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version . >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+ >+use strict; >+use CGI; >+use C4::Auth; >+use C4::Output; >+use warnings; >+ >+my $localNetwork = C4::Context->preference('ProxyPageLocalIPs'); >+my $userIP = $ENV{'REMOTE_ADDR'}; >+ >+my $withinNetwork = 0; >+foreach my $IPRange ( split( ',', $localNetwork ) ) >+{ >+ $withinNetwork = ( $userIP =~ /^$IPRange/ ); >+ last if $withinNetwork; >+} >+ >+my $query = new CGI; >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "opac-proxypage.tt", >+ query => $query, >+ type => "opac", >+ authnotrequired => $withinNetwork, >+ flagsrequired => { borrow => 1 }, >+ debug => 1, >+ } >+); >+ >+$template->param( >+ ProxyPageContent => C4::Context->preference('ProxyPageContent'), >+ ProxyPageTitle => C4::Context->preference('ProxyPageTitle') >+ ); >+ >+output_html_with_http_headers $query, $cookie, $template->output; >\ No newline at end of file >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13485
:
34597
|
34598
|
34604
|
34908
|
34909
|
34910
|
40820
|
40821
|
40822
|
41377
|
41378