From d3990031eda7f1c87d8b9f74d97625cf0c143eb3 Mon Sep 17 00:00:00 2001 From: Francois Marier Date: Fri, 6 May 2011 10:00:19 -0400 Subject: [PATCH] Bug 6298 : Add avatar picture of comment author in OPAC Use Libravatar::URL to pull the avatar picture for comment authors if we have an email address for them. 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 | 3 +++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 6 ++++++ opac/opac-detail.pl | 10 ++++++++++ 3 files changed, 19 insertions(+) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index aa295c9ff4..a1e16638d4 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -1873,6 +1873,9 @@ a#MARCview, a#MARCviewPop, a#ISBDview, a#Normalview, a#Fullhistory, a#Briefhisto #comments .yours { background-color : #effed5; } +.commentline .avatar { + float : right; +} #comments #addcomment { margin : 0 -1em -1em -1em; padding : .3em 1em; 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 01a66a3ce2..4866ba09b5 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -667,6 +667,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% FOREACH review IN reviews %] [% IF ( review.your_comment ) %]
+ [% IF ( review.avatarurl ) %] + + [% END %]
Your Comment
@@ -678,6 +681,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% ELSE %]
[% IF ( ShowReviewer ) %] + [% IF ( review.avatarurl ) %] + + [% END %]
Comment by [% review.title %] diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6345da1c98..0510917857 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -295,6 +295,13 @@ $template->param( ocoins => GetCOinSBiblio($biblionumber), ); +my $libravatar_available = 0; + +eval 'use Libravatar::URL'; +if (! $@) { + $libravatar_available = 1; +} + my $reviews = getreviews( $biblionumber, 1 ); my $loggedincommenter; foreach ( @$reviews ) { @@ -303,6 +310,9 @@ foreach ( @$reviews ) { $_->{title} = $borrowerData->{'title'}; $_->{surname} = $borrowerData->{'surname'}; $_->{firstname} = $borrowerData->{'firstname'}; + if ($libravatar_available and $borrowerData->{'email'}) { + $_->{avatarurl} = libravatar_url(email => $borrowerData->{'email'}, https => $ENV{HTTPS}); + } $_->{userid} = $borrowerData->{'userid'}; $_->{cardnumber} = $borrowerData->{'cardnumber'}; $_->{datereviewed} = format_date($_->{datereviewed}); -- 2.39.5