From 395e7c08039e0696379cd99f4617a4e7a8f107e5 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Sat, 26 May 2012 13:41:29 +1200 Subject: [PATCH] Bug 7642 - OpacShowTagCloudWeight system preference This system preference allows the mouseover text on the tag cloud to be turned off. The text consists of the weight for the tag, but users are more likely to confuse it with the number of items that have this tag. --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt | 7 ++++++- opac/opac-tags.pl | 7 +++++-- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index cc3a9e2..2c276c6 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -364,3 +364,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OpacStarRatings','all',NULL,'disable|all|details','Choice'); 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'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SvcMaxReportRows','10','Maximum number of rows to return via the report web service.',NULL,'Integer'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowTagCloudWeight','1','Whether to show the weight of a tag when you hover over its name in the tag cloud',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ca5fb30..f45c657 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5284,6 +5284,14 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacShowTagCloudWeight','1','Whether to show the weight of a tag when you hover over its name in the tag cloud',NULL,'YesNo')"); + print "Upgrade to $DBversion done (Add the 'OpacShowTagCloudWeight' system preference)\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 e4ea15b..63ab78b 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 @@ -223,6 +223,12 @@ OPAC: - '
Note: Available options are: BIBTEX (bibtex), Dublin Core (dc),' - 'MARCXML (marcxml), MARC-8 encoded MARC (marc8), Unicode/UTF-8 encoded MARC (utf8),' - 'Unicode/UTF-8 encoded MARC without local use -9xx, x9x, xx9- fields and subfields (marcstd), MODS (mods), RIS (ris)' + - + - pref: OpacShowTagCloudWeight + choices: + yes: Show + no: "Don't show" + - 'the numerical weight of a tag when you hover over its name in the tag cloud.' Features: - - pref: opacuserlogin diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt index 1c291c9..b67d4e9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-tags.tt @@ -90,7 +90,12 @@ [% IF ( TAGLOOP ) %]
[% FOREACH TAGLOO IN TAGLOOP %] - + [% IF (showweight) %] + + [% ELSE %] + + [% END %] + [% TAGLOO.term |html %] [% TAGLOO.weight_total %] diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index 36bc096..cab0e43 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -234,8 +234,11 @@ if ($loggedinuser) { } } -$template->param(tagsview => 1, -dateformat => C4::Context->preference("dateformat")); +$template->param( + tagsview => 1, + dateformat => C4::Context->preference("dateformat"), + showweight => C4::Context->preference("OpacShowTagCloudWeight") +); if ($add_op) { my $adds = 0; -- 1.7.5.4