From bf64266e9932853e42a17f98d27417319a4ef7fe Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 4 Oct 2011 10:20:52 -0400 Subject: [PATCH] Follow-up fix for Bug 4473 - Recent comments view for the OPAC This follow-up adds a system preference which controls display of a link to recent comments in the OPAC masthead alongside "Advanced search," "Tag cloud," etc. Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- C4/Auth.pm | 1 + installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 7 +++++++ koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc | 1 + 5 files changed, 18 insertions(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index 36a64722cf..2aac67858c 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -432,6 +432,7 @@ sub get_template_and_user { OpacHighlightedWords => C4::Context->preference("OpacHighlightedWords"), OPACItemHolds => C4::Context->preference("OPACItemHolds"), OPACShelfBrowser => "". C4::Context->preference("OPACShelfBrowser"), + OpacShowRecentComments => C4::Context->preference("OpacShowRecentComments"), OPACURLOpenInNewWindow => "" . C4::Context->preference("OPACURLOpenInNewWindow"), OPACUserCSS => "". C4::Context->preference("OPACUserCSS"), OPACViewOthersSuggestions => "" . C4::Context->preference("OPACViewOthersSuggestions"), diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7905d3f90f..ae2c1cbc6d 100755 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -327,4 +327,5 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpenLibraryCovers',0,'If ON Openlibrary book covers will be show',NULL,'YesNo'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OpacKohaUrl','1',"Show 'Powered by Koha' text on OPAC footer.",NULL,NULL); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('EasyAnalyticalRecords','0','If on, display in the catalogue screens tools to easily setup analytical record relationships','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index da35dc3ab1..f43637b186 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4537,6 +4537,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = "3.05.00.XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowRecentComments',0,'If ON a link to recent comments will appear in the OPAC masthead',NULL,'YesNo');"); + print "Upgrade to $DBversion done (Add syspref OpacShowRecentComments. When the preference is turned on a link to recent comments will appear in the OPAC masthead. )\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 07927d12ac..d6ae2b20a7 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 @@ -93,6 +93,13 @@ OPAC: no: "Don't show" - "'Powered by Koha' text on OPAC footer." - + - pref: OpacShowRecentComments + default: 0 + choices: + yes: Show + no: "Don't show" + - a link to recent comments in the OPAC masthead. + - - pref: OpacHighlightedWords choices: yes: Highlight diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc index fd352a952e..0ffb881430 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc @@ -112,6 +112,7 @@ Advanced Search [% IF ( OpacBrowser ) %] | Browse by Hierarchy[% END %] [% IF ( OpacAuthorities ) %] | Browse by author or subject[% END %] +[% IF ( OpacShowRecentComments ) %] | Recent Comments[% END %] [% IF ( TagsEnabled ) %] | Tag Cloud[% END %] [% IF ( OpacCloud ) %] | Subject Cloud[% END %] [% IF ( OpacTopissue ) %] | Most Popular[% END %] -- 2.11.0