Bug 6298 : Add avatar picture of comment author in OPAC
authorFrancois Marier <francois@debian.org>
Fri, 6 May 2011 14:00:19 +0000 (10:00 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 5 Jul 2011 03:01:09 +0000 (15:01 +1200)
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@debian.org>
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
koha-tmpl/opac-tmpl/prog/en/css/opac.css
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt
opac/opac-detail.pl

index aa295c9..a1e1663 100644 (file)
@@ -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;
index 01a66a3..4866ba0 100644 (file)
@@ -667,6 +667,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>
@@ -678,6 +681,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 %]
index 6345da1..0510917 100755 (executable)
@@ -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});