merging 6.5.6 bugfixes
This commit is contained in:
parent
cd83598f7c
commit
a58f2786f7
15 changed files with 207 additions and 88 deletions
|
|
@ -59,15 +59,16 @@ Returns a boolean indicating whether the user can view the current post.
|
|||
|
||||
sub canView {
|
||||
my $self = shift;
|
||||
if ($self->get("status") eq "approved" || $self->get("status") eq "archived") {
|
||||
return 1;
|
||||
} elsif ($self->get("status") eq "denied" && $self->canEdit) {
|
||||
return 1;
|
||||
} else {
|
||||
return $self->SUPER::canView;
|
||||
}
|
||||
if (($self->get("status") eq "approved" || $self->get("status") eq "archived") && $self->getThread->getParent->canView) {
|
||||
return 1;
|
||||
} elsif ($self->get("status") eq "denied" && $self->canEdit) {
|
||||
return 1;
|
||||
} else {
|
||||
$self->getThread->getParent->canEdit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 chopTitle ( )
|
||||
|
|
@ -429,7 +430,6 @@ sub getTemplateVars {
|
|||
});
|
||||
}
|
||||
}
|
||||
$self->getThread->getParent->appendTemplateLabels(\%var);
|
||||
return \%var;
|
||||
}
|
||||
|
||||
|
|
@ -608,6 +608,7 @@ sub notifySubscribers {
|
|||
my $u = WebGUI::User->new($userId);
|
||||
if ($lang{$u->profileField("language")}{message} eq "") {
|
||||
$lang{$u->profileField("language")}{var} = $self->getTemplateVars($lang{$u->profileField("language")}{var});
|
||||
$self->getThread->getParent->appendTemplateLabels($lang{$u->profileField("language")}{var});
|
||||
$lang{$u->profileField("language")}{var}{url} = WebGUI::URL::getSiteURL().$self->getUrl;
|
||||
$lang{$u->profileField("language")}{var}{'notify.subscription.message'} =
|
||||
WebGUI::International::get(875,"Asset_Post",$u->profileField("language"));
|
||||
|
|
@ -708,6 +709,30 @@ sub rate {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( id, date )
|
||||
|
||||
Sets the last reply of this thread.
|
||||
|
||||
=head3 id
|
||||
|
||||
The assetId of the most recent post.
|
||||
|
||||
=head3 date
|
||||
|
||||
The date of the most recent post.
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update(lastPostId=>$id, lastPostDate=>$date);
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -778,6 +803,25 @@ sub setStatusPending {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash
|
||||
|
||||
Moves post to the trash and decrements reply counter on thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getThread->decrementReplies if ($self->isReply);
|
||||
if ($self->getThread->get("lastPostId") eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select assetId, dateSubmitted from Post where lineage like ".quote($threadLineage.'%')." and assetId<>".quote($self->getId)." order by dateSubmitted desc");
|
||||
$self->getThread->setLastPost($id,$date);
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 unmarkRead ( )
|
||||
|
|
|
|||
|
|
@ -509,6 +509,27 @@ sub subscribe {
|
|||
WebGUI::Grouping::addUsersToGroups([$session{user}{userId}],[$self->get("subscriptionGroupId")]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash
|
||||
|
||||
Moves thread to the trash and decrements reply counter on thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub trash {
|
||||
my $self = shift;
|
||||
$self->SUPER::trash;
|
||||
$self->getParent->decrementThreads;
|
||||
if ($self->getParent->get("lastPostId") eq $self->getId) {
|
||||
my $parentLineage = $self->getThread->get("lineage");
|
||||
my ($id, $date) = WebGUI::SQL->quickArray("select assetId, dateSubmitted from Post where lineage like ".quote($parentLineage.'%')." and assetId<>".quote($self->getId)." order by dateSubmitted desc");
|
||||
$self->getParent->setLastPost($id,$date);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 unlock ( )
|
||||
|
|
|
|||
|
|
@ -755,6 +755,29 @@ sub recalculateRating {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setLastPost ( id, date )
|
||||
|
||||
Sets the most recent post in this collaboration system.
|
||||
|
||||
=head3 id
|
||||
|
||||
The assetId of the most recent post.
|
||||
|
||||
=head3 date
|
||||
|
||||
The date of the most recent post.
|
||||
|
||||
=cut
|
||||
|
||||
sub setLastPost {
|
||||
my $self = shift;
|
||||
my $id = shift;
|
||||
my $date = shift;
|
||||
$self->update(lastPostId=>$id, lastPostDate=>$date);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 subscribe ( )
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ sub view {
|
|||
WebGUI::Style::setLink($session{config}{extrasURL}."/draggable.css",{ type=>"text/css", rel=>"stylesheet", media=>"all" });
|
||||
$vars{"dragger.icon"} = WebGUI::Icon::dragIcon();
|
||||
$vars{"dragger.init"} = '
|
||||
<iframe id="dragSubmitter" style="display: none;"></iframe>
|
||||
<iframe id="dragSubmitter" style="display: none;" src="'.$session{config}{extrasURL}.'/spacer.gif"></iframe>
|
||||
<script>
|
||||
dragable_init("'.$self->getUrl("func=setContentPositions&map=").'");
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ sub getEditForm {
|
|||
name=>"returnUrl",
|
||||
value=>$session{form}{returnUrl}
|
||||
});
|
||||
my ($descendantsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my ($descendantsChecked, $ancestorsChecked, $selfChecked, $pedigreeChecked, $siblingsChecked);
|
||||
my @assetsToInclude = split("\n",$self->getValue("assetsToInclude"));
|
||||
my $afterScript;
|
||||
foreach my $item (@assetsToInclude) {
|
||||
|
|
@ -94,6 +94,8 @@ sub getEditForm {
|
|||
} elsif ($item eq "descendants") {
|
||||
$descendantsChecked = 1;
|
||||
$afterScript = "displayNavEndPoint = false;";
|
||||
} elsif ($item eq "ancestors") {
|
||||
$ancestorsChecked = 1;
|
||||
} elsif ($item eq "siblings") {
|
||||
$siblingsChecked = 1;
|
||||
} elsif ($item eq "pedigree") {
|
||||
|
|
@ -118,7 +120,7 @@ sub getEditForm {
|
|||
$tabform->getTab("properties")->readOnly(
|
||||
-label=>"Relatives to Include",
|
||||
-value=>WebGUI::Form::checkbox({
|
||||
checked=>$selfChecked,
|
||||
checked=>$ancestorsChecked,
|
||||
name=>"assetsToInclude",
|
||||
value=>"ancestors"
|
||||
}).'Ancestors<br />'
|
||||
|
|
@ -265,16 +267,16 @@ sub view {
|
|||
if ($self->get("startType") eq "specificUrl") {
|
||||
$start = WebGUI::Asset->newByUrl($self->get("startPoint"));
|
||||
} elsif ($self->get("startType") eq "relativeToRoot") {
|
||||
unless (($self->get("startPoint")+1) >= $self->getLineageLength) {
|
||||
$start = WebGUI::Asset->newByLineage(substr($session{asset}->get("lineage"),0, ($self->get("startPoint") + 1) * 6));
|
||||
unless (($self->get("startPoint")+1) >= $current->getLineageLength) {
|
||||
$start = WebGUI::Asset->newByLineage(substr($current->get("lineage"),0, ($self->get("startPoint") + 1) * 6));
|
||||
}
|
||||
} elsif ($self->get("startType") eq "relativeToCurrentUrl") {
|
||||
if ($self->get("startPoint") < 0) {
|
||||
$start = WebGUI::Asset->newByLineage(substr($session{asset}->get("lineage"),0,
|
||||
($session{asset}->getLineageLength - $self->get("startPoint") + 1) * 6
|
||||
$start = WebGUI::Asset->newByLineage(substr($current->get("lineage"),0,
|
||||
($current->getLineageLength - $self->get("startPoint") + 1) * 6
|
||||
));
|
||||
} elsif ($self->get("startPoint") > 0) {
|
||||
my $lineage = $session{asset}->getLineage;
|
||||
my $lineage = $current->getLineage;
|
||||
for (1..$self->get("startPoint")) {
|
||||
$lineage .= $self->formatRank(1);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue