cleaned up the EMS submission system
This commit is contained in:
parent
9d14e8b420
commit
3b9902e395
11 changed files with 85 additions and 40 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -82,6 +82,10 @@ sub addEMSSubmissionTables {
|
||||||
print "\tCreate EMS Submission Tables... " unless $quiet;
|
print "\tCreate EMS Submission Tables... " unless $quiet;
|
||||||
my $db = $session->db;
|
my $db = $session->db;
|
||||||
|
|
||||||
|
$db->write(<<ENDSQL);
|
||||||
|
INSERT INTO incrementer (incrementerId,nextValue) VALUES ('submissionId',1);
|
||||||
|
ENDSQL
|
||||||
|
|
||||||
$db->write(<<ENDSQL);
|
$db->write(<<ENDSQL);
|
||||||
CREATE TABLE EMSSubmissionForm (
|
CREATE TABLE EMSSubmissionForm (
|
||||||
assetId CHAR(22) BINARY NOT NULL,
|
assetId CHAR(22) BINARY NOT NULL,
|
||||||
|
|
@ -147,11 +151,6 @@ ENDSQL
|
||||||
ADD COLUMN submittedLocationsList MEDIUMTEXT;
|
ADD COLUMN submittedLocationsList MEDIUMTEXT;
|
||||||
ENDSQL
|
ENDSQL
|
||||||
|
|
||||||
$db->write(<<ENDSQL);
|
|
||||||
ALTER TABLE EventManagementSystem
|
|
||||||
ADD COLUMN nextSubmissionId INT;
|
|
||||||
ENDSQL
|
|
||||||
|
|
||||||
$db->write(<<ENDSQL);
|
$db->write(<<ENDSQL);
|
||||||
ALTER TABLE EMSEventMetaField
|
ALTER TABLE EMSEventMetaField
|
||||||
ADD COLUMN helpText MEDIUMTEXT;
|
ADD COLUMN helpText MEDIUMTEXT;
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ sub www_editSubmission {
|
||||||
}
|
}
|
||||||
$newform->submit;
|
$newform->submit;
|
||||||
my $title = $assetId eq 'new' ? $i18n_WG->get(99) : $asset->get('title');
|
my $title = $assetId eq 'new' ? $i18n_WG->get(99) : $asset->get('title');
|
||||||
my $content = $asset->processStyle(
|
my $content =
|
||||||
$asset->processTemplate({
|
$asset->processTemplate({
|
||||||
errors => $params->{errors} || [],
|
errors => $params->{errors} || [],
|
||||||
backUrl => $parent->getUrl,
|
backUrl => $parent->getUrl,
|
||||||
|
|
@ -457,14 +457,16 @@ sub www_editSubmission {
|
||||||
pageForm => $newform->print,
|
pageForm => $newform->print,
|
||||||
commentForm => $self ? $self->getFormattedComments : '',
|
commentForm => $self ? $self->getFormattedComments : '',
|
||||||
commentFlag => $self ? 1 : 0 ,
|
commentFlag => $self ? 1 : 0 ,
|
||||||
},$parent->getParent->get('eventSubmissionTemplateId')));
|
},$parent->getParent->get('eventSubmissionTemplateId'));
|
||||||
WebGUI::Macro::process( $session, \$content );
|
WebGUI::Macro::process( $session, \$content );
|
||||||
if( $session->form->get('asJson') ) {
|
if( $params->{asHashRef} ) {
|
||||||
|
return { text => $content, title => $title, };
|
||||||
|
} elsif( $session->form->get('asJson') ) {
|
||||||
$session->http->setMimeType( 'application/json' );
|
$session->http->setMimeType( 'application/json' );
|
||||||
return JSON->new->encode( { text => $content, title => $title, id => $assetId ne 'new' ? $assetId : 'new' . rand } );
|
return JSON->new->encode( { text => $content, title => $title, id => $assetId ne 'new' ? $assetId : 'new' . rand } );
|
||||||
} else {
|
} else {
|
||||||
$session->http->setMimeType( 'text/html' );
|
$session->http->setMimeType( 'text/html' );
|
||||||
return $content;
|
return $asset->processStyle( $content );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ sub definition {
|
||||||
submissionDeadline => {
|
submissionDeadline => {
|
||||||
tab => "properties",
|
tab => "properties",
|
||||||
fieldType => "Date",
|
fieldType => "Date",
|
||||||
defaultValue => '677496912', # far in the future...
|
defaultValue => time , # + ( 30 * 24 * 60 * 60 ) , # 30 days
|
||||||
label => $i18n->get("submission deadline label"),
|
label => $i18n->get("submission deadline label"),
|
||||||
hoverHelp => $i18n->get("submission deadline label help")
|
hoverHelp => $i18n->get("submission deadline label help")
|
||||||
},
|
},
|
||||||
|
|
@ -251,7 +251,9 @@ sub www_editSubmissionForm {
|
||||||
} ( @$res ) );
|
} ( @$res ) );
|
||||||
my $title = $i18n->get('select form to edit') ;
|
my $title = $i18n->get('select form to edit') ;
|
||||||
my $content = '<h1>' . $title . '</h1><ul>' . $listOfLinks . '</ul>' ;
|
my $content = '<h1>' . $title . '</h1><ul>' . $listOfLinks . '</ul>' ;
|
||||||
if( $session->form->get('asJson') ) {
|
if( $params->{asHashRef} ) {
|
||||||
|
return { text => $content, title => $title, } ;
|
||||||
|
} elsif( $session->form->get('asJson') ) {
|
||||||
$session->http->setMimeType( 'application/json' );
|
$session->http->setMimeType( 'application/json' );
|
||||||
return JSON->new->encode( { text => $content, title => $title, id => 'list' . rand } );
|
return JSON->new->encode( { text => $content, title => $title, id => 'list' . rand } );
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -317,7 +319,9 @@ sub www_editSubmissionForm {
|
||||||
}
|
}
|
||||||
$newform->submit;
|
$newform->submit;
|
||||||
my $title = $assetId eq 'new' ? $i18n->get('new form') || 'new' : $asset->get('title');
|
my $title = $assetId eq 'new' ? $i18n->get('new form') || 'new' : $asset->get('title');
|
||||||
if( $session->form->get('asJson') ) {
|
if( $params->{asHashRef} ) {
|
||||||
|
; # not setting mimie type
|
||||||
|
} elsif( $session->form->get('asJson') ) {
|
||||||
$session->http->setMimeType( 'application/json' );
|
$session->http->setMimeType( 'application/json' );
|
||||||
} else {
|
} else {
|
||||||
$session->http->setMimeType( 'text/html' );
|
$session->http->setMimeType( 'text/html' );
|
||||||
|
|
@ -329,7 +333,9 @@ sub www_editSubmissionForm {
|
||||||
pageForm => $newform->print,
|
pageForm => $newform->print,
|
||||||
},$parent->get('eventSubmissionTemplateId'));
|
},$parent->get('eventSubmissionTemplateId'));
|
||||||
WebGUI::Macro::process( $session, \$content );
|
WebGUI::Macro::process( $session, \$content );
|
||||||
if( $session->form->get('asJson') ) {
|
if( $params->{asHashRef} ) {
|
||||||
|
return { text => $content, title => $title };
|
||||||
|
} elsif( $session->form->get('asJson') ) {
|
||||||
return JSON->new->encode( { text => $content, title => $title, id => $assetId ne 'new' ? $assetId : 'new' . rand } );
|
return JSON->new->encode( { text => $content, title => $title, id => $assetId ne 'new' ? $assetId : 'new' . rand } );
|
||||||
} else {
|
} else {
|
||||||
return $asset->ems->processStyle( $content );
|
return $asset->ems->processStyle( $content );
|
||||||
|
|
@ -501,7 +507,8 @@ calls www_editSubmission with assetId == new
|
||||||
|
|
||||||
sub www_addSubmission {
|
sub www_addSubmission {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->www_editSubmission( { assetId => 'new' } );
|
my $params = shift || { };
|
||||||
|
$self->www_editSubmission( { assetId => 'new', %$params } );
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -533,7 +540,7 @@ calls WebGUI::Asset::EMSSubmission->editSubmission
|
||||||
|
|
||||||
sub www_editSubmission {
|
sub www_editSubmission {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
return $self->session->privilege->insufficient() unless $self->canSubmit;
|
||||||
return WebGUI::Asset::EMSSubmission->www_editSubmission($self,shift);
|
return WebGUI::Asset::EMSSubmission->www_editSubmission($self,shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -547,7 +554,7 @@ validate and create a new submission
|
||||||
|
|
||||||
sub www_editSubmissionSave {
|
sub www_editSubmissionSave {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
return $self->session->privilege->insufficient() unless $self->canSubmit;
|
||||||
my $formParams = WebGUI::Asset::EMSSubmission->processForm($self);
|
my $formParams = WebGUI::Asset::EMSSubmission->processForm($self);
|
||||||
if( $formParams->{_isValid} ) {
|
if( $formParams->{_isValid} ) {
|
||||||
delete $formParams->{_isValid};
|
delete $formParams->{_isValid};
|
||||||
|
|
|
||||||
|
|
@ -270,13 +270,6 @@ sub definition {
|
||||||
defaultValue => '',
|
defaultValue => '',
|
||||||
noFormPost => 1,
|
noFormPost => 1,
|
||||||
},
|
},
|
||||||
nextSubmissionId => {
|
|
||||||
tab => "properties",
|
|
||||||
fieldType => "integer",
|
|
||||||
defaultValue => 1,
|
|
||||||
label => $i18n->get("next submission id label"),
|
|
||||||
hoverHelp => $i18n->get("next submission id label help")
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
push(@{$definition}, {
|
push(@{$definition}, {
|
||||||
assetName=>$i18n->get('assetName'),
|
assetName=>$i18n->get('assetName'),
|
||||||
|
|
@ -461,9 +454,7 @@ get a sequence number for the submission id
|
||||||
|
|
||||||
sub getNextSubmissionId {
|
sub getNextSubmissionId {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($submissionId) = $self->session->db->read('select nextSubmissionId from EventManagementSystem where assetId = ?', [ $self->getId ] )->array;
|
return $self->session->db->getNextId( 'SubmissionId' );
|
||||||
$self->update( { nextSubmissionId => ($submissionId + 1) } );
|
|
||||||
return $submissionId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -512,6 +503,37 @@ sub getSubmissionLocations {
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 getSubmissionForms
|
||||||
|
|
||||||
|
returns a list of objects; one for each submission form related to this EMS
|
||||||
|
|
||||||
|
this function is called twice in just a few lines of code so the results are cached
|
||||||
|
to prevent extra hits to the database
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
sub getSubmissionForms {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
return $self->{_submissionForms} if $self->{_submissionFormTime} > time;
|
||||||
|
|
||||||
|
$self->{_submissionForms} = $self->getLineage( ['children'], { returnObjects => 1,
|
||||||
|
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
|
||||||
|
} );
|
||||||
|
$self->{_submissionFormTime} = time + 60;
|
||||||
|
|
||||||
|
return $self->{_submissionForms};
|
||||||
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
|
||||||
|
=head2 getSubmissionStatus
|
||||||
|
|
||||||
|
returns internationalized hash of submission status values or one internationalized name if a status is passed in
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
sub getSubmissionStatus {
|
sub getSubmissionStatus {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $key = shift;
|
my $key = shift;
|
||||||
|
|
@ -724,7 +746,7 @@ sub view {
|
||||||
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
|
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
|
||||||
isRegistrationStaff => $self->isRegistrationStaff,
|
isRegistrationStaff => $self->isRegistrationStaff,
|
||||||
canEdit => $self->canEdit,
|
canEdit => $self->canEdit,
|
||||||
canSubmit => $self->canSubmit,
|
canSubmit => $self->canSubmit && ! $self->isRegistrationStaff,
|
||||||
hasSubmissions => $self->hasSubmissions,
|
hasSubmissions => $self->hasSubmissions,
|
||||||
hasSubmissionForms => $self->hasSubmissionForms,
|
hasSubmissionForms => $self->hasSubmissionForms,
|
||||||
lookupRegistrantUrl => $self->getUrl('func=lookupRegistrant'),
|
lookupRegistrantUrl => $self->getUrl('func=lookupRegistrant'),
|
||||||
|
|
@ -772,9 +794,7 @@ sub www_addSubmission {
|
||||||
my $form;
|
my $form;
|
||||||
|
|
||||||
if( ! defined $formId ) {
|
if( ! defined $formId ) {
|
||||||
my $res = $self->getLineage(['children'],{ returnObjects => 1,
|
my $res = $self->getSubmissionForms;
|
||||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
|
|
||||||
} );
|
|
||||||
my @new = map { $_->canSubmit ? $_ : () } ( @$res);
|
my @new = map { $_->canSubmit ? $_ : () } ( @$res);
|
||||||
if( scalar(@new) == 0 ) {
|
if( scalar(@new) == 0 ) {
|
||||||
return $self->www_view;
|
return $self->www_view;
|
||||||
|
|
@ -2669,7 +2689,7 @@ sub www_viewSchedule {
|
||||||
sub www_viewSubmissionQueue {
|
sub www_viewSubmissionQueue {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $isRegistrationStaff = $self->isRegistrationStaff;
|
my $isRegistrationStaff = $self->isRegistrationStaff;
|
||||||
my $canSubmit = $self->canSubmit;
|
my $canSubmit = $self->canSubmit && ! $isRegistrationStaff;
|
||||||
my $canEdit = $self->canEdit;
|
my $canEdit = $self->canEdit;
|
||||||
my $i18n = $self->i18n;
|
my $i18n = $self->i18n;
|
||||||
return $self->session->privilege->insufficient() unless $canSubmit || $isRegistrationStaff;
|
return $self->session->privilege->insufficient() unless $canSubmit || $isRegistrationStaff;
|
||||||
|
|
@ -2687,9 +2707,7 @@ sub www_viewSubmissionQueue {
|
||||||
linkUrl => $self->getUrl('func=viewSubmissionQueue#' . $_->getId . '_new' ),
|
linkUrl => $self->getUrl('func=viewSubmissionQueue#' . $_->getId . '_new' ),
|
||||||
ajaxUrl => $_->getUrl('func=addSubmission'),
|
ajaxUrl => $_->getUrl('func=addSubmission'),
|
||||||
} } (
|
} } (
|
||||||
@{$self->getLineage( ['children'],{ returnObjects => 1,
|
@{$self->getSubmissionForms}
|
||||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
|
|
||||||
} ) }
|
|
||||||
);
|
);
|
||||||
my $params = {
|
my $params = {
|
||||||
backUrl => $self->getUrl,
|
backUrl => $self->getUrl,
|
||||||
|
|
@ -2707,9 +2725,26 @@ sub www_viewSubmissionQueue {
|
||||||
addSubmissionFormAjaxUrl => $self->getUrl('func=addSubmissionForm'),
|
addSubmissionFormAjaxUrl => $self->getUrl('func=addSubmissionForm'),
|
||||||
addSubmissionAjaxUrl => $self->getUrl('func=addSubmission'),
|
addSubmissionAjaxUrl => $self->getUrl('func=addSubmission'),
|
||||||
submissionFormUrls => \@submissionFormUrls,
|
submissionFormUrls => \@submissionFormUrls,
|
||||||
queueTabTitle => $isRegistrationStaff ? $i18n->get('submission queue') : $i18n->get('my submissions'),
|
|
||||||
};
|
};
|
||||||
$params->{QueueTabData} = $self->processTemplate($params,$self->get('eventSubmissionQueueTemplateId'));
|
push( @{$params->{tabs}}, {
|
||||||
|
title => $isRegistrationStaff ? $i18n->get('submission queue') : $i18n->get('my submissions'),
|
||||||
|
text => $self->processTemplate($params,$self->get('eventSubmissionQueueTemplateId')),
|
||||||
|
} );
|
||||||
|
if( $isRegistrationStaff ) {
|
||||||
|
for my $tabSource ( @{$self->getSubmissionForms} ) {
|
||||||
|
push @{$params->{tabs}}, $tabSource->www_editSubmissionForm( { asHashRef => 1 } );
|
||||||
|
}
|
||||||
|
$params->{tabs}[0]{selected} = 1; # the submission queue tab
|
||||||
|
}
|
||||||
|
elsif( $canSubmit ) {
|
||||||
|
for my $tabSource ( @{$self->getSubmissionForms} ) {
|
||||||
|
next unless $tabSource->canSubmit;
|
||||||
|
push @{$params->{tabs}}, $tabSource->www_addSubmission( { asHashRef => 1 } );
|
||||||
|
}
|
||||||
|
$params->{tabs}[$#{$params->{tabs}}]{selected} = 1;
|
||||||
|
}
|
||||||
|
my $tabid = 'tab01';
|
||||||
|
for my $tab ( @{$params->{tabs}} ) { $tab->{id} = $tabid ++; }
|
||||||
|
|
||||||
return $self->processStyle(
|
return $self->processStyle(
|
||||||
$self->processTemplate( $params, $self->get('eventSubmissionMainTemplateId')));
|
$self->processTemplate( $params, $self->get('eventSubmissionMainTemplateId')));
|
||||||
|
|
|
||||||
|
|
@ -1904,7 +1904,7 @@ normal templates.|,
|
||||||
},
|
},
|
||||||
|
|
||||||
'new submission form' => {
|
'new submission form' => {
|
||||||
message => q|New Submission Form|,
|
message => q|Manage Event Submissions|,
|
||||||
lastUpdated => 1147050475,
|
lastUpdated => 1147050475,
|
||||||
context => q|Label for the link to create a new submission form.|,
|
context => q|Label for the link to create a new submission form.|,
|
||||||
},
|
},
|
||||||
|
|
@ -1922,7 +1922,7 @@ normal templates.|,
|
||||||
},
|
},
|
||||||
|
|
||||||
'new submission' => {
|
'new submission' => {
|
||||||
message => q|New Submission|,
|
message => q|Submit an Event|,
|
||||||
lastUpdated => 1147050475,
|
lastUpdated => 1147050475,
|
||||||
context => q|Label for link to create a new submission for an event.|,
|
context => q|Label for link to create a new submission for an event.|,
|
||||||
},
|
},
|
||||||
|
|
@ -2042,7 +2042,7 @@ normal templates.|,
|
||||||
},
|
},
|
||||||
|
|
||||||
'submitted location list help' => {
|
'submitted location list help' => {
|
||||||
message => q|Enter a listy of location names here, one name on a line. This list will be available on the event submission form in the location select box. If this field is filled in then only these locations will be available.|,
|
message => q|Enter a list of location names here, one name on a line. This list will be available on the event submission form in the location select box. If this field is filled in then only these locations will be available.|,
|
||||||
lastUpdated => 1147050475,
|
lastUpdated => 1147050475,
|
||||||
context => q|This is help text for the submitted location list field.|,
|
context => q|This is help text for the submitted location list field.|,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ use WebGUI::Asset::Sku::EMSBadge;
|
||||||
use WebGUI::Asset::Sku::EMSTicket;
|
use WebGUI::Asset::Sku::EMSTicket;
|
||||||
use WebGUI::Asset::Sku::EMSRibbon;
|
use WebGUI::Asset::Sku::EMSRibbon;
|
||||||
use WebGUI::Asset::Sku::EMSToken;
|
use WebGUI::Asset::Sku::EMSToken;
|
||||||
|
use WebGUI::Asset::EMSSubmission;
|
||||||
|
use WebGUI::Asset::EMSSubmissionForm;
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
# Init
|
# Init
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,7 @@ WebGUI.EMS = function (configs) {
|
||||||
WebGUI.EMS.i18n.get('Asset_EventManagementSystem','close tab') + '" /></span>',
|
WebGUI.EMS.i18n.get('Asset_EventManagementSystem','close tab') + '" /></span>',
|
||||||
contentEl: myContent
|
contentEl: myContent
|
||||||
});
|
});
|
||||||
|
initHoverHelp( myTab );
|
||||||
WebGUI.EMS.tabs.addTab( myTab );
|
WebGUI.EMS.tabs.addTab( myTab );
|
||||||
var index = WebGUI.EMS.tabs.getTabIndex(myTab);
|
var index = WebGUI.EMS.tabs.getTabIndex(myTab);
|
||||||
YAHOO.util.Event.on(myTab.getElementsByClassName('close')[0], 'click', WebGUI.EMS.closeTab , myTab);
|
YAHOO.util.Event.on(myTab.getElementsByClassName('close')[0], 'click', WebGUI.EMS.closeTab , myTab);
|
||||||
|
|
@ -200,7 +201,6 @@ WebGUI.EMS = function (configs) {
|
||||||
// delete WebGUI.ticketJScriptRun;
|
// delete WebGUI.ticketJScriptRun;
|
||||||
WebGUI.EMS.loadingIndicator.hide();
|
WebGUI.EMS.loadingIndicator.hide();
|
||||||
WebGUI.EMS.lastTab = WebGUI.EMS.tabs.get('activeTab');
|
WebGUI.EMS.lastTab = WebGUI.EMS.tabs.get('activeTab');
|
||||||
//initHoverHelp(myTab);
|
|
||||||
WebGUI.EMS.tabs.set('activeTab',myTab);
|
WebGUI.EMS.tabs.set('activeTab',myTab);
|
||||||
},
|
},
|
||||||
failure: function(o) {
|
failure: function(o) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue