forward port of 6.8.4 avatar changes, -r 357:369
This commit is contained in:
parent
73531dfa5f
commit
da95226072
6 changed files with 2124 additions and 1809 deletions
|
|
@ -234,6 +234,35 @@ sub getApproveUrl {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getAvatarUrl ( )
|
||||
|
||||
Returns a URL to the owner's avatar.
|
||||
|
||||
=cut
|
||||
|
||||
sub getAvatarUrl {
|
||||
my $self = shift;
|
||||
my $avatarUrl;
|
||||
return $avatarUrl unless
|
||||
$self->getThread->getParent->getValue("avatarsEnabled");
|
||||
my $user = WebGUI::User->new($self->get('ownerUserId'));
|
||||
#Get avatar field, storage Id.
|
||||
my $storageId = $user->profileField("avatar");
|
||||
my $avatar = WebGUI::Storage::Image->get($storageId);
|
||||
if ($avatar) {
|
||||
#Get url from storage object.
|
||||
foreach my $imageName (@{$avatar->getFiles}) {
|
||||
if ($avatar->isImage($imageName)) {
|
||||
$avatarUrl = $avatar->getUrl($imageName);
|
||||
last;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $avatarUrl;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getDeleteUrl ( )
|
||||
|
||||
Formats the url to delete a post.
|
||||
|
|
@ -386,6 +415,7 @@ sub getTemplateVars {
|
|||
my %var = %{$self->get};
|
||||
$var{"userId"} = $self->get("ownerUserId");
|
||||
$var{"user.isPoster"} = $self->isPoster;
|
||||
$var{"avatar.url"} = $self->getAvatarUrl;
|
||||
$var{"userProfile.url"} = $self->getUrl("op=viewProfile;uid=".$self->get("ownerUserId"));
|
||||
$var{"dateSubmitted.human"} = epochToHuman($self->get("dateSubmitted"));
|
||||
$var{"dateUpdated.human"} = epochToHuman($self->get("dateUpdated"));
|
||||
|
|
|
|||
|
|
@ -82,25 +82,6 @@ sub appendPostListTemplateVars {
|
|||
} else {
|
||||
$url = $post->getUrl."#".$post->getId;
|
||||
}
|
||||
my $avatarUrl;
|
||||
if ($self->get('avatarsEnabled')) {
|
||||
#ownerUserId from post
|
||||
#Create user object.
|
||||
my $user = WebGUI::User->new($post->get('ownerUserId'));
|
||||
#Get avatar field, storage Id.
|
||||
my $storageId = $user->profileField("avatar");
|
||||
my $avatar = WebGUI::Storage::Image->get($storageId);
|
||||
if ($avatar) {
|
||||
#Get url from storage object.
|
||||
foreach my $imageName (@{$avatar->getFiles}) {
|
||||
if ($avatar->isImage($imageName)) {
|
||||
$avatarUrl = $avatar->getThumbnailUrl($imageName);
|
||||
last;
|
||||
}
|
||||
}
|
||||
$avatarUrl = $avatar->getUrl;
|
||||
}
|
||||
}
|
||||
push(@{$var->{post_loop}}, {
|
||||
%{$post->get},
|
||||
"id"=>$post->getId,
|
||||
|
|
@ -124,7 +105,7 @@ sub appendPostListTemplateVars {
|
|||
"isFourth"=>(($i+1)%4==0),
|
||||
"isFifth"=>(($i+1)%5==0),
|
||||
"user.isPoster"=>$post->isPoster,
|
||||
"avatar.url"=>$avatarUrl,
|
||||
"avatar.url"=>$post->getAvatarUrl,
|
||||
%lastReply
|
||||
});
|
||||
$i++;
|
||||
|
|
@ -445,8 +426,6 @@ sub duplicate {
|
|||
return $newAsset;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getEditForm {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -1072,6 +1072,11 @@ A conditional indicating that is true if this Post is the fifth in this Collabor
|
|||
<b>user.isPoster</b><br>
|
||||
A conditional indicating that is true if the current user submitted this Post.
|
||||
|
||||
<p>
|
||||
<b>avatar.url</b><br>
|
||||
A URL to the avatar for the owner of the Post, if avatars are enabled and the
|
||||
user has an avatar.
|
||||
|
||||
<p>
|
||||
<b>lastReply.*</b><br>
|
||||
These variables are only defined if the <b>Display last reply</b> property is set to true
|
||||
|
|
|
|||
|
|
@ -312,6 +312,11 @@ The name of the user who last updated or submitted the Post.
|
|||
Another name for <b>rating.value</b>
|
||||
<p>
|
||||
|
||||
<p>
|
||||
<b>avatar.url</b><br>
|
||||
A URL to the avatar for the owner of the Post, if avatars are enabled in the parent
|
||||
Collaboration System and the user has an avatar.
|
||||
|
||||
<b>views</b><br>
|
||||
The number of times that this post has been viewed.
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue