[Koha-patches] [PATCH 1/5] [SIGNED-OFF] Bug 6298 : Add avatar picture of comment author in OPAC
Nicole C. Engard
nengard at bywatersolutions.com
Fri May 6 16:00:19 CEST 2011
From: Francois Marier <francois at debian.org>
Use Libravatar::URL to pull the avatar picture for comment authors
if we have an email address for them.
Signed-off-by: Francois Marier <francois at debian.org>
Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>
---
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(+), 0 deletions(-)
diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css
index aa295c9..a1e1663 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 c063bb3..aeef940 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
@@ -664,6 +664,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% FOREACH review IN reviews %]
[% IF ( review.your_comment ) %]
<div class="commentline yours" id="c[% review.reviewid %]">
+ [% IF ( review.avatarurl ) %]
+ <img class="avatar" src="[% review.avatarurl %]" height="80" width="80"/>
+ [% END %]
<h5>
Your Comment
</h5>
@@ -675,6 +678,9 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
[% ELSE %]
<div class="commentline">
[% IF ( ShowReviewer ) %]
+ [% IF ( review.avatarurl ) %]
+ <img class="avatar" src="[% review.avatarurl %]" height="80" width="80"/>
+ [% END %]
<h5>
Comment by
[% review.title %]
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index b357a56..19324c9 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});
--
1.7.2.3
More information about the Koha-patches
mailing list