tabs successfully added
This commit is contained in:
parent
1155408243
commit
5f8888fcc9
5 changed files with 212 additions and 55 deletions
|
|
@ -286,7 +286,7 @@ sub drawStatusField {
|
|||
return WebGUI::Form::SelectBox($self->session, {
|
||||
name => 'location',
|
||||
value => $self->get('submissionStatus'),
|
||||
options => $self->ems->getStatus,
|
||||
options => $self->ems->getSubmissionStatus,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -315,7 +315,10 @@ returns the ems ansestor of this asset
|
|||
|
||||
=cut
|
||||
|
||||
sub ems { $_[0]->getParent->getParent }
|
||||
sub ems {
|
||||
my $self = shift;
|
||||
$self->getParent->getParent
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -389,16 +392,14 @@ dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
|
|||
|
||||
# for each field
|
||||
for my $field ( values %$fields ) {
|
||||
if( $formDescription->{$field->{fieldId}} ) {
|
||||
dav::dump 'drawing fields:', $field;
|
||||
if( $field->{fieldId} eq 'submissionStatus' ) {
|
||||
$field->{options} = $parent->getParent->getStatus;
|
||||
dav::log 'set options for status';
|
||||
}
|
||||
if( $field->{fieldId} eq 'location' ) {
|
||||
$field->{options} = [ split( /\s*/, $parent->getParent->getLocations ) ];
|
||||
delete $field->{options} if scalar( @{$field->{options}} ) == 0 ;
|
||||
}
|
||||
if( $formDescription->{$field->{fieldId}} || $asset->ems->isRegistrationStaff ) {
|
||||
my $drawMethod = __PACKAGE__ . '::' . $field->{customDrawMethod};
|
||||
if ($asset->can( $drawMethod )) {
|
||||
$field->{value} = $asset->$drawMethod($field);
|
||||
delete $field->{name}; # don't want readOnly to generate a hidden field
|
||||
$field->{fieldType} = "readOnly";
|
||||
}
|
||||
|
||||
$newform->dynamicField(%$field);
|
||||
} else {
|
||||
# TODO see that the data gets formatted
|
||||
|
|
@ -490,6 +491,17 @@ sub getEditTabs {
|
|||
return ($self->SUPER::getEditTabs(), ['shop', $sku_i18n->get('shop'), 9], ['comments', $i18n->get('comments'), 9]);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
=head2 getUrl
|
||||
|
||||
returns the URL for the submission queue page with the submisison id in the hash part
|
||||
|
||||
=cut
|
||||
|
||||
sub getUrl {
|
||||
my $self = shift;
|
||||
return $self->ems->getUrl('func=viewSubmissionQueue#' . $self->get('submissionId') );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -548,6 +560,7 @@ sub processForm {
|
|||
return {_isValid => 0, errors => [ { text => 'invalid function call' } ] };
|
||||
}
|
||||
my $params = {_isValid=>1};
|
||||
# TODO
|
||||
# get description from parent
|
||||
# for each active field
|
||||
# get data from session->form
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ sub addSubmission {
|
|||
}
|
||||
$newParams->{className} = 'WebGUI::Asset::EMSSubmission';
|
||||
$newParams->{submissionStatus} = 'pending';
|
||||
$newParams->{submissionId} = $self->get('nextSubmissionId');
|
||||
$self->update({nextSubmissionId => $newParams->{submissionId}+1 });
|
||||
$newParams->{submissionId} = $self->ems->getNextSubmissionId;
|
||||
$self->addChild($newParams);
|
||||
}
|
||||
|
||||
|
|
@ -129,13 +128,6 @@ sub definition {
|
|||
my $definition = shift;
|
||||
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmissionForm" );
|
||||
tie my %properties, 'Tie::IxHash', (
|
||||
nextSubmissionId => {
|
||||
tab => "properties",
|
||||
fieldType => "integer",
|
||||
defaultValue => 0,
|
||||
label => $i18n->get("next submission id label"),
|
||||
hoverHelp => $i18n->get("next submission id label help")
|
||||
},
|
||||
canSubmitGroupId => {
|
||||
tab => "security",
|
||||
fieldType => "group",
|
||||
|
|
@ -214,7 +206,10 @@ returns the ems ansestor of this asset
|
|||
|
||||
=cut
|
||||
|
||||
sub ems { $_[0]->getParent }
|
||||
sub ems {
|
||||
my $self = shift;
|
||||
$self->getParent
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -244,7 +239,7 @@ sub www_editSubmissionForm {
|
|||
}
|
||||
my $params = shift || { };
|
||||
my $session = $parent->session;
|
||||
my $i18n = WebGUI::International->new($parent->session,'Asset_EventManagementSystem');
|
||||
my $i18n = WebGUI::International->new($session,'Asset_EventManagementSystem');
|
||||
my $assetId = $self ? $self->getId : $params->{assetId} || $session->form->get('assetId');
|
||||
|
||||
if( ! defined( $assetId ) ) {
|
||||
|
|
@ -360,7 +355,7 @@ sub www_editSubmissionFormSave {
|
|||
|
||||
=head2 www_view
|
||||
|
||||
calles ems->view
|
||||
calls ems->view
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -399,13 +394,13 @@ Making private. See WebGUI::Asset::indexContent() for additonal details.
|
|||
=head2 prepareView ( )
|
||||
|
||||
See WebGUI::Asset::prepareView() for details.
|
||||
we shouldn't get here, there is nothing to view...
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareView {
|
||||
my $self = shift;
|
||||
$self->ems->prepareView;
|
||||
#$self->SUPER::prepareView();
|
||||
$self->SUPER::prepareView();
|
||||
#my $template = WebGUI::Asset::Template->new( $self->session, $self->get("templateId") );
|
||||
#$template->prepare($self->getMetaDataAsTemplateVariables);
|
||||
#$self->{_viewTemplate} = $template;
|
||||
|
|
@ -421,10 +416,10 @@ when /yourAssetUrl?func=editSave is requested/posted.
|
|||
|
||||
=cut
|
||||
|
||||
sub processPropertiesFromFormPost {
|
||||
my $self = shift;
|
||||
$self->SUPER::processPropertiesFromFormPost;
|
||||
}
|
||||
#sub processPropertiesFromFormPost {
|
||||
# my $self = shift;
|
||||
# $self->SUPER::processPropertiesFromFormPost;
|
||||
#}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -593,7 +588,7 @@ sub update {
|
|||
my $self = shift;
|
||||
my $properties = shift;
|
||||
if( ref $properties->{formDescription} eq 'HASH' ) {
|
||||
$properties->{formDescription} = JSON->new->encode($properties->{formDescription}||{});
|
||||
$properties->{formDescription} = JSON->new->encode($properties->{formDescription});
|
||||
}
|
||||
$self->SUPER::update({%$properties, isHidden => 1});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ defaults to 2 -- registered users
|
|||
=head4 daysBeforeCleanup ( optional )
|
||||
|
||||
number fo days to leave denied/created status items in the database before deleting
|
||||
defaults t0 7
|
||||
defaults to 7
|
||||
|
||||
=head4 deleteCreatedItems ( optional )
|
||||
|
||||
|
|
@ -186,10 +186,10 @@ sub definition {
|
|||
},
|
||||
eventSubmissionMainTemplateId => {
|
||||
fieldType => 'template',
|
||||
defaultValue => 'ylBSKblMdKpcDSIK2t_Ang',
|
||||
defaultValue => 'DoVNijm6lMDE0cYrtvEbDQ',
|
||||
tab => 'display',
|
||||
label => $i18n->get('event submission form template'),
|
||||
hoverHelp => $i18n->get('event submission form template help'),
|
||||
label => $i18n->get('event submission main template'),
|
||||
hoverHelp => $i18n->get('event submission main template help'),
|
||||
namespace => 'EMS/SubmissionMain',
|
||||
},
|
||||
eventSubmissionTemplateId => {
|
||||
|
|
@ -246,7 +246,7 @@ sub definition {
|
|||
submittedLocationsList => {
|
||||
fieldType => 'text',
|
||||
tab => 'properties',
|
||||
defaultValue => $i18n->get('default submitted location list'),
|
||||
defaultValue => '',
|
||||
label => $i18n->get('submitted location list label'),
|
||||
hoverHelp => $i18n->get('submitted location list help'),
|
||||
},
|
||||
|
|
@ -255,6 +255,13 @@ sub definition {
|
|||
defaultValue => '',
|
||||
noFormPost => 1,
|
||||
},
|
||||
nextSubmissionId => {
|
||||
tab => "properties",
|
||||
fieldType => "integer",
|
||||
defaultValue => 0,
|
||||
label => $i18n->get("next submission id label"),
|
||||
hoverHelp => $i18n->get("next submission id label help")
|
||||
},
|
||||
);
|
||||
push(@{$definition}, {
|
||||
assetName=>$i18n->get('assetName'),
|
||||
|
|
@ -416,6 +423,22 @@ sub getLocations {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getNextSubmissionId
|
||||
|
||||
get a sequence number for the submission id
|
||||
|
||||
=cut
|
||||
|
||||
sub getNextSubmissionId {
|
||||
my $self = shift;
|
||||
#my $submissionId = $self->get('nextSubmissionId');
|
||||
my ($submissionId) = $self->session->db->read('select nextSubmissionId from EventManagementSystem where assetId = ?', [ $self->getId ] )->array;
|
||||
$self->update( { nextSubmissionId => ($submissionId + 1) } );
|
||||
return $submissionId;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getRegistrant ( badgeId )
|
||||
|
||||
Returns a hash reference containing the properties of a registrant.
|
||||
|
|
@ -460,7 +483,7 @@ dav::log 'getSubmissionLocations:"', $text, '"';
|
|||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub getStatus {
|
||||
sub getSubmissionStatus {
|
||||
my $self = shift;
|
||||
my $key = shift;
|
||||
|
||||
|
|
@ -668,7 +691,8 @@ sub view {
|
|||
addSubmissionFormUrl => $self->getUrl('func=addSubmissionForm'),
|
||||
manageBadgeGroupsUrl=> $self->getUrl('func=manageBadgeGroups'),
|
||||
getBadgesUrl => $self->getUrl('func=getBadgesAsJson'),
|
||||
canEdit => $self->canEdit,
|
||||
isRegistrationStaff => $self->isRegistrationStaff,
|
||||
canEdit => $self->canEdit,
|
||||
canSubmit => $self->canSubmit,
|
||||
hasSubmissions => $self->hasSubmissions,
|
||||
hasSubmissionForms => $self->hasSubmissionForms,
|
||||
|
|
@ -948,7 +972,7 @@ calls editSubmissionForm in WebGUI::Asset::EMSSubmissionForm
|
|||
|
||||
sub www_editSubmissionForm {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->insufficient() unless $self->isRegistrationStaff;
|
||||
return WebGUI::Asset::EMSSubmissionForm->www_editSubmissionForm($self,shift);
|
||||
}
|
||||
|
||||
|
|
@ -963,7 +987,7 @@ test and save data posted from editSubmissionForm...
|
|||
|
||||
sub www_editSubmissionFormSave {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return $self->session->privilege->insufficient() unless $self->isRegistrationStaff;
|
||||
my $formParams = WebGUI::Asset::EMSSubmissionForm->processForm($self);
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
|
|
@ -1184,7 +1208,7 @@ sub www_exportEvents {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
=head2 www_getAllSubmissions ( session )
|
||||
=head2 www_getAllSubmissions ( )
|
||||
|
||||
Get a page of Asset Manager data, ajax style. Returns a JSON array to be
|
||||
formatted in a WebGUI submission queue data table.
|
||||
|
|
@ -1199,14 +1223,14 @@ sub www_getAllSubmissions {
|
|||
my $rowsPerPage = 25;
|
||||
my $tableInfo = {};
|
||||
|
||||
return $session->privilege->insufficient unless $self->canView;
|
||||
return $session->privilege->insufficient unless $self->canSubmit || $self->isRegistrationStaff;
|
||||
|
||||
my $orderByColumn = $form->get( 'orderByColumn' ) || $self->get("sortColumn");
|
||||
my $dir = $form->get('orderByDirection') || $self->get('sortOrder');
|
||||
my $orderByDirection = lc ($dir) eq "asc" ? "ASC" : "DESC";
|
||||
|
||||
my $whereClause ;
|
||||
if(!$self->canEdit) {
|
||||
if(!$self->isRegistrationStaff) {
|
||||
my $userId = $session->user->userId;
|
||||
$whereClause .= qq{ createdBy='$userId'};
|
||||
}
|
||||
|
|
@ -1255,7 +1279,7 @@ sub www_getAllSubmissions {
|
|||
title => $asset->get( "title" ),
|
||||
createdBy => WebGUI::User->new($session,$asset->get( "createdBy" ))->username,
|
||||
creationDate => $datetime->epochToSet($asset->get( "creationDate" )),
|
||||
submissionStatus => $self->getStatus($asset->get( "submissionStatus" ) || 'pending' ),
|
||||
submissionStatus => $self->getSubmissionStatus($asset->get( "submissionStatus" ) || 'pending' ),
|
||||
lastReplyDate => $lastReplyDate || '',
|
||||
lastReplyBy => $lastReplyBy || '',
|
||||
);
|
||||
|
|
@ -2485,19 +2509,39 @@ sub www_viewSchedule {
|
|||
|
||||
sub www_viewSubmissionQueue {
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canSubmit || $self->canEdit;
|
||||
my $isRegistrationStaff = $self->isRegistrationStaff;
|
||||
my $canSubmit = $self->canSubmit;
|
||||
my $canEdit = $self->canEdit;
|
||||
my $i18n = $self->i18n;
|
||||
return $self->session->privilege->insufficient() unless $canSubmit || $isRegistrationStaff;
|
||||
|
||||
return $self->processStyle(
|
||||
my $QueueTabData =
|
||||
$self->processTemplate({
|
||||
backUrl => $self->getUrl,
|
||||
canEdit => $self->canEdit,
|
||||
canSubmit => $self->canSubmit,
|
||||
isRegistrationStaff => $isRegistrationStaff,
|
||||
canEdit => $canEdit,
|
||||
canSubmit => $canSubmit,
|
||||
hasSubmissionForms => $self->hasSubmissionForms,
|
||||
getSubmissionQueueDataUrl => $self->getUrl('func=getAllSubmissions'),
|
||||
addSubmissionFormUrl => $self->getUrl('func=addSubmissionForm'),
|
||||
editSubmissionFormUrl => $self->getUrl('func=editSubmissionForm'),
|
||||
addSubmissionUrl => $self->getUrl('func=addSubmission'),
|
||||
},$self->get('eventSubmissionQueueTemplateId')));
|
||||
},$self->get('eventSubmissionQueueTemplateId'));
|
||||
|
||||
return $self->processStyle(
|
||||
$self->processTemplate({
|
||||
queueTabTitle => $isRegistrationStaff ? $i18n->get('submission queue') : $i18n->get('my submissions'),
|
||||
queueTabData => $QueueTabData,
|
||||
backUrl => $self->getUrl,
|
||||
isRegistrationStaff => $isRegistrationStaff,
|
||||
canEdit => $canEdit,
|
||||
canSubmit => $canSubmit,
|
||||
hasSubmissionForms => $self->hasSubmissionForms,
|
||||
getSubmissionQueueDataUrl => $self->getUrl('func=getAllSubmissions'),
|
||||
addSubmissionFormUrl => $self->getUrl('func=addSubmissionForm'),
|
||||
editSubmissionFormUrl => $self->getUrl('func=editSubmissionForm'),
|
||||
addSubmissionUrl => $self->getUrl('func=addSubmission'),
|
||||
},$self->get('eventSubmissionMainTemplateId')));
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -2022,6 +2022,18 @@ normal templates.|,
|
|||
context => q|This is help text for the submitted location list field.|,
|
||||
},
|
||||
|
||||
'submission queue' => {
|
||||
message => q|Submission Queue|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the submission list tab for registration staff.|,
|
||||
},
|
||||
|
||||
'my submissions' => {
|
||||
message => q|My Submissions|,
|
||||
lastUpdated => 1147050475,
|
||||
context => q|Label for the submission list tab for event submitters.|,
|
||||
},
|
||||
|
||||
# 'TODO' => {
|
||||
# message => q|TODO|,
|
||||
# lastUpdated => 1147050475,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue