more changes
This commit is contained in:
parent
e6d95ec533
commit
6bbd832668
4 changed files with 172 additions and 87 deletions
|
|
@ -32,6 +32,16 @@ Describe your New Asset's functionality and features here.
|
|||
|
||||
use WebGUI::Asset::EMSSubmission;
|
||||
|
||||
=head1 TODO
|
||||
|
||||
the comments tab may need to be added in a getEditForm function like Sku::EMSTicket
|
||||
|
||||
make a button/link for the admin to view the submission as the owner sees it.
|
||||
|
||||
the www_edit function should see if the userid is the owner and call a seperate function
|
||||
else if it is not in the admin group return insufitient priviledges
|
||||
else call the getEditForm function like sku::EMSTicket does...
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
|
|
@ -76,74 +86,116 @@ sub definition {
|
|||
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmission" );
|
||||
my $EMS_i18n = WebGUI::International->new($session, "Asset_EventManagementSystem");
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
submissionId => {
|
||||
noFormPost => 1,
|
||||
fieldType => "hidden",
|
||||
submissionId => {
|
||||
noFormPost => 1,
|
||||
fieldType => "hidden",
|
||||
defaultValue => undef,
|
||||
},
|
||||
description => {
|
||||
tab => "properties",
|
||||
fieldType => "HTMLArea",
|
||||
defaultValue => undef,
|
||||
label => $i18n->get("description"),
|
||||
hoverHelp => $i18n->get("description help")
|
||||
},
|
||||
sku => {
|
||||
tab => "shop",
|
||||
fieldType => "text",
|
||||
defaultValue => $session->id->generate,
|
||||
label => $i18n->get("sku"),
|
||||
hoverHelp => $i18n->get("sku help")
|
||||
},
|
||||
displayTitle => {
|
||||
tab => "display",
|
||||
fieldType => "yesNo",
|
||||
defaultValue => 1,
|
||||
label => $i18n->get("display title"),
|
||||
hoverHelp => $i18n->get("display title help")
|
||||
},
|
||||
vendorId => {
|
||||
tab => "shop",
|
||||
fieldType => "vendor",
|
||||
defaultValue => 'defaultvendor000000000',
|
||||
label => $i18n->get("vendor"),
|
||||
hoverHelp => $i18n->get("vendor help")
|
||||
},
|
||||
shipsSeparately => {
|
||||
tab => 'shop',
|
||||
fieldType => 'yesNo',
|
||||
defaultValue => 0,
|
||||
label => $i18n->get('shipsSeparately'),
|
||||
hoverHelp => $i18n->get('shipsSeparately help'),
|
||||
},
|
||||
|
||||
price => {
|
||||
tab => "shop",
|
||||
fieldType => "float",
|
||||
defaultValue => 0.00,
|
||||
label => $EMS_i18n->get("price"),
|
||||
hoverHelp => $EMS_i18n->get("price help"),
|
||||
},
|
||||
seatsAvailable => {
|
||||
tab => "shop",
|
||||
fieldType => "integer",
|
||||
defaultValue => 25,
|
||||
label => $EMS_i18n->get("seats available"),
|
||||
hoverHelp => $EMS_i18n->get("seats available help"),
|
||||
},
|
||||
startDate => {
|
||||
noFormPost => 1,
|
||||
fieldType => "hidden",
|
||||
defaultValue => '',
|
||||
label => $EMS_i18n->get("add/edit event start date"),
|
||||
hoverHelp => $EMS_i18n->get("add/edit event start date help"),
|
||||
autoGenerate => 0,
|
||||
},
|
||||
duration => {
|
||||
tab => "properties",
|
||||
fieldType => "float",
|
||||
defaultValue => 1.0,
|
||||
subtext => $EMS_i18n->get('hours'),
|
||||
label => $EMS_i18n->get("duration"),
|
||||
hoverHelp => $EMS_i18n->get("duration help"),
|
||||
},
|
||||
location => {
|
||||
fieldType => "combo",
|
||||
tab => "properties",
|
||||
customDrawMethod=> 'drawLocationField',
|
||||
label => $EMS_i18n->get("location"),
|
||||
hoverHelp => $EMS_i18n->get("location help"),
|
||||
},
|
||||
relatedBadgeGroup => {
|
||||
tab => "properties",
|
||||
fieldType => "checkList",
|
||||
customDrawMethod=> 'drawRelatedBadgeGroupsField',
|
||||
label => $EMS_i18n->get("related badge groups"),
|
||||
hoverHelp => $EMS_i18n->get("related badge groups ticket help"),
|
||||
},
|
||||
relatedRibbons => {
|
||||
tab => "properties",
|
||||
fieldType => "checkList",
|
||||
customDrawMethod=> 'drawRelatedRibbonsField',
|
||||
label => $EMS_i18n->get("related ribbons"),
|
||||
hoverHelp => $EMS_i18n->get("related ribbons help"),
|
||||
},
|
||||
eventMetaData => {
|
||||
noFormPost => 1,
|
||||
fieldType => "hidden",
|
||||
defaultValue => '{}',
|
||||
},
|
||||
sendEmailOnChange => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
defaultValue => undef,
|
||||
},
|
||||
price => {
|
||||
tab => "shop",
|
||||
fieldType => "float",
|
||||
defaultValue => 0.00,
|
||||
label => $EMS_i18n->get("price"),
|
||||
hoverHelp => $EMS_i18n->get("price help"),
|
||||
},
|
||||
seatsAvailable => {
|
||||
tab => "shop",
|
||||
fieldType => "integer",
|
||||
defaultValue => 25,
|
||||
label => $EMS_i18n->get("seats available"),
|
||||
hoverHelp => $EMS_i18n->get("seats available help"),
|
||||
},
|
||||
startDate => {
|
||||
noFormPost => 1,
|
||||
fieldType => "hidden",
|
||||
defaultValue => '',
|
||||
label => $EMS_i18n->get("add/edit event start date"),
|
||||
hoverHelp => $EMS_i18n->get("add/edit event start date help"),
|
||||
autoGenerate => 0,
|
||||
},
|
||||
duration => {
|
||||
tab => "properties",
|
||||
fieldType => "float",
|
||||
defaultValue => 1.0,
|
||||
subtext => $EMS_i18n->get('hours'),
|
||||
label => $EMS_i18n->get("duration"),
|
||||
hoverHelp => $EMS_i18n->get("duration help"),
|
||||
},
|
||||
location => {
|
||||
fieldType => "combo",
|
||||
tab => "properties",
|
||||
customDrawMethod=> 'drawLocationField',
|
||||
label => $EMS_i18n->get("location"),
|
||||
hoverHelp => $EMS_i18n->get("location help"),
|
||||
},
|
||||
relatedBadgeGroup => {
|
||||
tab => "properties",
|
||||
fieldType => "checkList",
|
||||
customDrawMethod=> 'drawRelatedBadgeGroupsField',
|
||||
label => $EMS_i18n->get("related badge groups"),
|
||||
hoverHelp => $EMS_i18n->get("related badge groups ticket help"),
|
||||
},
|
||||
relatedRibbons => {
|
||||
tab => "properties",
|
||||
fieldType => "checkList",
|
||||
customDrawMethod=> 'drawRelatedRibbonsField',
|
||||
label => $EMS_i18n->get("related ribbons"),
|
||||
hoverHelp => $EMS_i18n->get("related ribbons help"),
|
||||
},
|
||||
eventMetaData => {
|
||||
noFormPost => 1,
|
||||
fieldType => "hidden",
|
||||
defaultValue => '{}',
|
||||
},
|
||||
sendEmailOnChange => {
|
||||
tab => "properties",
|
||||
fieldType => "text",
|
||||
defaultValue => undef,
|
||||
label => $i18n->get("foo label"),
|
||||
hoverHelp => $i18n->get("foo label help")
|
||||
},
|
||||
label => $i18n->get("send email label"),
|
||||
hoverHelp => $i18n->get("send email label help")
|
||||
},
|
||||
commentTab => {
|
||||
noFormPost => 1,
|
||||
tab => "comments",
|
||||
fieldType => "hidden",
|
||||
customDrawMethod => 'drawComments',
|
||||
}
|
||||
);
|
||||
push @{$definition}, {
|
||||
assetName => $i18n->get('assetName'),
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ and then become EMSTicket's.
|
|||
|
||||
use WebGUI::Asset::EMSSubmissionForm;
|
||||
|
||||
=head1 TODO
|
||||
|
||||
add a lastSubmissionDate -- after that the submission form will be closed
|
||||
the link will still exist but the form will just say '<title> submissions closed as of <date>'
|
||||
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this class:
|
||||
|
|
@ -235,10 +241,10 @@ This method is called when data is purged by the system.
|
|||
|
||||
=cut
|
||||
|
||||
sub purgeRevision {
|
||||
my $self = shift;
|
||||
return $self->SUPER::purgeRevision;
|
||||
}
|
||||
#sub purgeRevision {
|
||||
# my $self = shift;
|
||||
# return $self->SUPER::purgeRevision;
|
||||
#}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,16 @@ our $I18N = { ##hashref of hashes
|
|||
lastUpdated => 1131394072,
|
||||
context => q|Then name of the Asset ( Event Management System - Event Submission ).|
|
||||
},
|
||||
'send email label' => {
|
||||
message => q|Send Email when Submission Editted|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|This is the lable for the flag for setting the option to send email to the owner when the submission is eddited.|
|
||||
},
|
||||
'send email label help' => {
|
||||
message => q|Check this box if you would like to recieve email for all changes made to your submission|,
|
||||
lastUpdated => 1131394072,
|
||||
context => q|This is the help text for the 'send email' flag. If set to 'Yes', the user will recieve email for every change made to the submission.|
|
||||
},
|
||||
|
||||
# 'TODO' => {
|
||||
# message => q|TODO|,
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use FindBin;
|
|||
use strict;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
use Test::More;
|
||||
use Test::Deep;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::User;
|
||||
use WebGUI::Test; # Must use this before any other WebGUI modules
|
||||
|
|
@ -122,9 +123,12 @@ my $frmA = $ems->addChild({
|
|||
className => 'WebGUI::Asset::EMSSubmissionForm',
|
||||
title => 'test A -- long',
|
||||
canSubmitGroup => $submitGroupA->getId,
|
||||
formDescription => q{
|
||||
TODO = 1
|
||||
},
|
||||
formDescription => q{ {
|
||||
'title' : { 'type' : 'text' },
|
||||
'synopsis' : { 'type' : 'textarea' },
|
||||
'duration' : { 'default' : 2.0 },
|
||||
'startDate' : { 'type' : 'selectList', 'options' : [ '', '', '' ] },
|
||||
} },
|
||||
});
|
||||
isa_ok( $frmA, 'WebGUI::Asset::EMSSubmissionForm' );
|
||||
ok( $frmA->validateSubmission({
|
||||
|
|
@ -135,19 +139,20 @@ ok( !$frmA->validateSubmission({
|
|||
}), 'not a valid submission' );
|
||||
# TODO: test more field validations
|
||||
|
||||
print "after tests\n";
|
||||
|
||||
# TODO use meta field in this form
|
||||
my $frmB = $ems->addChild({
|
||||
className => 'WebGUI::Asset::EMSSubmissionForm',
|
||||
title => 'test B -- short',
|
||||
canSubmitGroup => $submitGroupB->getId,
|
||||
formDescription => q{
|
||||
TODO = 1
|
||||
},
|
||||
formDescription => q{ {
|
||||
'title' : { 'type' : 'text' },
|
||||
'synopsis' : { 'type' : 'textarea' },
|
||||
'duration' : { 'default' : 0.5 },
|
||||
'startDate' : { 'default' : '' },
|
||||
} },
|
||||
});
|
||||
# TODO: test meta field validation
|
||||
print "created one form\n";
|
||||
|
||||
loginUserA;
|
||||
|
||||
|
|
@ -155,13 +160,13 @@ loginUserA;
|
|||
my $sub1 = $frmA->addSubmission({
|
||||
title => 'my favorite thing to talk about',
|
||||
});
|
||||
isa_ok( $sub1, 'WebGUI::Asset::EMSSubmission', "valid submission succeeded" );
|
||||
|
||||
print "created one submission\n";
|
||||
#this one should fail
|
||||
my $sub2 = $frmB->addSubmission({
|
||||
title => 'why i like to be important',
|
||||
});
|
||||
print "created another submission\n";
|
||||
ok( not defined $sub2, "invalid submission failed" );
|
||||
|
||||
loginUserB;
|
||||
|
||||
|
|
@ -169,24 +174,35 @@ loginUserB;
|
|||
my $sub3 = $frmB->addSubmission({
|
||||
title => 'five minutes of me',
|
||||
});
|
||||
isa_ok( $sub3, 'WebGUI::Asset::EMSSubmission', "checked permissions for group B" );
|
||||
|
||||
print "created third submission\n";
|
||||
loginUserC;
|
||||
|
||||
# should work
|
||||
my $sub4 = $frmB->addSubmission({
|
||||
title => 'why humility is underrated',
|
||||
});
|
||||
print "created fourth submission\n";
|
||||
isa_ok( $sub4, 'WebGUI::Asset::EMSSubmission', "user C is in group B" );
|
||||
|
||||
# should work
|
||||
my $sub5 = $frmA->addSubmission({
|
||||
title => 'what you should know about everybody',
|
||||
});
|
||||
print "created fifth submission\n";
|
||||
isa_ok( $sub5, 'WebGUI::Asset::EMSSubmission', "user C is also in group A" );
|
||||
|
||||
$sub1->addComment({ 'this is a test comment' });
|
||||
print "added a comment\n";
|
||||
$sub1->addComment( 'this is a test comment' );
|
||||
cmp_deeply($sub1->get('comments')->[0],{
|
||||
id => re( qr/.+/ ),
|
||||
alias => '',
|
||||
userId => $userC->userId,
|
||||
comment => 'this is a test comment',
|
||||
rating => 0,
|
||||
date => re( qr/\d{10}/ ),
|
||||
ip => undef,
|
||||
}, "successfully added comment" );
|
||||
|
||||
ok($sub1->update({
|
||||
}),'update submission');
|
||||
|
||||
my $TODO = q{
|
||||
modify submission(s)
|
||||
|
|
@ -195,7 +211,8 @@ run submission approval activity
|
|||
run submission cleanup activity
|
||||
};
|
||||
$versionTag->commit;
|
||||
print "end of program\n";
|
||||
|
||||
#done_testing();
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Cleanup
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue