added manual thread archive/unarchive options
This commit is contained in:
parent
357794959a
commit
5fe11ed251
6 changed files with 137 additions and 11 deletions
|
|
@ -689,6 +689,7 @@ sub processPropertiesFromFormPost {
|
|||
$self->getThread->lock if ($self->session->form->process('lock'));
|
||||
$self->getThread->stick if ($self->session->form->process("stick"));
|
||||
}
|
||||
$self->getThread->unarchive if ($self->getThread->get("status") eq "archived");
|
||||
}
|
||||
$data{groupIdView} =$self->getThread->getParent->get("groupIdView");
|
||||
$data{groupIdEdit} = $self->getThread->getParent->get("groupIdEdit");
|
||||
|
|
@ -828,14 +829,14 @@ sub setStatusApproved {
|
|||
|
||||
=head2 setStatusArchived ( )
|
||||
|
||||
Sets the status of this post to archived.
|
||||
Sets the status of this post to archived. This will only happen if the post status is approved.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub setStatusArchived {
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'archived'});
|
||||
$self->update({status=>'archived'}) if ($self->get("status") eq "approved");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -873,6 +874,20 @@ sub setStatusPending {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 setStatusUnarchived ( )
|
||||
|
||||
Sets the status of this post to approved, but does so without any of the normal notifications and other stuff.
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub setStatusUnarchived {
|
||||
my ($self) = @_;
|
||||
$self->update({status=>'approved'}) if ($self->get("status") eq "archived");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 trash
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ use WebGUI::Utility;
|
|||
|
||||
our @ISA = qw(WebGUI::Asset::Post);
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub archive {
|
||||
my $self = shift;
|
||||
foreach my $post (@{$self->getPosts}) {
|
||||
$post->setStatusArchived;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub canReply {
|
||||
|
|
@ -121,6 +128,19 @@ sub DESTROY {
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getArchiveUrl ( )
|
||||
|
||||
Formats the url to set the status of a thread archived.
|
||||
|
||||
=cut
|
||||
|
||||
sub getArchiveUrl {
|
||||
my $self = shift;
|
||||
$self->getUrl("func=archive");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getLastPost {
|
||||
my $self = shift;
|
||||
|
|
@ -204,6 +224,19 @@ sub getNextThread {
|
|||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPosts ( )
|
||||
|
||||
Returns a list of the post objects in this thread, including the thread post itself.
|
||||
|
||||
=cut
|
||||
|
||||
sub getPosts {
|
||||
my $self = shift;
|
||||
$self->getLineage(["self","descendants"], {returnObjects=>1});
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getPreviousThread ( )
|
||||
|
|
@ -274,6 +307,19 @@ sub getThread {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getUnarchiveUrl ( )
|
||||
|
||||
Formats the url to set the status of a thread unarchived.
|
||||
|
||||
=cut
|
||||
|
||||
sub getUnarchiveUrl {
|
||||
my $self = shift;
|
||||
$self->getUrl("func=unarchive");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getUnlockUrl ( )
|
||||
|
||||
Formats the url to unlock the thread
|
||||
|
|
@ -590,6 +636,21 @@ sub trash {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 unarchive ( )
|
||||
|
||||
Unarchives this thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub unarchive {
|
||||
my $self = shift;
|
||||
foreach my $post (@{$self->getPosts}) {
|
||||
$post->setStatusUnarchived;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 unlock ( )
|
||||
|
|
@ -657,6 +718,10 @@ sub view {
|
|||
$var->{'subscribe.url'} = $self->getSubscribeUrl;
|
||||
$var->{'unsubscribe.url'} = $self->getUnsubscribeUrl;
|
||||
|
||||
$var->{'isArchived'} = $self->get("status") eq "archived";
|
||||
$var->{'archive.url'} = $self->getArchivedUrl;
|
||||
$var->{'unarchive.url'} = $self->getUnarchivedUrl;
|
||||
|
||||
$var->{'isSticky'} = $self->isSticky;
|
||||
$var->{'stick.url'} = $self->getStickUrl;
|
||||
$var->{'unstick.url'} = $self->getUnstickUrl;
|
||||
|
|
@ -720,6 +785,20 @@ sub view {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_archive ( )
|
||||
|
||||
The web method to archive all the posts in this thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_archive {
|
||||
my $self = shift;
|
||||
$self->archive if ($self->canEdit);
|
||||
return $self->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_lock ( )
|
||||
|
|
@ -764,6 +843,20 @@ sub www_subscribe {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_unarchive ( )
|
||||
|
||||
The web method to unarchive all the posts in this thread.
|
||||
|
||||
=cut
|
||||
|
||||
sub www_unarchive {
|
||||
my $self = shift;
|
||||
$self->unarchive if ($self->canEdit);
|
||||
return $self->www_view;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_unlock ( )
|
||||
|
||||
The web method to unlock a thread.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue