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");
|
||||
|
|
|
|||
|
|
@ -249,6 +249,10 @@ A boolean indicating whether the resulting asset tree should be returned in reve
|
|||
|
||||
An array reference containing a list of asset classes to include in the result. If this is specified then no other classes except these will be returned. The opposite of the excludeClasses rule.
|
||||
|
||||
=head4 includeArchived
|
||||
|
||||
A boolean indicating that we should include archived assets in the result set.
|
||||
|
||||
=head4 joinClass
|
||||
|
||||
An array reference containing asset classes to join in. There is no real reason to use a joinClass without a whereClause, but it's trivial to use a whereClause if you don't use a joinClass. You will only be able to filter on the asset table, however.
|
||||
|
|
@ -340,7 +344,8 @@ sub getLineage {
|
|||
$where = "asset.state='published'";
|
||||
}
|
||||
## get only approved items or those that i'm currently working on
|
||||
$where .= " and (assetData.status='approved' or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")";
|
||||
my $archived = " or assetData.status='archived' " if ($rules->{includeArchived});
|
||||
$where .= " and (assetData.status='approved' $archived or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")";
|
||||
## class exclusions
|
||||
if (exists $rules->{excludeClasses}) {
|
||||
my @set;
|
||||
|
|
@ -360,7 +365,7 @@ sub getLineage {
|
|||
}
|
||||
# based upon all available criteria, let's get some assets
|
||||
my $columns = "asset.assetId, asset.className, asset.parentId, assetData.revisionDate";
|
||||
$where .= " and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")) ";
|
||||
$where .= " and assetData.revisionDate=(SELECT max(revisionDate) from assetData where assetData.assetId=asset.assetId and (assetData.status='approved' $archived or assetData.tagId=".$self->session->db->quote($self->session->scratch->get("versionTag")).")) ";
|
||||
my $sortOrder = ($rules->{invertTree}) ? "asset.lineage desc" : "asset.lineage asc";
|
||||
if (exists $rules->{orderByClause}) {
|
||||
$sortOrder = $rules->{orderByClause};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,18 @@ package WebGUI::i18n::English::Asset_Collaboration;
|
|||
|
||||
our $I18N = {
|
||||
|
||||
'archive' => {
|
||||
message => q|Archive|,
|
||||
lastUpdated => 0,
|
||||
context => q|thread link|
|
||||
},
|
||||
|
||||
'unarchive' => {
|
||||
message => q|Unarchive|,
|
||||
lastUpdated => 0,
|
||||
context => q|thread link|
|
||||
},
|
||||
|
||||
'mail prefix' => {
|
||||
message => q|Prefix|,
|
||||
lastUpdated => 0,
|
||||
|
|
|
|||
|
|
@ -216,8 +216,12 @@ The URL for this Post.
|
|||
The current rating for this Post.
|
||||
<p>
|
||||
|
||||
<b>rate.url.<i>N</i></b><br>
|
||||
URLs that are used to rate this post. N goes from 1 to 5.
|
||||
<b>rate.url.thumbsUp</b><br>
|
||||
A positive rating.
|
||||
<p>
|
||||
|
||||
<b>rate.url.thumbsDown</b><br>
|
||||
A negative rating.
|
||||
<p>
|
||||
|
||||
<b>hasRated</b><br>
|
||||
|
|
@ -388,7 +392,7 @@ back the data with a simple <tmpl_var userDefined1>.
|
|||
<p>
|
||||
|
||||
|,
|
||||
lastUpdated => 1134670360,
|
||||
lastUpdated => 1145111051,
|
||||
},
|
||||
|
||||
'post received' => {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,14 @@ A weighting factor for difficulty, complexity, or handicap in contests.
|
|||
This is karma divided by karma scale.
|
||||
<p>
|
||||
|
||||
<b>thumbsUp.icon.url</b><br>
|
||||
The URL to the thumbs up icon.
|
||||
<p>
|
||||
|
||||
<b>thumbsDown.icon.url</b><br>
|
||||
The URL to the thumbs down icon.
|
||||
<p>
|
||||
|
||||
<b>user.isVisitor</b><br>
|
||||
A conditional indicating that the current user is a Visitor.
|
||||
<p>
|
||||
|
|
@ -191,7 +199,7 @@ The description of the collaboration system that this post is a part of.
|
|||
<p>
|
||||
|
||||
|,
|
||||
lastUpdated => 1141142205,
|
||||
lastUpdated => 1145111313,
|
||||
},
|
||||
|
||||
'assetName' => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue