updated thread templates to remove approve/deny links and add archive/unarchive links
fixed unarchive bug changed post rating system to thumbs up/down
This commit is contained in:
parent
f503b4328e
commit
404749e32b
13 changed files with 68 additions and 64 deletions
|
|
@ -447,11 +447,8 @@ sub getTemplateVars {
|
|||
$var{'reply.withquote.url'} = $self->getReplyUrl(1);
|
||||
$var{'url'} = $self->getUrl.'#id'.$self->getId;
|
||||
$var{'rating.value'} = $self->get("rating")+0;
|
||||
$var{'rate.url.1'} = $self->getRateUrl(1);
|
||||
$var{'rate.url.2'} = $self->getRateUrl(2);
|
||||
$var{'rate.url.3'} = $self->getRateUrl(3);
|
||||
$var{'rate.url.4'} = $self->getRateUrl(4);
|
||||
$var{'rate.url.5'} = $self->getRateUrl(5);
|
||||
$var{'rate.url.thumbsUp'} = $self->getRateUrl(1);
|
||||
$var{'rate.url.thumbsDown'} = $self->getRateUrl(-1);
|
||||
$var{'hasRated'} = $self->hasRated;
|
||||
my $gotImage;
|
||||
my $gotAttachment;
|
||||
|
|
@ -773,16 +770,14 @@ An integer between 1 and 5 (5 being best) to rate this post with.
|
|||
|
||||
sub rate {
|
||||
my $self = shift;
|
||||
my $rating = shift || 3;
|
||||
my $rating = shift;
|
||||
return undef unless ($rating == -1 || $rating == 1);
|
||||
unless ($self->hasRated) {
|
||||
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values ("
|
||||
.$self->session->db->quote($self->getId).", ".$self->session->db->quote($self->session->user->userId).", ".$self->session->db->quote($self->session->env->get("REMOTE_ADDR")).",
|
||||
".$self->session->datetime->time().", ".$self->session->db->quote($rating).")");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Post_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
$count = $count || 1;
|
||||
my ($sum) = $self->session->db->quickArray("select sum(rating) from Post_rating where assetId=".$self->session->db->quote($self->getId));
|
||||
my $average = WebGUI::Utility::round($sum/$count);
|
||||
$self->update({rating=>$average});
|
||||
$self->update({rating=>$sum});
|
||||
$self->getThread->rate($rating);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ Returns a list of the post objects in this thread, including the thread post its
|
|||
|
||||
sub getPosts {
|
||||
my $self = shift;
|
||||
$self->getLineage(["self","descendants"], {returnObjects=>1});
|
||||
$self->getLineage(["self","descendants"], {returnObjects=>1, includeArchived=>1});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -548,15 +548,13 @@ An integer between 1 and 5 (5 being best) to rate this post with.
|
|||
sub rate {
|
||||
my $self = shift;
|
||||
my $rating = shift;
|
||||
return undef unless ($rating == -1 || $rating == 1);
|
||||
unless ($self->hasRated) {
|
||||
$self->session->db->write("insert into Post_rating (assetId,userId,ipAddress,dateOfRating,rating) values ("
|
||||
.$self->session->db->quote($self->getId).", ".$self->session->db->quote($self->session->user->userId).", ".$self->session->db->quote($self->session->env->get("REMOTE_ADDR")).",
|
||||
".$self->session->datetime->time().", ".$self->session->db->quote($rating).")");
|
||||
my ($count) = $self->session->db->quickArray("select count(*) from Post left join asset on Post.assetId=asset.assetId where Post.threadId=".$self->session->db->quote($self->getId)." and Post.rating>0");
|
||||
$count = $count || 1;
|
||||
my ($sum) = $self->session->db->quickArray("select sum(Post.rating) from Post left join asset on Post.assetId=asset.assetId where Post.threadId=".$self->session->db->quote($self->getId)." and Post.rating>0");
|
||||
my $average = round($sum/$count);
|
||||
$self->update({rating=>$average});
|
||||
$self->update({rating=>$sum});
|
||||
if ($self->session->setting->get("useKarma")) {
|
||||
my $poster = WebGUI::User->new($self->session, $self->get("ownerUserId"));
|
||||
$poster->karma($rating*$self->getParent->get("karmaRatingMultiplier"),"collaboration rating","someone rated post ".$self->getId);
|
||||
|
|
@ -761,6 +759,9 @@ sub view {
|
|||
$var->{'subscribe.url'} = $self->getSubscribeUrl;
|
||||
$var->{'unsubscribe.url'} = $self->getUnsubscribeUrl;
|
||||
|
||||
$var->{'thumbsUp.icon.url'} = $self->session->config->get("extrasURL").'/thumbup.gif';
|
||||
$var->{'thumbsDown.icon.url'} = $self->session->config->get("extrasURL").'/thumbdown.gif';
|
||||
|
||||
$var->{'isArchived'} = $self->get("status") eq "archived";
|
||||
$var->{'archive.url'} = $self->getArchiveUrl;
|
||||
$var->{'unarchive.url'} = $self->getUnarchiveUrl;
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ sub appendTemplateLabels {
|
|||
$var->{"addquestion.label"} = $i18n->get("addquestion");
|
||||
$var->{'answer.label'} = $i18n->get("answer");
|
||||
$var->{'attachment.label'} = $i18n->get("attachment");
|
||||
$var->{'archive.label'} = $i18n->get("archive");
|
||||
$var->{'unarchive.label'} = $i18n->get("unarchive");
|
||||
$var->{"by.label"} = $i18n->get("by");
|
||||
$var->{'body.label'} = $i18n->get("body");
|
||||
$var->{"back.label"} = $i18n->get("back");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue