Bug 6298 : Show avatars on the recent comments page
authorFrancois Marier <francois@debian.org>
Fri, 6 May 2011 14:00:38 +0000 (10:00 -0400)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 5 Jul 2011 03:01:10 +0000 (15:01 +1200)
Add smaller Libravatar-based images to the recent comments page.

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-showreviews.tt
opac/opac-showreviews.pl

index a1e1663..b8a531f 100644 (file)
@@ -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;
index e64fcae..2839460 100644 (file)
@@ -46,7 +46,11 @@ $(document).ready(function(){
     [% END %]
     [% IF ( review.copyrightdate ) %]<span class="results_summary"><span class="label">Date:</span>[% review.copyrightdate %]</span>[% END %]</p>
 
-            <p class="commentline[% IF ( review.your_comment ) %] yours[% END %]">[% review.review |html %]
+            <p class="commentline[% IF ( review.your_comment ) %] yours[% END %]">
+            [% IF ( review.avatarurl ) %]
+                <img class="avatar" src="[% review.avatarurl %]" height="40" width="40"/>
+            [% END %]
+            [% review.review |html %]
             <span style="font-size:87%;font-color:#CCC;">Added [% review.datereviewed %] [% IF ( review.your_comment ) %] by <strong>you</strong>[% ELSE %]
             [% IF ( ShowReviewer ) %] by
             [% review.firstname %] [% review.surname %][% END %][% END %]</span></p>
index f1e0b53..fbce8a2 100755 (executable)
@@ -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;
        }