Merge branch 'master' into 8-merge
Conflicts: docs/gotcha.txt lib/WebGUI.pm lib/WebGUI/Asset.pm lib/WebGUI/Asset/File/GalleryFile/Photo.pm lib/WebGUI/Asset/Post.pm lib/WebGUI/Asset/Story.pm lib/WebGUI/Asset/Template.pm lib/WebGUI/Asset/Wobject/Calendar.pm lib/WebGUI/Asset/Wobject/GalleryAlbum.pm lib/WebGUI/Asset/Wobject/Navigation.pm lib/WebGUI/AssetLineage.pm lib/WebGUI/AssetTrash.pm lib/WebGUI/Config.pm lib/WebGUI/Form/Template.pm lib/WebGUI/Group.pm lib/WebGUI/Inbox.pm lib/WebGUI/Workflow/Activity/DeleteExpiredSessions.pm lib/WebGUI/Workflow/Activity/TrashExpiredEvents.pm sbin/testEnvironment.pl t/AdSpace.t t/AdSpace/Ad.t t/Asset/Asset.t t/Asset/AssetExportHtml.t t/Asset/AssetLineage.t t/Asset/EMSSubmissionForm.t t/Asset/Event.t t/Asset/File/GalleryFile/Photo/00base.t t/Asset/File/GalleryFile/Photo/comment.t t/Asset/File/GalleryFile/Photo/download.t t/Asset/File/GalleryFile/Photo/edit.t t/Asset/File/GalleryFile/Photo/exif.t t/Asset/File/GalleryFile/Photo/makeResolutions.t t/Asset/File/GalleryFile/Photo/makeShortcut.t t/Asset/File/Image/setfile.t t/Asset/File/setfile.t t/Asset/Post.t t/Asset/Post/Thread/getAdjacentThread.t t/Asset/Sku.t t/Asset/Sku/ProductCollateral.t t/Asset/Story.t t/Asset/Template.t t/Asset/Template/HTMLTemplateExpr.t t/Asset/Wobject/Gallery/00base.t t/Asset/Wobject/GalleryAlbum/00base.t t/Asset/Wobject/GalleryAlbum/ajax.t t/Asset/Wobject/GalleryAlbum/delete.t t/Asset/Wobject/Matrix.t t/Asset/Wobject/StoryArchive.t t/Asset/Wobject/Survey/ExpressionEngine.t t/Asset/Wobject/Survey/Reports.t t/AssetAspect/RssFeed.t t/Auth/mech.t t/Config.t t/Group.t t/Help/isa.t t/International.t t/Mail/Send.t t/Operation/AdSpace.t t/Operation/Auth.t t/Pluggable.t t/Session.t t/Session/DateTime.t t/Session/ErrorHandler.t t/Session/Scratch.t t/Session/Stow.t t/Shop/Cart.t t/Shop/Pay.t t/Shop/PayDriver/ITransact.t t/Shop/PayDriver/PayPalStd.t t/Shop/Ship.t t/Shop/ShipDriver.t t/Shop/TaxDriver/EU.t t/Shop/TaxDriver/Generic.t t/Shop/Transaction.t t/Shop/Vendor.t t/VersionTag.t t/Workflow/Activity/ArchiveOldStories.t t/Workflow/Activity/ExpireIncompleteSurveyResponses.t t/lib/WebGUI/Test.pm
This commit is contained in:
commit
babfa74209
238 changed files with 4557 additions and 1287 deletions
|
|
@ -118,6 +118,7 @@ sub _fixReplyCount {
|
|||
my $lastPostId = $asset->getLineage( [ qw{ self descendants } ], {
|
||||
isa => 'WebGUI::Asset::Post',
|
||||
orderByClause => 'assetData.revisionDate desc',
|
||||
limit => 1,
|
||||
} )->[0];
|
||||
|
||||
if (my $lastPost = WebGUI::Asset->newById( $self->session, $lastPostId ) ) {
|
||||
|
|
@ -315,6 +316,53 @@ override cut => sub {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 disqualifyAsLastPost ( )
|
||||
|
||||
This method should be called whenever something happens to the Post or Thread that would disqualify
|
||||
it as being the last post in a Thread, or Collaboration System. Good examples are cutting to the
|
||||
clipboard, trashing, or archiving.
|
||||
|
||||
If the Post was the last post, it will find the second to last post for each kind of parent asset,
|
||||
and update that asset with that Post's information.
|
||||
|
||||
=cut
|
||||
|
||||
sub disqualifyAsLastPost {
|
||||
my $self = shift;
|
||||
my $thread = $self->getThread;
|
||||
if ($thread->get('lastPostId') eq $self->getId) {
|
||||
my $secondary_post = $thread->getLineage(['descendants'], {
|
||||
returnObjects => 1,
|
||||
includeOnlyClasses => ["WebGUI::Asset::Post", ],
|
||||
limit => 1,
|
||||
orderByClause => 'revisionDate,lineage DESC',
|
||||
})->[0];
|
||||
if ($secondary_post) { ##Handle edge case for no other
|
||||
$thread->update({ lastPostId => $secondary_post->getId, lastPostDate => $secondary_post->get('creationDate'), });
|
||||
}
|
||||
else {
|
||||
$thread->update({ lastPostId => '', lastPostDate => '', });
|
||||
}
|
||||
}
|
||||
my $cs = $thread->getParent;
|
||||
if ($cs->get('lastPostId') eq $self->getId) {
|
||||
my $secondary_post = $cs->getLineage(['descendants'], {
|
||||
returnObjects => 1,
|
||||
includeOnlyClasses => ["WebGUI::Asset::Post","WebGUI::Asset::Post::Thread"],
|
||||
limit => 1,
|
||||
orderByClause => 'revisionDate DESC',
|
||||
})->[0];
|
||||
if ($secondary_post) { ##Handle edge case for no other
|
||||
$cs->update({ lastPostId => $secondary_post->getId, lastPostDate => $secondary_post->get('creationDate'), });
|
||||
}
|
||||
else {
|
||||
$cs->update({ lastPostId => '', lastPostDate => '', });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 DESTROY
|
||||
|
||||
Extend the base method to delete the locally cached thread object.
|
||||
|
|
@ -1102,6 +1150,22 @@ sub postProcess {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 publish
|
||||
|
||||
Extend the base method to handle updating last post information in the parent Thread
|
||||
and CS.
|
||||
|
||||
=cut
|
||||
|
||||
sub publish {
|
||||
my $self = shift;
|
||||
$self->next::method(@_);
|
||||
$self->qualifyAsLastPost;
|
||||
return 1;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 purge
|
||||
|
||||
Extend the base method to handle cleaning up storage locations.
|
||||
|
|
@ -1149,6 +1213,31 @@ override purgeRevision => sub {
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 qualifyAsLastPost ( )
|
||||
|
||||
This method should be called whenever something happens to the Post or Thread that would qualify
|
||||
it as being the last post in a Thread, or Collaboration System. Good examples are pasting from
|
||||
the clipboard, restoring from the trash, or changing the state from archiving.
|
||||
|
||||
It checks the parent Thread and CS to see if it is now the last Post, and updates that asset with
|
||||
its information.
|
||||
|
||||
=cut
|
||||
|
||||
sub qualifyAsLastPost {
|
||||
my ($self) = @_;
|
||||
my $thread = $self->getThread();
|
||||
if ($self->get('creationDate') > $thread->get('lastPostDate')) {
|
||||
$thread->update({ lastPostId => $self->getId, lastPostDate => $self->get('creationDate'), });
|
||||
}
|
||||
my $cs = $thread->getParent;
|
||||
if ($self->get('creationDate') > $cs->get('lastPostDate')) {
|
||||
$cs->update({ lastPostId => $self->getId, lastPostDate => $self->get('creationDate'), });
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 rate ( rating )
|
||||
|
|
@ -1253,14 +1342,16 @@ override setParent => sub {
|
|||
|
||||
=head2 setStatusArchived ( )
|
||||
|
||||
Sets the status of this post to archived.
|
||||
Sets the status of this post to archived. Updates the parent thread and CS to remove
|
||||
the lastPost, if this post is the last post.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub setStatusArchived {
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'archived'});
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'archived'});
|
||||
$self->disqualifyAsLastPost;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1269,20 +1360,23 @@ sub setStatusArchived {
|
|||
=head2 setStatusUnarchived ( )
|
||||
|
||||
Sets the status of this post to approved, but does so without any of the normal notifications and other stuff.
|
||||
Updates the last post information in the parent Thread and CS if applicable.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub setStatusUnarchived {
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'approved'}) if ($self->status eq "archived");
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'approved'}) if ($self->get("status") eq "archived");
|
||||
$self->qualifyAsLastPost;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash ( )
|
||||
|
||||
Moves post to the trash, updates reply counter on thread and recalculates the thread rating.
|
||||
Moves post to the trash, updates reply counter on thread, recalculates the thread rating,
|
||||
and updates any lastPost information in the parent Thread, and CS.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -1291,22 +1385,8 @@ override trash => sub {
|
|||
super();
|
||||
$self->getThread->sumReplies if ($self->isReply);
|
||||
$self->getThread->updateThreadRating;
|
||||
if ($self->getThread->lastPostId eq $self->getId) {
|
||||
my $threadLineage = $self->getThread->lineage;
|
||||
my ($id, $date) = $self->session->db->quickArray("select assetId, creationDate from asset where
|
||||
lineage like ? and assetId<>? and asset.state='published' and className like 'WebGUI::Asset::Post%'
|
||||
order by creationDate desc",[$threadLineage.'%', $self->getId]);
|
||||
$self->getThread->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
if ($self->getThread->getParent->lastPostId eq $self->getId) {
|
||||
my $forumLineage = $self->getThread->getParent->lineage;
|
||||
my ($id, $date) = $self->session->db->quickArray("select assetId, creationDate from asset where
|
||||
lineage like ? and assetId<>? and asset.state='published' and className like 'WebGUI::Asset::Post%'
|
||||
order by creationDate desc",[$forumLineage.'%', $self->getId]);
|
||||
$self->getThread->getParent->update({lastPostId=>$id, lastPostDate=>$date});
|
||||
}
|
||||
};
|
||||
|
||||
$self->disqualifyAsLastPost;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -1506,6 +1586,7 @@ sub www_edit {
|
|||
$var{'archive.form'} = WebGUI::Form::yesNo($session, {
|
||||
name=>"archive"
|
||||
});
|
||||
$var{'isSubscribedToCs'} = $self->getThread->getParent->isSubscribed;
|
||||
$var{'form.header'} .= WebGUI::Form::hidden($session, {
|
||||
name=>"proceed",
|
||||
value=>"showConfirmation"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue