more tests, started coding for real...
This commit is contained in:
parent
3ed18c775b
commit
ccc9e36e25
4 changed files with 121 additions and 22 deletions
|
|
@ -36,6 +36,22 @@ use Tie::IxHash;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
|
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
=head2 canSubmit
|
||||||
|
|
||||||
|
returns true is the current user can submit to any form attached to this EMS
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub canSubmit {
|
||||||
|
my $self = shift;
|
||||||
|
my $user = $self->session->user;
|
||||||
|
for my $groupId (split ' ', $self->get('eventSubmissionGroups')) {
|
||||||
|
return 1 if $user->isInGroup($groupId);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub definition {
|
sub definition {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
|
|
@ -109,27 +125,27 @@ sub definition {
|
||||||
},
|
},
|
||||||
eventSubmissionTemplateId => {
|
eventSubmissionTemplateId => {
|
||||||
fieldType => 'template',
|
fieldType => 'template',
|
||||||
defaultValue => 'yBwydfooiLvhEFawJb0VTQ',
|
defaultValue => 'eventSubmissionTmplt01',
|
||||||
tab => 'display',
|
tab => 'display',
|
||||||
label => $i18n->get('print ticket template'),
|
label => $i18n->get('print ticket template'),
|
||||||
hoverHelp => $i18n->get('print ticket template help'),
|
hoverHelp => $i18n->get('print ticket template help'),
|
||||||
namespace => 'EMS/PrintTicket',
|
namespace => 'EMS/SubmissionForm',
|
||||||
},
|
},
|
||||||
viewEventSubmissionQueueTemplateId => {
|
viewEventSubmissionQueueTemplateId => {
|
||||||
fieldType => 'template',
|
fieldType => 'template',
|
||||||
defaultValue => 'yBwydfooiLvhEFawJb0VTQ',
|
defaultValue => 'eventQueueTmplate00001',
|
||||||
tab => 'display',
|
tab => 'display',
|
||||||
label => $i18n->get('print ticket template'),
|
label => $i18n->get('print ticket template'),
|
||||||
hoverHelp => $i18n->get('print ticket template help'),
|
hoverHelp => $i18n->get('print ticket template help'),
|
||||||
namespace => 'EMS/PrintTicket',
|
namespace => 'EMS/SubmissionQueue',
|
||||||
},
|
},
|
||||||
editEventSubmissionTemplateId => {
|
editEventSubmissionTemplateId => {
|
||||||
fieldType => 'template',
|
fieldType => 'template',
|
||||||
defaultValue => 'yBwydfooiLvhEFawJb0VTQ',
|
defaultValue => 'editEventSubmissionT01',
|
||||||
tab => 'display',
|
tab => 'display',
|
||||||
label => $i18n->get('print ticket template'),
|
label => $i18n->get('print ticket template'),
|
||||||
hoverHelp => $i18n->get('print ticket template help'),
|
hoverHelp => $i18n->get('print ticket template help'),
|
||||||
namespace => 'EMS/PrintTicket',
|
namespace => 'EMS/EditSubmission',
|
||||||
},
|
},
|
||||||
badgeInstructions => {
|
badgeInstructions => {
|
||||||
fieldType => 'HTMLArea',
|
fieldType => 'HTMLArea',
|
||||||
|
|
@ -403,6 +419,28 @@ sub getTokens {
|
||||||
return $self->getLineage(['children'],{returnObjects=>1, includeOnlyClasses=>['WebGUI::Asset::Sku::EMSToken']});
|
return $self->getLineage(['children'],{returnObjects=>1, includeOnlyClasses=>['WebGUI::Asset::Sku::EMSToken']});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
=head2 hasForms
|
||||||
|
|
||||||
|
returns true if the EMS has subission forms attached
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub hasForms {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
=head2 hasSubmissions
|
||||||
|
|
||||||
|
returns true if the current user has submission forms in this EMS
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub hasSubmissions {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
=head2 isRegistrationStaff ( [ user ] )
|
=head2 isRegistrationStaff ( [ user ] )
|
||||||
|
|
@ -498,9 +536,16 @@ sub view {
|
||||||
addBadgeUrl => $self->getUrl('func=add;class=WebGUI::Asset::Sku::EMSBadge'),
|
addBadgeUrl => $self->getUrl('func=add;class=WebGUI::Asset::Sku::EMSBadge'),
|
||||||
buildBadgeUrl => $self->getUrl('func=buildBadge'),
|
buildBadgeUrl => $self->getUrl('func=buildBadge'),
|
||||||
viewScheduleUrl => $self->getUrl('func=viewSchedule'),
|
viewScheduleUrl => $self->getUrl('func=viewSchedule'),
|
||||||
|
newSubmissionUrl => $self->getUrl('func=newSubmission'),
|
||||||
|
viewSubmissionsUrl => $self->getUrl('func=viewSubmissions'),
|
||||||
|
viewSubmissionQueueUrl => $self->getUrl('func=viewSubmissionQueue'),
|
||||||
|
addSubmissionFormUrl => $self->getUrl('func=addSubmissionForm'),
|
||||||
manageBadgeGroupsUrl=> $self->getUrl('func=manageBadgeGroups'),
|
manageBadgeGroupsUrl=> $self->getUrl('func=manageBadgeGroups'),
|
||||||
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
|
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
|
||||||
canEdit => $self->canEdit,
|
canEdit => $self->canEdit,
|
||||||
|
canSubmit => $self->canSubmit,
|
||||||
|
hasSubmissions => $self->hasSubmissions,
|
||||||
|
hasForms => $self->hasForms,
|
||||||
lookupRegistrantUrl => $self->getUrl('func=lookupRegistrant'),
|
lookupRegistrantUrl => $self->getUrl('func=lookupRegistrant'),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,21 @@ our $I18N = { ##hashref of hashes
|
||||||
lastUpdated => 1131394072,
|
lastUpdated => 1131394072,
|
||||||
context => q|This is the label used to describe the EMS submission cleanup activity|
|
context => q|This is the label used to describe the EMS submission cleanup activity|
|
||||||
},
|
},
|
||||||
|
'past deadline message' => {
|
||||||
|
message => q|The deadline for this submission is past, no more submissions will be taken at this time.|,
|
||||||
|
lastUpdated => 1131394072,
|
||||||
|
context => q|This is the default message for informing the user that the submission deadline is past.|
|
||||||
|
},
|
||||||
|
'past deadline label' => {
|
||||||
|
message => q|Post SUbmission Deadline Text|,
|
||||||
|
lastUpdated => 1131394072,
|
||||||
|
context => q|This is the label for the message indicating that the deadline for submissions has past.|
|
||||||
|
},
|
||||||
|
'past deadline label help' => {
|
||||||
|
message => q|Enter a message here to let the user know that submissions are no longer being taken because the deadline has past.|,
|
||||||
|
lastUpdated => 1131394072,
|
||||||
|
context => q|This help text should describe how the user tells submitters that the submission deadline has past.|
|
||||||
|
},
|
||||||
|
|
||||||
# 'TODO' => {
|
# 'TODO' => {
|
||||||
# message => q|TODO|,
|
# message => q|TODO|,
|
||||||
|
|
|
||||||
|
|
@ -1878,6 +1878,36 @@ normal templates.|,
|
||||||
context => q|help text for the columns per page field|,
|
context => q|help text for the columns per page field|,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'new submission form' => {
|
||||||
|
message => q|New Submission Form|,
|
||||||
|
lastUpdated => 1147050475,
|
||||||
|
context => q|Label for the link to create a new submission form.|,
|
||||||
|
},
|
||||||
|
|
||||||
|
'view submission queue' => {
|
||||||
|
message => q|Submission Queue|,
|
||||||
|
lastUpdated => 1147050475,
|
||||||
|
context => q|Label for link to view submission queue.|,
|
||||||
|
},
|
||||||
|
|
||||||
|
'new submission' => {
|
||||||
|
message => q|New Submission|,
|
||||||
|
lastUpdated => 1147050475,
|
||||||
|
context => q|Label for link to create a new submission for an event.|,
|
||||||
|
},
|
||||||
|
|
||||||
|
'view my submissions' => {
|
||||||
|
message => q|My Submissions|,
|
||||||
|
lastUpdated => 1147050475,
|
||||||
|
context => q|Label for link to view submissions owned by current user.|,
|
||||||
|
},
|
||||||
|
|
||||||
|
# 'TODO' => {
|
||||||
|
# message => q|TODO|,
|
||||||
|
# lastUpdated => 1147050475,
|
||||||
|
# context => q|TODO|,
|
||||||
|
# },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
|
|
@ -119,20 +119,23 @@ WebGUI::Test->tagsToRollback($versionTag);
|
||||||
|
|
||||||
loginRgstr;
|
loginRgstr;
|
||||||
|
|
||||||
|
is( $ems->hasForms, 0, 'ems currently has no forms' );
|
||||||
|
|
||||||
my $frmA = $ems->addChild({
|
my $frmA = $ems->addChild({
|
||||||
className => 'WebGUI::Asset::EMSSubmissionForm',
|
className => 'WebGUI::Asset::EMSSubmissionForm',
|
||||||
title => 'test A -- long',
|
title => 'test A -- long',
|
||||||
canSubmitGroup => $submitGroupA->getId,
|
canSubmitGroup => $submitGroupA->getId,
|
||||||
daysBeforeCleanup => 1,
|
daysBeforeCleanup => 1,
|
||||||
formDescription => q{ {
|
formDescription => q{ {
|
||||||
'title' : { 'type' : 'text' },
|
'title' : { 'type' : 'text' },
|
||||||
'description' : { 'type' : 'textarea' },
|
'description' : { 'type' : 'textarea' },
|
||||||
'duration' : { 'default' : 2.0 },
|
'duration' : { 'default' : 2.0 },
|
||||||
'startDate' : { 'type' : 'selectList', 'options' :
|
'startDate' : { 'type' : 'selectList', 'options' :
|
||||||
[ '1255150800', '1255237200', '1255323600' ] },
|
[ '1255150800', '1255237200', '1255323600' ] },
|
||||||
} },
|
} },
|
||||||
});
|
});
|
||||||
isa_ok( $frmA, 'WebGUI::Asset::EMSSubmissionForm' );
|
isa_ok( $frmA, 'WebGUI::Asset::EMSSubmissionForm' );
|
||||||
|
is( $ems->hasForms, 1, 'ems now has forms' );
|
||||||
ok( $frmA->validateSubmission({
|
ok( $frmA->validateSubmission({
|
||||||
title => 'titlea',
|
title => 'titlea',
|
||||||
description => 'the description',
|
description => 'the description',
|
||||||
|
|
@ -170,13 +173,14 @@ my $frmB = $ems->addChild({
|
||||||
daysBeforeCleanup => 0,
|
daysBeforeCleanup => 0,
|
||||||
canSubmitGroup => $submitGroupB->getId,
|
canSubmitGroup => $submitGroupB->getId,
|
||||||
formDescription => q{ {
|
formDescription => q{ {
|
||||||
'title' : { 'type' : 'text' },
|
'title' : { 'type' : 'text' },
|
||||||
'description' : { 'type' : 'textarea' },
|
'description' : { 'type' : 'textarea' },
|
||||||
'duration' : { 'default' : 0.5 },
|
'duration' : { 'default' : 0.5 },
|
||||||
'startDate' : { 'default' : '1255150800' },
|
'startDate' : { 'default' : '1255150800' },
|
||||||
'metaField1' : { 'type' : 'Url' },
|
'metaField1' : { 'type' : 'Url' },
|
||||||
} },
|
} },
|
||||||
});
|
});
|
||||||
|
is( $ems->hasForms, 1, 'ems still has forms' );
|
||||||
ok( $frmA->validateSubmission({
|
ok( $frmA->validateSubmission({
|
||||||
title => 'title',
|
title => 'title',
|
||||||
description => 'description',
|
description => 'description',
|
||||||
|
|
@ -188,19 +192,26 @@ ok( !$frmA->validateSubmission({
|
||||||
metaField1 => 'joe@sams.org',
|
metaField1 => 'joe@sams.org',
|
||||||
}), 'invalid submission: test invalid metafield value' );
|
}), 'invalid submission: test invalid metafield value' );
|
||||||
|
|
||||||
|
logout;
|
||||||
|
|
||||||
|
is( $ems->canSubmit, 0, 'current user cannot submit to this ems' );
|
||||||
|
|
||||||
loginUserA;
|
loginUserA;
|
||||||
|
|
||||||
|
is( $ems->canSubmit, 1, 'current user can submit to this ems' );
|
||||||
|
is( $ems->hasSubmissions, 0, 'current user has no submissions' );
|
||||||
# this one should work
|
# this one should work
|
||||||
my $sub1 = $frmA->addSubmission({
|
my $sub1 = $frmA->addSubmission({
|
||||||
title => 'my favorite thing to talk about',
|
title => 'my favorite thing to talk about',
|
||||||
});
|
});
|
||||||
isa_ok( $sub1, 'WebGUI::Asset::EMSSubmission', "valid submission succeeded" );
|
isa_ok( $sub1, 'WebGUI::Asset::EMSSubmission', "valid submission succeeded" );
|
||||||
|
is( $ems->hasSubmissions, 1, 'current user has submissions on this ems' );
|
||||||
|
|
||||||
#this one should fail
|
#this one should fail
|
||||||
my $sub2 = $frmB->addSubmission({
|
my $sub2 = $frmB->addSubmission({
|
||||||
title => 'why i like to be important',
|
title => 'why i like to be important',
|
||||||
});
|
});
|
||||||
ok( not defined $sub2, "invalid submission failed" );
|
ok( not defined $sub2, "user cannot submit to this form" );
|
||||||
|
|
||||||
loginUserB;
|
loginUserB;
|
||||||
|
|
||||||
|
|
@ -242,13 +253,11 @@ ok($sub1->update({
|
||||||
is( $sub1->get('title'),'the new title','successfully changed the title');
|
is( $sub1->get('title'),'the new title','successfully changed the title');
|
||||||
|
|
||||||
|
|
||||||
ok($sub1->update({
|
$sub1->update({ status => 'approved' });
|
||||||
status => 'approved'
|
is($sub1->get('status'),'approved','set status to approved');
|
||||||
}),'set status to approved');
|
|
||||||
|
|
||||||
ok($sub2->update({
|
$sub2->update({ status => 'denied' });
|
||||||
status => 'denied'
|
is($sub2->get('status'),'denied','set status to denied');
|
||||||
}),'set status to denied');
|
|
||||||
|
|
||||||
# create the workflows/activities for processing
|
# create the workflows/activities for processing
|
||||||
my $approveSubmissions = WebGUI::Test::Activity->create( $session,
|
my $approveSubmissions = WebGUI::Test::Activity->create( $session,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue