rather a lot of debugging in the EMS Submission system

This commit is contained in:
daviddelikat 2009-11-15 22:02:36 -06:00
parent c089da4c4f
commit 7f6c24e7e0
10 changed files with 82 additions and 49 deletions

View file

@ -50,6 +50,21 @@ These methods are available from this class:
=cut
#-------------------------------------------------------------------
=head2 addComment ( comment [, rating, user ] )
send email when a comment is added
=cut
sub addComment {
my $self = shift;
$self->next::method(@_);
$self->sendEmailUpdate;
}
#-------------------------------------------------------------------
=head2 addRevision
@ -341,7 +356,7 @@ sub sendEmailUpdate {
my $session = $self->session;
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmission" );
if( $self->get('sendEmailOnChange') ) {
WebGUI::Inbox->new($session)->addMessage( $session,{
WebGUI::Inbox->new($session)->addMessage( {
status => 'unread',
message => $i18n->get('your submission has been updated') . "\n\n" .
$self->get('title'),
@ -367,7 +382,6 @@ parameters for the submission
=cut
sub www_editSubmission {
my $this = shift;
my $self;
@ -396,11 +410,11 @@ sub www_editSubmission {
$newform->hidden(name => 'assetId', value => $assetId);
my $formDescription = $parent->getFormDescription;
my @defs = reverse @{__PACKAGE__->definition($session)};
my @fieldNames = qw/title submissionStatus startDate duration seatsAvailable location description/;
my @fieldNames = qw/title submissionStatus sendEmailOnChange startDate duration seatsAvailable location description/;
my $fields;
for my $def ( @defs ) {
my $properties = $def->{properties};
for my $fieldName ( %$properties ) {
for my $fieldName ( keys %$properties ) {
if( defined $formDescription->{$fieldName} ) {
$fields->{$fieldName} = { %{$properties->{$fieldName}} }; # a simple first level copy
if( $fieldName eq 'description' ) {
@ -448,10 +462,11 @@ sub www_editSubmission {
}
}
$newform->submit;
my $title = $assetId eq 'new' ? $i18n_WG->get(99) : $asset->get('title');
my $title = $assetId eq 'new' ? $i18n->get('new submission') : $asset->get('title');
my $content =
$asset->processTemplate({
errors => $params->{errors} || [],
isDynamic => $session->form->get('asJson') || 0,
backUrl => $parent->getUrl,
pageTitle => $title,
pageForm => $newform->print,
@ -517,10 +532,10 @@ sub getEditForm {
my $tabform = $self->SUPER::getEditForm;
my $comments = $tabform->getTab( 'comments' );
#add the comments...
# TODO once comments can be submitted using AJAX this will work...
# be sure to uncomment the tab in the next function also...
#my $comments = $tabform->getTab( 'comments' );
# $comments->div({name => 'comments',
# contentCallback => sub { $self->getFormattedComments },
# });
@ -543,7 +558,10 @@ sub getEditTabs {
my $self = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_EMSSubmission");
my $sku_i18n = WebGUI::International->new($self->session,"Asset_Sku");
return ($self->SUPER::getEditTabs(), ['shop', $sku_i18n->get('shop'), 9], ['comments', $i18n->get('comments'), 9]);
return ($self->SUPER::getEditTabs(), ['shop', $sku_i18n->get('shop'), 9],
# The comment tab is not available because comments are not AJAX yet...
# ['comments', $i18n->get('comments'), 9]
);
}
#-------------------------------------------------------------------

View file

@ -142,7 +142,7 @@ sub definition {
submissionDeadline => {
tab => "properties",
fieldType => "Date",
defaultValue => time , # + ( 30 * 24 * 60 * 60 ) , # 30 days
defaultValue => time + ( 30 * 24 * 60 * 60 ) , # 30 days
label => $i18n->get("submission deadline label"),
hoverHelp => $i18n->get("submission deadline label help")
},
@ -308,7 +308,7 @@ sub www_editSubmissionForm {
my $formDescription = $params->{formDescription} || $self ? $self->getFormDescription : { };
for my $fieldId ( @fieldNames ) {
next if $fieldId eq 'submissionStatus';
next if $fieldId =~ /^(submissionStatus|sendEmailOnChange)$/;
my $field = $fields->{$fieldId};
$newform->yesNo(
label => $field->{label},
@ -328,6 +328,7 @@ sub www_editSubmissionForm {
}
my $content = $asset->processTemplate({
errors => $params->{errors} || [],
isDynamic => $session->form->get('asJson') || 0,
backUrl => $parent->getUrl,
pageTitle => $title,
pageForm => $newform->print,
@ -599,8 +600,9 @@ sub processForm {
}
my @fieldNames = split( ' ', $form->get('fieldNames') );
$params->{formDescription} = { map { $_ => $form->get($_ . '_yesNo') } ( @fieldNames ) };
$params->{formDescription}{_fieldList} = [ map { $params->{formDescription}{$_} ? $_ : () } ( @fieldNames ) ];
$params->{formDescription}{submissionStatus} = 0;
$params->{formDescription}{sendEmailOnChange} = 1;
$params->{formDescription}{_fieldList} = [ map { $params->{formDescription}{$_} ? $_ : () } ( @fieldNames ) ];
if( scalar( @{$params->{formDescription}{_fieldList}} ) == 0 ) {
$params->{_isValid} = 0;
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmissionForm" );

View file

@ -259,7 +259,7 @@ sub definition {
hoverHelp => $i18n->get('registration staff group help'),
},
submittedLocationsList => {
fieldType => 'text',
fieldType => 'textarea',
tab => 'properties',
defaultValue => '',
label => $i18n->get('submitted location list label'),
@ -499,7 +499,7 @@ sub getSubmissionLocations {
my $self = shift;
my $text = $self->get('submittedLocationsList');
return undef if $text eq '';
return [ split( /\s+/, $text ) ];
return [ split( /[\s\n]+/, $text ) ];
}
#-------------------------------------------------------------------
@ -659,7 +659,7 @@ A WebGUI::User object. Defaults to $session->user.
sub isRegistrationStaff {
my $self = shift;
my $user = shift || $self->session->user;
$user->isInGroup($self->get('registrationStaffGroupId'));
$user->isInGroup($self->get('registrationStaffGroupId')) || $self->canEdit;
}
#-------------------------------------------------------------------
@ -739,9 +739,11 @@ sub view {
addBadgeUrl => $self->getUrl('func=add;class=WebGUI::Asset::Sku::EMSBadge'),
buildBadgeUrl => $self->getUrl('func=buildBadge'),
viewScheduleUrl => $self->getUrl('func=viewSchedule'),
addSubmissionUrl => $self->getUrl('func=viewSubmissionQueue#addSubmission'),
addSubmissionUrl => $self->getUrl('func=viewSubmissionQueue'),
# addSubmissionUrl => $self->getUrl('func=viewSubmissionQueue#addSubmission'),
viewSubmissionQueueUrl => $self->getUrl('func=viewSubmissionQueue'),
addSubmissionFormUrl => $self->getUrl('func=viewSubmissionQueue#addSubmissionForm'),
addSubmissionFormUrl => $self->getUrl('func=viewSubmissionQueue'),
# addSubmissionFormUrl => $self->getUrl('func=viewSubmissionQueue#addSubmissionForm'),
manageBadgeGroupsUrl=> $self->getUrl('func=manageBadgeGroups'),
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
isRegistrationStaff => $self->isRegistrationStaff,
@ -842,8 +844,9 @@ call www_editSubmissionForm with assetId == new
=cut
sub www_addSubmissionForm {
my $self = shift;
$self->www_editSubmissionForm( { assetId => 'new' } );
my $self = shift;
my $params = shift || { };
$self->www_editSubmissionForm( { assetId => 'new', %$params } );
}
#-------------------------------------------------------------------
@ -1068,7 +1071,7 @@ test and save data posted from editSubmissionForm...
sub www_editSubmissionFormSave {
my $self = shift;
return $self->session->privilege->insufficient() unless $self->isRegistrationStaff;
return $self->session->privilege->insufficient() unless $self->isRegistrationStaff || $self->canEdit;
my $formParams = WebGUI::Asset::EMSSubmissionForm->processForm($self);
if( $formParams->{_isValid} ) {
delete $formParams->{_isValid};
@ -2734,7 +2737,12 @@ sub www_viewSubmissionQueue {
for my $tabSource ( @{$self->getSubmissionForms} ) {
push @{$params->{tabs}}, $tabSource->www_editSubmissionForm( { asHashRef => 1 } );
}
$params->{tabs}[0]{selected} = 1; # the submission queue tab
if( scalar( @{$params->{tabs}} ) == 1 ) { # there were no existing forms
push @{$params->{tabs}}, $self->www_addSubmissionForm( { asHashRef => 1 } );
$params->{tabs}[1]{selected} = 1; # the new submission form tab
} else {
$params->{tabs}[0]{selected} = 1; # the submission queue tab
}
}
elsif( $canSubmit ) {
for my $tabSource ( @{$self->getSubmissionForms} ) {

View file

@ -12,7 +12,7 @@ our $I18N = { ##hashref of hashes
'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.|
context => q|This is the lable for the flag for setting the option to send email to the owner when the submission is edited.|
},
'send email label help' => {
message => q|Check this box if you would like to recieve email for all changes made to your submission|,