Bugzilla – Attachment 9067 Details for
Bug 7935
Introduce sys pref to control 'browse results' in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7935: Introduce sys pref to control 'browse results' in OPAC
Bug-7935-Introduce-sys-pref-to-control-browse-resu.patch (text/plain), 8.18 KB, created by
Chris Cormack
on 2012-04-10 08:28:55 UTC
(
hide
)
Description:
Bug 7935: Introduce sys pref to control 'browse results' in OPAC
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-04-10 08:28:55 UTC
Size:
8.18 KB
patch
obsolete
>From 9ba8a29c8d85e5479f728fcde814ea10e685e30c Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Mon, 9 Apr 2012 21:27:16 +0200 >Subject: [PATCH] Bug 7935: Introduce sys pref to control 'browse results' in > OPAC > >Patch introduces a new system preference "OpacBrowseResults" to control >the feature for browsing and paging through results shown on top of the >left menu on detail pages in OPAC. > >Preference is activated by default and can be deactivated using the >system preference. > >To test: > - Check database update works correctly > - Check that browsing and paging still works with after database update > - Deactivate the feature by setting 'OpacBrowseResults' to 'Disable' > - Check the feature does no longer show up in OPAC > - Check that a new installation also has the system preference with correct default > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > C4/Auth.pm | 2 +- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 12 +++++++++++- > .../prog/en/modules/admin/preferences/opac.pref | 8 ++++++++ > koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 15 +++++++++------ > opac/opac-detail.pl | 4 ++++ > 6 files changed, 34 insertions(+), 8 deletions(-) > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index 0d5ddba..549c5c2 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -373,7 +373,7 @@ sub get_template_and_user { > $LibraryNameTitle =~ s/<(?:\/?)(?:br|p)\s*(?:\/?)>/ /sgi; > $LibraryNameTitle =~ s/<(?:[^<>'"]|'(?:[^']*)'|"(?:[^"]*)")*>//sg; > # clean up the busc param in the session if the page is not opac-detail >- if ($in->{'template_name'} =~ /opac-(.+)\.(?:tt|tmpl)$/ && $1 !~ /^(?:MARC|ISBD)?detail$/) { >+ if (C4::Context->preference("OpacBrowseResults") && $in->{'template_name'} =~ /opac-(.+)\.(?:tt|tmpl)$/ && $1 !~ /^(?:MARC|ISBD)?detail$/) { > my $sessionSearch = get_session($sessionID || $in->{'query'}->cookie("CGISESSID")); > $sessionSearch->clear(["busc"]) if ($sessionSearch->param("busc")); > } >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 34ac684..eb86cf2 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -360,3 +360,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES > INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('SocialNetworks','1','Enable/Disable social networks links in opac detail pages','','YesNo'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free'); > INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('AutoResumeSuspendedHolds', '1', NULL , 'Allow suspended holds to be automatically resumed by a set date.', 'YesNo'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index b3c5691..f958ce1 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5090,7 +5090,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > $DBversion = "3.07.00.041"; > if (C4::Context->preference("Version") < TransformToNum($DBversion)) { > $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('SubscriptionDuplicateDroppedInput','','','List of fields which must not be rewritten when a subscription is duplicated (Separated by pipe |)','Free')"); >- print "Upgrade to $DBversion done (Add System Preferences SubscriptionDuplicateDroppedInput)\n"; >+ print "Upgrade to $DBversion done (Add system preference SubscriptionDuplicateDroppedInput)\n"; > SetVersion($DBversion); > } > >@@ -5159,6 +5159,16 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+ >+$DBversion = "3.07.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacBrowseResults','1','Disable/enable browsing and paging search results from the OPAC detail page.',NULL,'YesNo')"); >+ print "Upgrade to $DBversion done (Add system preference OpacBrowseResults ))\n"; >+ SetVersion($DBversion); >+} >+ >+ >+ > =head1 FUNCTIONS > > =head2 DropAllForeignKeys($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 54cc43a..715bf94 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 >@@ -315,6 +315,14 @@ OPAC: > yes: Enable > no: Disable > - social network links in opac detail pages >+ - >+ - pref: OpacBrowseResults >+ default: 1 >+ choices: >+ yes: Enable >+ no: Disable >+ - browsing and paging search results from the OPAC detail page. >+ > Policy: > - > - pref: singleBranchMode >diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >index 36ef631..4f80aa1 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt >@@ -11,7 +11,8 @@ > [% END %] > <script type="text/JavaScript" language="JavaScript"> > //<![CDATA[ >- [% IF ( busc ) %] >+ >+ [% IF ( OpacBrowseResults && busc ) %] > var arrPagination = new Array(); > var pag_index_ini = [% indexPag %]; > [% IF ( listResults ) %] >@@ -55,7 +56,9 @@ > [% END %] > [% IF ( opacuserlogin ) %][% IF ( loggedinusername ) %][% IF ( TagsEnabled ) %] > $(".tagbutton").click(KOHA.Tags.add_tag_button);[% END %][% END %][% END %] >- [% IF ( busc ) %] >+ >+ >+ [% IF ( OpacBrowseResults && busc ) %] > if (arrPagination.length > 0) { > renderPagIndexList(pag_index_ini, $("#listResults")); > } >@@ -80,14 +83,13 @@ > var navigation = $(".pagination"); > navigation.hide(); > }); >- [% END %] >+ [% END %] > > $(".branch-info-tooltip-trigger").tooltip({delay: 100, position: "top right"}); > }); > > >-[% IF ( busc ) %] >- >+[% IF ( OpacBrowseResults && busc ) %] > var timeoutRFW; > var totalPagItemList = 10; > >@@ -1078,7 +1080,8 @@ YAHOO.util.Event.onContentReady("furtherm", function () { > > <div class="yui-u"> > <div id="ulactioncontainer" class="container"> >-[% IF ( busc ) %] >+ >+[% IF ( OpacBrowseResults && busc ) %] > <div class="nav_results"> > <div class="l_Results">[% IF ( listResults ) %]<a href="#" id="a_listResults" title="Show pagination list ([% indexPag %]-[% indexPagEnd %] / [% totalPag %])">Browse results</a>[% ELSE %]<span>Browse results</span>[% END %]</div> > <ul class="pg_menu clearfix"> >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index 796f3b0..640f9e7 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -94,8 +94,11 @@ if (C4::Context->preference("OPACXSLTDetailsDisplay") ) { > $template->param( 'XSLTBloc' => XSLTParse4Display($biblionumber, $record, "OPACXSLTDetailsDisplay" ) ); > } > >+my $OpacBrowseResults = C4::Context->preference("OpacBrowseResults"); >+$template->{VARS}->{'OpacBrowseResults'} = $OpacBrowseResults; > > # We look for the busc param to build the simple paging from the search >+if ($OpacBrowseResults) { > my $session = get_session($query->cookie("CGISESSID")); > my %paging = (previous => {}, next => {}); > if ($session->param('busc')) { >@@ -375,6 +378,7 @@ if ($session->param('busc')) { > $template->param('listResults' => \@listResults) if (@listResults); > $template->param('indexPag' => 1 + $offset, 'totalPag' => $arrParamsBusc{'total'}, 'indexPagEnd' => scalar(@arrBiblios) + $offset); > } >+} > > > >-- >1.7.5.4
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 7935
:
9050
| 9067