add #10082 Unarchive all collaboration posts
This commit is contained in:
parent
ecd5b149ca
commit
473fbeab68
4 changed files with 115 additions and 0 deletions
|
|
@ -5,6 +5,7 @@
|
||||||
- fixed #11150: matrix - search boxes all ticked
|
- fixed #11150: matrix - search boxes all ticked
|
||||||
- fixed #11063: template_attachments
|
- fixed #11063: template_attachments
|
||||||
- fixed #11002: Matrix shows backend stuff on load
|
- fixed #11002: Matrix shows backend stuff on load
|
||||||
|
- added #10082: Unarchive all collaboration posts
|
||||||
|
|
||||||
7.8.2
|
7.8.2
|
||||||
- Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi)
|
- Added scheduled vendor payout workflow activity. (Special thanks to Martin @ Oqapi)
|
||||||
|
|
|
||||||
|
|
@ -1572,6 +1572,23 @@ sub view {
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 www_edit
|
||||||
|
|
||||||
|
Override the master class to add an "Unarchive All" link.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub www_edit {
|
||||||
|
my $self = shift;
|
||||||
|
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||||
|
return $self->session->privilege->locked() unless $self->canEditIfLocked;
|
||||||
|
my $i18n = WebGUI::International->new($self->session, 'Asset_Collaboration');
|
||||||
|
$self->getAdminConsole->addConfirmedSubmenuItem($self->getUrl('func=unarchiveAll'),$i18n->get("unarchive all"),$i18n->get("unarchive confirm"));
|
||||||
|
return $self->getAdminConsole->render($self->getEditForm->print,$i18n->get("assetName"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 www_search ( )
|
=head2 www_search ( )
|
||||||
|
|
||||||
The web method to display and use the forum search interface.
|
The web method to display and use the forum search interface.
|
||||||
|
|
@ -1627,6 +1644,35 @@ sub www_subscribe {
|
||||||
return $self->www_view;
|
return $self->www_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 www_unarchiveAll ( )
|
||||||
|
|
||||||
|
Unarchive all the threads in this collaboration system
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub www_unarchiveAll {
|
||||||
|
my ( $self ) = @_;
|
||||||
|
my $session = $self->session;
|
||||||
|
return $session->privilege->insufficient() unless $self->canEdit;
|
||||||
|
my $pb = WebGUI::ProgressBar->new($session);
|
||||||
|
my $i18n = WebGUI::International->new($session, 'Asset_Collaboration');
|
||||||
|
$pb->start($i18n->get('unarchive all'), $self->getUrl('func=edit'));
|
||||||
|
my $threadIds = $self->getLineage(['children'],{
|
||||||
|
includeOnlyClasses => [ 'WebGUI::Asset::Post::Thread' ],
|
||||||
|
statusToInclude => [ 'archived' ],
|
||||||
|
} );
|
||||||
|
ASSET: foreach my $threadId (@$threadIds) {
|
||||||
|
my $thread = WebGUI::Asset->newPending($session, $threadId);
|
||||||
|
if (!$thread || !$thread->canEdit) {
|
||||||
|
next ASSET;
|
||||||
|
}
|
||||||
|
$thread->unarchive;
|
||||||
|
}
|
||||||
|
return $pb->finish( $self->getUrl('func=edit') );
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 www_unsubscribe ( )
|
=head2 www_unsubscribe ( )
|
||||||
|
|
|
||||||
|
|
@ -1736,6 +1736,18 @@ the Collaboration Asset, the user will be notified.|,
|
||||||
lastUpdated => 1229910435,
|
lastUpdated => 1229910435,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'unarchive all' => {
|
||||||
|
message => q{Unarchive All Threads},
|
||||||
|
context => q{Label for link to unarchive all threads},
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'unarchive confirm' => {
|
||||||
|
message => q{Are you sure? Any threads past the 'Archive After' interval will be re-archived.},
|
||||||
|
context => q{Text for pop-up dialog to confirm unarchive all threads},
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
56
t/Asset/Wobject/Collaboration/unarchiveAll.t
Normal file
56
t/Asset/Wobject/Collaboration/unarchiveAll.t
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
# vim:syntax=perl
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# WebGUI is Copyright 2001-2009 Plain Black Corporation.
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
# Please read the legal notices (docs/legal.txt) and the license
|
||||||
|
# (docs/license.txt) that came with this distribution before using
|
||||||
|
# this software.
|
||||||
|
#------------------------------------------------------------------
|
||||||
|
# http://www.plainblack.com info@plainblack.com
|
||||||
|
#------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Test the unarchiveAll function of the collaboration system
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
use FindBin;
|
||||||
|
use strict;
|
||||||
|
use lib "$FindBin::Bin/../../../lib";
|
||||||
|
use Test::More;
|
||||||
|
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||||
|
use WebGUI::Session;
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Init
|
||||||
|
my $session = WebGUI::Test->session;
|
||||||
|
|
||||||
|
my $collab = WebGUI::Asset->getImportNode( $session )->addChild({
|
||||||
|
className => 'WebGUI::Asset::Wobject::Collaboration',
|
||||||
|
archiveAfter => 60*60*365.25,
|
||||||
|
});
|
||||||
|
|
||||||
|
# Add a thread
|
||||||
|
my @threads = (
|
||||||
|
$collab->addChild({
|
||||||
|
className => 'WebGUI::Asset::Post::Thread',
|
||||||
|
status => 'archived',
|
||||||
|
title => 'Archived',
|
||||||
|
}, undef, undef, { skipAutoCommitWorkflows => 1 }),
|
||||||
|
);
|
||||||
|
|
||||||
|
my $tag = WebGUI::VersionTag->getWorking( $session );
|
||||||
|
$tag->commit;
|
||||||
|
WebGUI::Test->tagsToRollback($tag);
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# Tests
|
||||||
|
|
||||||
|
plan tests => 1; # Increment this number for each test you create
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# www_unarchiveAll sets all threads to approved
|
||||||
|
$collab->www_unarchiveAll;
|
||||||
|
$threads[0] = WebGUI::Asset->newByDynamicClass( $session, $threads[0]->getId );
|
||||||
|
is( $threads[0]->get('status'), 'approved', "unarchiveAll sets thread to approved" );
|
||||||
|
|
||||||
|
#vim:ft=perl
|
||||||
Loading…
Add table
Add a link
Reference in a new issue