Bugzilla – Attachment 2819 Details for
Bug 4289
Add a syspref 'OpacPublic', to hide OPAC search-bar and force authentication on all OPAC pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
applied to master branch
0001-Bug-4289-OpacPublic-feature.patch (text/plain), 14.89 KB, created by
Mason James
on 2010-12-08 16:07:17 UTC
(
hide
)
Description:
applied to master branch
Filename:
MIME Type:
Creator:
Mason James
Created:
2010-12-08 16:07:17 UTC
Size:
14.89 KB
patch
obsolete
>From c2b69f1f33bdc29d9e437f7f2ab1759a6524f1da Mon Sep 17 00:00:00 2001 >From: Mason James <mason@kohaaloha.com> >Date: Thu, 9 Dec 2010 04:53:03 +1300 >Subject: [PATCH] Bug 4289: 'OpacPublic' feature >Content-Type: text/plain; charset="utf-8" > >applied againist master >commit e54169ba0f06cd835d72936e14012933a67793e7 > >--- > C4/Auth.pm | 4 ++++ > installer/data/mysql/updatedatabase.pl | 7 +++++++ > koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 4 ++++ > opac/opac-ISBDdetail.pl | 2 +- > opac/opac-MARCdetail.pl | 2 +- > opac/opac-addbybiblionumber.pl | 2 +- > opac/opac-alert-subscribe.pl | 2 +- > opac/opac-authorities-home.pl | 2 +- > opac/opac-authoritiesdetail.pl | 2 +- > opac/opac-basket.pl | 2 +- > opac/opac-browser.pl | 2 +- > opac/opac-detail.pl | 2 +- > opac/opac-main.pl | 2 +- > opac/opac-review.pl | 2 +- > opac/opac-search.pl | 2 +- > opac/opac-sendbasket.pl | 2 +- > opac/opac-shelves.pl | 2 +- > opac/opac-showmarc.pl | 2 +- > opac/opac-showreviews.pl | 2 +- > opac/opac-suggestions.pl | 2 +- > opac/opac-tags_subject.pl | 2 +- > opac/opac-topissues.pl | 2 +- > opac/opac-user.pl | 2 +- > opac/opac-userupdate.pl | 2 +- > 24 files changed, 36 insertions(+), 21 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 7404f96..b472fc3 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -454,6 +454,9 @@ sub get_template_and_user { > SyndeticsSeries => C4::Context->preference("SyndeticsSeries"), > SyndeticsCoverImageSize => C4::Context->preference("SyndeticsCoverImageSize"), > ); >+ >+ $template->param(OpacPublic => '1') >+ if ($template->param( 'loggedinusername') || C4::Context->preference("OpacPublic")); > } > $template->param(listloop=>[{shelfname=>"Freelist", shelfnumber=>110}]); > return ( $template, $borrowernumber, $cookie, $flags); >@@ -942,6 +945,7 @@ sub checkauth { > AutoLocation => C4::Context->preference("AutoLocation"), > wrongip => $info{'wrongip'} > ); >+ $template->param( OpacPublic => C4::Context->preference("OpacPublic")); > $template->param( loginprompt => 1 ) unless $info{'nopermission'}; > > if ($cas) { >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index d093946..b96139b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -3876,6 +3876,13 @@ VALUES > SetVersion ($DBversion); > }; > >+$DBversion = "3.00.xx.xxx"; >+if (C4::Context->preference("Version") < TransformToNum($DBversion)) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacPublic','1','If set to OFF and user is not logged in, all OPAC pages require authentication, and OPAC searchbar is removed)','','YesNo')"); >+ print "Upgrade to $DBversion done (added 'OpacPublic' syspref)\n"; >+ SetVersion ($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($table) >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >index 878a412..80ff667 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc >@@ -25,6 +25,8 @@ > <!-- /TMPL_IF --><a href="/cgi-bin/koha/opac-main.pl"><!-- TMPL_IF NAME="LibraryName" --><!-- TMPL_VAR NAME="LibraryName" --><!-- TMPL_ELSE -->Koha Online Catalog<!-- /TMPL_IF --></a></h1> > > <div id="fluid"> >+ >+<!-- TMPL_IF NAME="OpacPublic" --> > <div id="fluid-offset"> > <!-- TMPL_UNLESS NAME="advsearch" --><form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform"> > <label for="masthead_search" class="left"> Search >@@ -120,6 +122,8 @@ > </div> > </div> > >+<!-- /TMPL_IF --> <!-- OpacPublic --> >+ > <!-- TMPL_IF NAME="opacbookbag" --><div id="cartDetails">Your cart is empty.</div><!-- /TMPL_IF --> > > <!-- TMPL_IF NAME="virtualshelves" --> >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index 88904da..80c45a6 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -61,7 +61,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "opac-ISBDdetail.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index d127202..8813fd4 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -71,7 +71,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "opac-MARCdetail.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-addbybiblionumber.pl b/opac/opac-addbybiblionumber.pl >index 8cbd239..b1bf224 100755 >--- a/opac/opac-addbybiblionumber.pl >+++ b/opac/opac-addbybiblionumber.pl >@@ -59,7 +59,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "opac-addbybiblionumber.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired =>( C4::Context->preference("OpacPublic") ? 1 : 0 ), > } > ); > >diff --git a/opac/opac-alert-subscribe.pl b/opac/opac-alert-subscribe.pl >index c899b4b..7a95750 100755 >--- a/opac/opac-alert-subscribe.pl >+++ b/opac/opac-alert-subscribe.pl >@@ -46,7 +46,7 @@ my $biblionumber = $query->param('biblionumber'); > template_name => "opac-alert-subscribe.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-authorities-home.pl b/opac/opac-authorities-home.pl >index 104dff2..b8d91d5 100755 >--- a/opac/opac-authorities-home.pl >+++ b/opac/opac-authorities-home.pl >@@ -151,7 +151,7 @@ else { > template_name => "opac-authorities-home.tmpl", > query => $query, > type => 'opac', >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-authoritiesdetail.pl b/opac/opac-authoritiesdetail.pl >index 71f746e..7e06310 100755 >--- a/opac/opac-authoritiesdetail.pl >+++ b/opac/opac-authoritiesdetail.pl >@@ -62,7 +62,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "opac-authoritiesdetail.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl >index c453c87..2ec664d 100755 >--- a/opac/opac-basket.pl >+++ b/opac/opac-basket.pl >@@ -32,7 +32,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( > template_name => "opac-basket.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > flagsrequired => { borrow => 1 }, > } > ); >diff --git a/opac/opac-browser.pl b/opac/opac-browser.pl >index 4fe5f50..0e9a632 100755 >--- a/opac/opac-browser.pl >+++ b/opac/opac-browser.pl >@@ -44,7 +44,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "opac-browser.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 2de8ec8..6ef93a3 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -54,7 +54,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > template_name => "opac-detail.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > flagsrequired => { borrow => 1 }, > } > ); >diff --git a/opac/opac-main.pl b/opac/opac-main.pl >index e0a65a9..177d812 100755 >--- a/opac/opac-main.pl >+++ b/opac/opac-main.pl >@@ -36,7 +36,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > template_name => "opac-main.tmpl", > type => "opac", > query => $input, >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > flagsrequired => { borrow => 1 }, > } > ); >diff --git a/opac/opac-review.pl b/opac/opac-review.pl >index 7b43c21..16ed56a 100755 >--- a/opac/opac-review.pl >+++ b/opac/opac-review.pl >@@ -36,7 +36,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > template_name => "opac-review.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > } > ); > >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 2bfcb6d..f474f61 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -80,7 +80,7 @@ else { > template_name => $template_name, > query => $cgi, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > } > ); > >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index 76400a5..6213965 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -38,7 +38,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( > template_name => "opac-sendbasketform.tmpl", > query => $query, > type => "opac", >- authnotrequired => 0, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > flagsrequired => { borrow => 1 }, > } > ); >diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl >index abfcc8b..f1b7f96 100755 >--- a/opac/opac-shelves.pl >+++ b/opac/opac-shelves.pl >@@ -29,7 +29,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ > template_name => "opac-shelves.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > }); > $template->param(listsview => 1); > # if $loggedinuser is not defined, set it to -1, which should >diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl >index b379917..ea2c65d 100755 >--- a/opac/opac-showmarc.pl >+++ b/opac/opac-showmarc.pl >@@ -48,7 +48,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ > template_name => "opac-showmarc.tmpl", > query => $input, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > }); > >diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl >index ac8343a..19f5e1f 100755 >--- a/opac/opac-showreviews.pl >+++ b/opac/opac-showreviews.pl >@@ -34,7 +34,7 @@ my ( $template, $borrowernumber, $cookie ) = &get_template_and_user( > template_name => "opac-showreviews.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > } > ); > >diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl >index fc9ce51..b2ed340 100755 >--- a/opac/opac-suggestions.pl >+++ b/opac/opac-suggestions.pl >@@ -44,7 +44,7 @@ if ( C4::Context->preference("AnonSuggestions") ) { > template_name => "opac-suggestions.tmpl", > query => $input, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > } > ); > if ( !$$suggestion{suggestedby} ) { >diff --git a/opac/opac-tags_subject.pl b/opac/opac-tags_subject.pl >index 0e3c264..a19f406 100755 >--- a/opac/opac-tags_subject.pl >+++ b/opac/opac-tags_subject.pl >@@ -44,7 +44,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( > template_name => "opac-tags_subject.tmpl", > query => $query, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > } > ); >diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl >index 70b712e..9869d28 100755 >--- a/opac/opac-topissues.pl >+++ b/opac/opac-topissues.pl >@@ -46,7 +46,7 @@ my ($template, $borrowernumber, $cookie) > = get_template_and_user({template_name => 'opac-topissues.tmpl', > query => $input, > type => "opac", >- authnotrequired => 1, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > debug => 1, > }); > my $dbh = C4::Context->dbh; >diff --git a/opac/opac-user.pl b/opac/opac-user.pl >index 634b77a..e1e50cf 100755 >--- a/opac/opac-user.pl >+++ b/opac/opac-user.pl >@@ -47,7 +47,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > template_name => "opac-user.tmpl", > query => $query, > type => "opac", >- authnotrequired => 0, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > flagsrequired => { borrow => 1 }, > debug => 1, > } >diff --git a/opac/opac-userupdate.pl b/opac/opac-userupdate.pl >index ab2e15d..72a194a 100755 >--- a/opac/opac-userupdate.pl >+++ b/opac/opac-userupdate.pl >@@ -40,7 +40,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( > template_name => "opac-userupdate.tmpl", > query => $query, > type => "opac", >- authnotrequired => 0, >+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ), > flagsrequired => { borrow => 1 }, > debug => 1, > } >-- >1.7.1 >
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 4289
:
1982
|
1983
|
2620
|
2813
|
2814
|
2815
| 2819