From 7ffec5b437bb19da309145c9c74e1e524b97c15b Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Wed, 13 Jan 2010 15:42:33 +0100 Subject: [PATCH] MT2631 : adds sysprefs for MARC or ISBD display in OPAC --- C4/Search.pm | 31 +++++++++++++++++++ .../data/mysql/en/mandatory/sysprefs.sql | 4 ++- installer/data/mysql/updatedatabase30.pl | 11 +++++++ .../prog/en/modules/opac-ISBDdetail.tmpl | 22 ++++++++----- .../prog/en/modules/opac-MARCdetail.tmpl | 28 ++++++++++------- .../prog/en/modules/opac-detail.tmpl | 19 +++++++++++- kohaversion.pl | 2 +- opac/opac-ISBDdetail.pl | 2 ++ opac/opac-MARCdetail.pl | 1 + opac/opac-detail.pl | 1 + 10 files changed, 99 insertions(+), 22 deletions(-) diff --git a/C4/Search.pm b/C4/Search.pm index 43d21cc4bd..f5f87fef4f 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -2427,6 +2427,37 @@ sub enabled_staff_search_views ); } +=head2 enabled_opac_search_views + +%hash = enabled_opac_search_views() + +This function returns a hash that contains two flags obtained from the system +preferences, used to determine whether a particular opac search results view +is enabled. + +=over 2 + +=item C + + * $hash{can_view_MARC} is true only if the MARC view is enabled + * $hash{can_view_ISBD} is true only if the ISBD view is enabled + +=item C + +=back + +$template->param ( C4::Search::enabled_opac_search_views ); + +=cut + +sub enabled_opac_search_views +{ + return ( + can_opac_view_MARC => C4::Context->preference('OPACviewMARC'), # 1 if the opac search allows the MARC view + can_opac_view_ISBD => C4::Context->preference('OPACviewISBD'), # 1 if the opac search allows the ISBD view + ); +} + =head2 z3950_search_args diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index a67dcb6024..723a936d0a 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -226,4 +226,6 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReadingHistory', '0', 'If on display reading history for user', NULL, 'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ReceiveBackIssues', '5', 'Number of Previous journals to display when on subscription detail', '', ''); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IndependentBranchPatron',0,'If ON, librarian patron search can only be done on patron of same library as librarian',NULL,'YesNo');"); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('IndependentBranchPatron',0,'If ON, librarian patron search can only be done on patron of same library as librarian',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACviewISBD','1','Allow display of ISBD view of bibiographic records in OPAC','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACviewMARC','1','Allow display of MARC view of bibiographic records in OPAC','','YesNo'); diff --git a/installer/data/mysql/updatedatabase30.pl b/installer/data/mysql/updatedatabase30.pl index de57e89ca7..e315223018 100644 --- a/installer/data/mysql/updatedatabase30.pl +++ b/installer/data/mysql/updatedatabase30.pl @@ -720,6 +720,17 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = '3.00.06.005'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do(qq{INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACviewISBD','1','Allow display of ISBD view of bibiographic records in OPAC','','YesNo');}); + $dbh->do(qq{INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACviewMARC','1','Allow display of MARC view of bibiographic records in OPAC','','YesNo');}); + + print "Upgrade to $DBversion done (Added OPAC ISBD and MARC view sysprefs)\n"; + SetVersion ($DBversion); +} + + + =item DropAllForeignKeys($table) diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl index 7f40c2615c..02d02b197c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl @@ -28,14 +28,20 @@
-

ISBD

+

ISBD

+
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl index 30f2c96ed0..8e23e8f8ba 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-MARCdetail.tmpl @@ -44,17 +44,23 @@

MARC View

- ">Normal View - - -" title="MARC" rel="gb_page_center[600,500]">MARC View - Expanded MARC View - -MARC View - - - ">ISBD View -
+ + ">Normal View + + + " title="MARC" rel="gb_page_center[600,500]">MARC View + Expanded MARC View + + + MARC View + + + + + ">ISBD View + + +

(Record no. )

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl index 070f9c3621..dae0bd5e5b 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -80,7 +80,24 @@ YAHOO.util.Event.onContentReady("furtherm", function () {

by ">
-
Normal View ">MARC View ">ISBD View +
+ + Normal View + + + + + ">MARC View + + + + + + + ">ISBD View + + +
diff --git a/kohaversion.pl b/kohaversion.pl index 8fae5356b4..55919dcf24 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -10,7 +10,7 @@ use strict; sub kohaversion { - our $VERSION = '3.00.06.004'; + our $VERSION = '3.00.06.005'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 88d373a9b9..63dd77ed30 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -98,6 +98,8 @@ $template->param( subscriptionsnumber => $subscriptionsnumber, ); +$template->param(C4::Search::enabled_opac_search_views); + my $norequests = 1; my $res = GetISBDView($biblionumber, "opac"); my @items = &GetItemsInfo($biblionumber, 'opac'); diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 9826c24d3d..a0d2e90382 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -78,6 +78,7 @@ $template->param( $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); $template->param( 'ItemsCount' => GetItemsCount( $biblionumber ) ); +$template->param(C4::Search::enabled_opac_search_views); # adding the $RequestOnOpac param my $RequestOnOpac; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 817c20352e..75829e2b17 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -60,6 +60,7 @@ my $biblionumber = $query->param('biblionumber') || $query->param('bib'); $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') ); $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); +$template->param(C4::Search::enabled_opac_search_views); my $record = GetMarcBiblio($biblionumber); if ( ! $record ) { -- 2.39.5