Merge remote-tracking branch 'remotes/fmarier/libravatar-in-comments'
commit
ea166ca334
|
@ -167,6 +167,7 @@ sub preprocess {
|
||||||
my $commentip;
|
my $commentip;
|
||||||
my $commentauthor;
|
my $commentauthor;
|
||||||
my $commentauthorurl;
|
my $commentauthorurl;
|
||||||
|
my $commentauthoravatar;
|
||||||
my $commentopenid;
|
my $commentopenid;
|
||||||
if (defined $params{username}) {
|
if (defined $params{username}) {
|
||||||
$commentuser = $params{username};
|
$commentuser = $params{username};
|
||||||
|
@ -187,6 +188,17 @@ sub preprocess {
|
||||||
|
|
||||||
$commentauthor = $commentuser;
|
$commentauthor = $commentuser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eval 'use Libravatar::URL';
|
||||||
|
|
||||||
|
if (! $@) {
|
||||||
|
if (defined $commentopenid) {
|
||||||
|
$commentauthoravatar = libravatar_url(openid => $commentopenid, https => $ENV{HTTPS});
|
||||||
|
}
|
||||||
|
elsif (my $email = IkiWiki::userinfo_get($commentuser, 'email')) {
|
||||||
|
$commentauthoravatar = libravatar_url(email => $email, https => $ENV{HTTPS});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (defined $params{ip}) {
|
if (defined $params{ip}) {
|
||||||
|
@ -200,6 +212,7 @@ sub preprocess {
|
||||||
$commentstate{$page}{commentip} = $commentip;
|
$commentstate{$page}{commentip} = $commentip;
|
||||||
$commentstate{$page}{commentauthor} = $commentauthor;
|
$commentstate{$page}{commentauthor} = $commentauthor;
|
||||||
$commentstate{$page}{commentauthorurl} = $commentauthorurl;
|
$commentstate{$page}{commentauthorurl} = $commentauthorurl;
|
||||||
|
$commentstate{$page}{commentauthoravatar} = $commentauthoravatar;
|
||||||
if (! defined $pagestate{$page}{meta}{author}) {
|
if (! defined $pagestate{$page}{meta}{author}) {
|
||||||
$pagestate{$page}{meta}{author} = $commentauthor;
|
$pagestate{$page}{meta}{author} = $commentauthor;
|
||||||
}
|
}
|
||||||
|
@ -874,6 +887,11 @@ sub pagetemplate (@) {
|
||||||
$commentstate{$page}{commentauthorurl});
|
$commentstate{$page}{commentauthorurl});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($template->query(name => 'commentauthoravatar')) {
|
||||||
|
$template->param(commentauthoravatar =>
|
||||||
|
$commentstate{$page}{commentauthoravatar});
|
||||||
|
}
|
||||||
|
|
||||||
if ($template->query(name => 'removeurl') &&
|
if ($template->query(name => 'removeurl') &&
|
||||||
IkiWiki::Plugin::remove->can("check_canremove") &&
|
IkiWiki::Plugin::remove->can("check_canremove") &&
|
||||||
length $config{cgiurl}) {
|
length $config{cgiurl}) {
|
||||||
|
|
|
@ -247,6 +247,9 @@ span.color {
|
||||||
.comment-subject {
|
.comment-subject {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
.comment-avatar {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
.comment {
|
.comment {
|
||||||
border: 1px solid #aaa;
|
border: 1px solid #aaa;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<TMPL_IF HTML5><article class="comment" id="<TMPL_VAR COMMENTID>">
|
<TMPL_IF HTML5><article class="comment" id="<TMPL_VAR COMMENTID>">
|
||||||
<TMPL_ELSE><div class="comment" id="<TMPL_VAR COMMENTID>"></TMPL_IF>
|
<TMPL_ELSE><div class="comment" id="<TMPL_VAR COMMENTID>"></TMPL_IF>
|
||||||
|
|
||||||
|
<TMPL_IF COMMENTAUTHORAVATAR><div class="comment-avatar">
|
||||||
|
<img src="<TMPL_VAR COMMENTAUTHORAVATAR>" alt="" />
|
||||||
|
</div></TMPL_IF>
|
||||||
|
|
||||||
<TMPL_IF HTML5><header class="comment-subject"><TMPL_ELSE><div class="comment-subject"></TMPL_IF>
|
<TMPL_IF HTML5><header class="comment-subject"><TMPL_ELSE><div class="comment-subject"></TMPL_IF>
|
||||||
<TMPL_IF PERMALINK>
|
<TMPL_IF PERMALINK>
|
||||||
<a href="<TMPL_VAR PERMALINK>"><TMPL_VAR TITLE></a>
|
<a href="<TMPL_VAR PERMALINK>"><TMPL_VAR TITLE></a>
|
||||||
|
@ -58,4 +62,5 @@ Comment by
|
||||||
<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF>
|
<TMPL_IF HTML5></nav><TMPL_ELSE></div></TMPL_IF>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
|
||||||
|
<div style="clear: both"></div>
|
||||||
<TMPL_IF HTML5></article><TMPL_ELSE></div></TMPL_IF>
|
<TMPL_IF HTML5></article><TMPL_ELSE></div></TMPL_IF>
|
||||||
|
|
Loading…
Reference in New Issue