added: Ability to enable / disable archiving per Collaboration System. fixed Mech tests again

This commit is contained in:
Doug Bell 2008-04-28 02:07:56 +00:00
parent 3316f2a0f4
commit aae6a32df4
6 changed files with 50 additions and 2 deletions

View file

@ -44,6 +44,8 @@
- added: DataForm now can use CAPTCHA for Visitors
- Spent some time cleaning up DataForm, but it could use more.
- added: Commit Version Tag screen shows revisions in the tag
- added: Ability to enable/disable Thread archiving on a per-Collaboration
basis
7.5.10

View file

@ -44,9 +44,22 @@ upgradeEMS($session);
migrateOldProduct($session);
mergeProductsWithCommerce($session);
addCaptchaToDataForm( $session );
addArchiveEnabledToCollaboration( $session );
finish($session); # this line required
#----------------------------------------------------------------------------
# Add the archiveEnabled field to Collaboration assets
sub addArchiveEnabledToCollaboration {
my $session = shift;
print "\tAdding archiveEnabled to Collaboration... " unless $quiet;
$session->db->write(
q{ ALTER TABLE Collaboration ADD COLUMN archiveEnabled INT(1) DEFAULT 1 }
);
print "DONE!\n" unless $quiet;
}
#----------------------------------------------------------------------------
# Add the useCaptcha field to DataForm assets
sub addCaptchaToDataForm {

View file

@ -552,6 +552,13 @@ sub definition {
label=>$i18n->get('posts/page'),
hoverHelp=>$i18n->get('posts/page description'),
},
archiveEnabled => {
fieldType => "yesNo",
defaultValue => 1,
tab => 'properties',
label => $i18n->get('editForm archiveEnabled label'),
hoverHelp => $i18n->get('editForm archiveEnabled description'),
},
archiveAfter =>{
fieldType=>"interval",
defaultValue=>31536000,

View file

@ -74,6 +74,7 @@ sub execute {
while (my ($assetId) = $a->array) {
my $cs = WebGUI::Asset->new($self->session, $assetId, "WebGUI::Asset::Wobject::Collaboration");
next unless defined $cs;
next unless $cs->get("archiveEnabled");
my $archiveDate = $epoch - $cs->get("archiveAfter");
my $sql = "select asset.assetId, assetData.revisionDate from Post left join asset on asset.assetId=Post.assetId
left join assetData on Post.assetId=assetData.assetId and Post.revisionDate=assetData.revisionDate

View file

@ -1633,6 +1633,19 @@ the Collaboration Asset, the user will be notified.|,
message => q|Verify your humanity|,
lastUpdated => 1170543345,
},
'editForm archiveEnabled label' => {
message => q{Enable Archiving?},
lastUpdated => 0,
context => q{Label for asset property},
},
'editForm archiveEnabled description' => {
message => q{If Yes, Threads will be automatically hidden after a certain interval},
lastUpdated => 0,
context => q{Hover help for asset property},
},
};
1;

View file

@ -65,7 +65,17 @@ for my $i ( 0 .. 5 ) {
$versionTag->commit;
# Override some settings to make things easier to test
my %oldSettings;
# userFunctionStyleId
$oldSettings{ userFunctionStyleId } = $session->setting->get( 'userFunctionStyleId' );
$session->setting->set( 'userFunctionStyleId', 'PBtmpl0000000000000132' );
# specialState
$oldSettings{ specialState } = $session->setting->get( 'specialState' );
$session->setting->set( 'specialState', '' );
my ( $mech );
my $baseUrl = 'http://' . $session->config->get('sitename')->[0];
#----------------------------------------------------------------------------
# Tests
@ -79,8 +89,7 @@ if ( !$mech->success ) {
plan skip_all => "Cannot load URL '$baseUrl'. Will not test.";
}
plan tests => 2;
plan tests => 1;
#----------------------------------------------------------------------------
# Test www_viewRss
@ -114,4 +123,7 @@ cmp_deeply(
# Cleanup
END {
$versionTag->rollback();
for my $key ( keys %oldSettings ) {
$session->setting->set( $key, $oldSettings{ $key } );
}
}