From f44b674ed5a70663bc5e9808b6d0a41cec5497a0 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Fri, 6 May 2011 10:00:38 -0400 Subject: [PATCH] Bug 6298 : Show avatars on the recent comments page Add smaller Libravatar-based images to the recent comments page. Signed-off-by: Francois Marier Signed-off-by: Nicole C. Engard Signed-off-by: Chris Cormack --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 1 + .../opac-tmpl/prog/en/modules/opac-showreviews.tt | 6 +++++- opac/opac-showreviews.pl | 11 +++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index a1e16638d4..b8a531f1d9 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -1875,6 +1875,7 @@ a#MARCview, a#MARCviewPop, a#ISBDview, a#Normalview, a#Fullhistory, a#Briefhisto } .commentline .avatar { float : right; + padding-left : .5em; } #comments #addcomment { margin : 0 -1em -1em -1em; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt index e64fcae855..2839460cbf 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-showreviews.tt @@ -46,7 +46,11 @@ $(document).ready(function(){ [% END %] [% IF ( review.copyrightdate ) %]Date:[% review.copyrightdate %][% END %]

-

[% review.review |html %] +

+ [% IF ( review.avatarurl ) %] + + [% END %] + [% review.review |html %] Added [% review.datereviewed %] [% IF ( review.your_comment ) %] by you[% ELSE %] [% IF ( ShowReviewer ) %] by [% review.firstname %] [% review.surname %][% END %][% END %]

diff --git a/opac/opac-showreviews.pl b/opac/opac-showreviews.pl index f1e0b5320d..fbce8a28ad 100755 --- a/opac/opac-showreviews.pl +++ b/opac/opac-showreviews.pl @@ -65,6 +65,13 @@ if($format eq "rss"){ ); } +my $libravatar_available = 0; + +eval 'use Libravatar::URL'; +if (! $@) { + $libravatar_available = 1; +} + my $reviews = getallreviews(1,$offset,$results_per_page); my $marcflavour = C4::Context->preference("marcflavour"); my $hits = numberofreviews(); @@ -92,6 +99,10 @@ for my $result (@$reviews){ $result->{timestamp} = $bib->{'timestamp'}; $result->{firstname} = $borr->{'firstname'}; $result->{surname} = $borr->{'surname'}; + if ($libravatar_available and $borr->{'email'}) { + $result->{avatarurl} = libravatar_url(email => $borr->{'email'}, size => 40, https => $ENV{HTTPS}); + } + if ($result->{borrowernumber} eq $borrowernumber) { $result->{your_comment} = 1; } -- 2.39.5