all tests pass, manual testing passes
This commit is contained in:
parent
c8b97d83fe
commit
6b24783385
10 changed files with 256 additions and 176 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package WebGUI::Asset::EMSSubmission;
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
|
|
@ -20,6 +19,7 @@ use strict;
|
|||
use Tie::IxHash;
|
||||
use base qw(WebGUI::AssetAspect::Comments WebGUI::Asset);
|
||||
use WebGUI::Utility;
|
||||
use WebGUI::Inbox;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -292,7 +292,7 @@ sub drawRelatedRibbonsField {
|
|||
sub drawStatusField {
|
||||
my ($self, $params) = @_;
|
||||
return WebGUI::Form::SelectBox($self->session, {
|
||||
name => 'location',
|
||||
name => 'submissionStatus',
|
||||
value => $self->get('submissionStatus'),
|
||||
options => $self->ems->getSubmissionStatus,
|
||||
});
|
||||
|
|
@ -341,12 +341,12 @@ sub sendEmailUpdate {
|
|||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmission" );
|
||||
if( $self->get('sendEmailOnChange') ) {
|
||||
WebGUI::Inbox->addMessage( $session,{
|
||||
WebGUI::Inbox->new($session)->addMessage( $session,{
|
||||
status => 'unread',
|
||||
message => $i18n->get('your submission has been updated') . "\n\n" .
|
||||
$self->get('title'),
|
||||
userId => $self->createdBy,
|
||||
sentBy => $session->userId,
|
||||
userId => $self->get('createdBy'),
|
||||
sentBy => $session->user->userId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -374,19 +374,17 @@ sub www_editSubmission {
|
|||
my $parent;
|
||||
if( $this eq __PACKAGE__ ) { # called as a constructor
|
||||
$parent = shift;
|
||||
dav::log 'EMSSubmission::www_editSubmission: got class/parent params';
|
||||
} else {
|
||||
$self = $this;
|
||||
$parent = $self->getParent;
|
||||
dav::log 'EMSSubmission::www_editSubmission: got self param';
|
||||
}
|
||||
my $params = shift || { };
|
||||
my $session = $parent->session;
|
||||
my $i18n = WebGUI::International->new($parent->session,'Asset_EventManagementSystem');
|
||||
my $i18n_WG = WebGUI::International->new($parent->session,'WebGUI');
|
||||
my $assetId = $self ? $self->getId : $params->{assetId} || $session->form->get('assetId') || 'new';
|
||||
|
||||
if( $assetId ne 'new' ) {
|
||||
dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
|
||||
$self ||= WebGUI::Asset->newByDynamicClass($session,$assetId);
|
||||
if (!defined $self) {
|
||||
$session->errorHandler->error(__PACKAGE__ . " - failed to instanciate asset with assetId $assetId");
|
||||
|
|
@ -398,27 +396,39 @@ dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
|
|||
$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 $fields;
|
||||
for my $def ( @defs ) {
|
||||
my $properties = $def->{properties};
|
||||
for my $fieldName ( %$properties ) {
|
||||
if( defined $formDescription->{$fieldName} ) {
|
||||
$fields->{$fieldName} = { %{$properties->{$fieldName}} }; # a simple first level copy
|
||||
if( $fieldName eq 'description' ) {
|
||||
$fields->{description}{height} = 200;
|
||||
$fields->{description}{width} = 350;
|
||||
}
|
||||
$fields->{$fieldName}{fieldId} = $fieldName;
|
||||
$fields->{$fieldName}{name} = $fieldName;
|
||||
$fields->{$fieldName}{value} = $self->get($fieldName) if $self;
|
||||
}
|
||||
}
|
||||
}
|
||||
# add the meta field
|
||||
for my $metaField ( @{$parent->getParent->getEventMetaFields} ) {
|
||||
if( defined $formDescription->{$metaField->{fieldId}} ) {
|
||||
$fields->{$metaField->{fieldId}} = { %$metaField }; # a simple first level copy
|
||||
my $fieldId = $metaField->{fieldId};
|
||||
if( defined $formDescription->{$fieldId} ) {
|
||||
push @fieldNames, $fieldId;
|
||||
$fields->{$fieldId} = { %$metaField }; # a simple first level copy
|
||||
# meta fields call it data type, we copy it to simplify later on
|
||||
$fields->{$metaField->{fieldId}}{fieldType} = $metaField->{dataType};
|
||||
$fields->{$fieldId}{fieldType} = $metaField->{dataType};
|
||||
$fields->{$fieldId}{name} = $fieldId;
|
||||
$fields->{$fieldId}{value} = $self->get($fieldId) if $self;
|
||||
}
|
||||
}
|
||||
|
||||
# for each field
|
||||
for my $field ( values %$fields ) {
|
||||
for my $fieldId ( @fieldNames ) {
|
||||
my $field = $fields->{$fieldId};
|
||||
if( $formDescription->{$field->{fieldId}} || $asset->ems->isRegistrationStaff ) {
|
||||
my $drawMethod = __PACKAGE__ . '::' . $field->{customDrawMethod};
|
||||
if ($asset->can( $drawMethod )) {
|
||||
|
|
@ -437,18 +447,21 @@ dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
|
|||
);
|
||||
}
|
||||
}
|
||||
# TODO add the comment form
|
||||
$newform->submit;
|
||||
my $title = $assetId eq 'new' ? $i18n->get('new submission') || 'new' : $asset->get('submissionId');
|
||||
my $title = $assetId eq 'new' ? $i18n_WG->get(99) : $asset->get('title');
|
||||
my $content = $asset->processStyle(
|
||||
$asset->processTemplate({
|
||||
errors => $params->{errors} || [],
|
||||
backUrl => $parent->getUrl,
|
||||
pageTitle => $title,
|
||||
pageForm => $newform->print,
|
||||
commentForm => $self ? $self->getFormattedComments : '',
|
||||
commentFlag => $self ? 1 : 0 ,
|
||||
},$parent->getParent->get('eventSubmissionTemplateId')));
|
||||
WebGUI::Macro::process( $session, \$content );
|
||||
if( $session->form->get('asJson') ) {
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
return JSON->new->encode( { text => $content, title => $title } );
|
||||
return JSON->new->encode( { text => $content, title => $title, id => $assetId ne 'new' ? $assetId : 'new' . rand } );
|
||||
} else {
|
||||
$session->http->setMimeType( 'text/html' );
|
||||
return $content;
|
||||
|
|
@ -465,14 +478,14 @@ sub www_editSubmissionSave {
|
|||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
return $session->privilege->insufficient() unless $self->canEdit;
|
||||
my $formParams = WebGUI::Asset::EMSSubmission->processForm($self);
|
||||
my $formParams = $self->processForm;
|
||||
if( $formParams->{_isValid} ) {
|
||||
delete $formParams->{_isValid};
|
||||
$self->addRevision($formParams);
|
||||
WebGUI::VersionTag->autoCommitWorkingIfEnabled($session, { override => 1, allowComments => 0 });
|
||||
$self = $self->cloneFromDb;
|
||||
$self->sendEmailUpdate;
|
||||
return $self->www_view;
|
||||
return $self->ems->www_viewSubmissionQueue;
|
||||
} else {
|
||||
return $self->www_editSubmission($formParams);
|
||||
}
|
||||
|
|
@ -486,7 +499,7 @@ calles ems->view
|
|||
|
||||
=cut
|
||||
|
||||
sub www_view { $_[0]->ems->www_view }
|
||||
sub www_view { $_[0]->ems->www_viewSubmissionQueue }
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -505,9 +518,10 @@ sub getEditForm {
|
|||
my $comments = $tabform->getTab( 'comments' );
|
||||
|
||||
#add the comments...
|
||||
$comments->div({name => 'comments',
|
||||
contentCallback => sub { $self->getFormattedComments },
|
||||
});
|
||||
# TODO once comments can be submitted using AJAX this will work...
|
||||
# $comments->div({name => 'comments',
|
||||
# contentCallback => sub { $self->getFormattedComments },
|
||||
# });
|
||||
|
||||
return $tabform;
|
||||
}
|
||||
|
|
@ -585,24 +599,36 @@ reference to the EMS asset that is parent to the new submission form asset
|
|||
|
||||
=cut
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
sub processForm {
|
||||
my $this = shift;
|
||||
my $form;
|
||||
my $asset;
|
||||
my $parent;
|
||||
my $self;
|
||||
if( $this eq __PACKAGE__ ) {
|
||||
my $parent = shift;
|
||||
$parent = shift;
|
||||
$form = $parent->session->form;
|
||||
} elsif( ref $this eq __PACKAGE__ ) {
|
||||
$form = $this->session->form;
|
||||
$asset = $parent;
|
||||
} else {
|
||||
return {_isValid => 0, errors => [ { text => 'invalid function call' } ] };
|
||||
$self = $this;
|
||||
$parent = $self->getParent;
|
||||
$form = $self->session->form;
|
||||
$asset = $self;
|
||||
}
|
||||
my $params = {_isValid=>1};
|
||||
# TODO
|
||||
# get description from parent
|
||||
# for each active field
|
||||
# get data from session->form
|
||||
my $formDescription = $parent->getFormDescription;
|
||||
my @idList;
|
||||
if( $asset->ems->isRegistrationStaff ) {
|
||||
@idList = ( 'submissionStatus', keys %$formDescription );
|
||||
} else {
|
||||
@idList = @{$formDescription->{_fieldList}} ;
|
||||
}
|
||||
for my $fieldId ( @idList ) {
|
||||
next if $fieldId =~ /^_/;
|
||||
$params->{$fieldId} = $form->get($fieldId);
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -655,6 +681,7 @@ This method is called when data is purged by the system.
|
|||
=head2 view ( )
|
||||
|
||||
method called by the container www_view method.
|
||||
NOTE: this should net get called, all views are redirected elsewhere.
|
||||
|
||||
=cut
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package WebGUI::Asset::EMSSubmissionForm;
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
|
|
@ -22,11 +21,6 @@ use base 'WebGUI::Asset';
|
|||
use JSON;
|
||||
use WebGUI::Utility;
|
||||
|
||||
# TODO:
|
||||
# To get an installer for your wobject, add the Installable AssetAspect
|
||||
# See WebGUI::AssetAspect::Installable and sbin/installClass.pl for more
|
||||
# details
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Asset::EMSSubmissionForm
|
||||
|
|
@ -47,7 +41,6 @@ These methods are available from this class:
|
|||
|
||||
=cut
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -257,15 +250,14 @@ sub www_editSubmissionForm {
|
|||
)
|
||||
} ( @$res ) );
|
||||
my $title = $i18n->get('select form to edit') ;
|
||||
my $content = $parent->processStyle( '<h1>' . $title .
|
||||
'</h1><ul>' . $listOfLinks . '</ul>' );
|
||||
if( $session->form->get('asJson') ) {
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
return JSON->new->encode( { text => $content, title => $title } );
|
||||
} else {
|
||||
$session->http->setMimeType( 'text/html' );
|
||||
return $content;
|
||||
}
|
||||
my $content = '<h1>' . $title . '</h1><ul>' . $listOfLinks . '</ul>' ;
|
||||
if( $session->form->get('asJson') ) {
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
return JSON->new->encode( { text => $content, title => $title, id => 'list' . rand } );
|
||||
} else {
|
||||
$session->http->setMimeType( 'text/html' );
|
||||
return $parent->ems->processStyle( $content );
|
||||
}
|
||||
}
|
||||
} elsif( $assetId ne 'new' ) {
|
||||
$self ||= WebGUI::Asset->newByDynamicClass($session,$assetId);
|
||||
|
|
@ -280,7 +272,6 @@ sub www_editSubmissionForm {
|
|||
my @fieldNames = qw/title description startDate duration seatsAvailable location/;
|
||||
my $fields;
|
||||
my @defs = reverse @{WebGUI::Asset::EMSSubmission->definition($session)};
|
||||
dav::dump 'editSubmissionForm::definition:', [@defs];
|
||||
for my $def ( @defs ) {
|
||||
foreach my $fieldName ( @fieldNames ) {
|
||||
my $properties = $def->{properties};
|
||||
|
|
@ -300,7 +291,6 @@ dav::dump 'editSubmissionForm::definition:', [@defs];
|
|||
}
|
||||
$newform->hidden( name => 'fieldNames', value => join( ' ', @fieldNames ) );
|
||||
@defs = reverse @{WebGUI::Asset::EMSSubmissionForm->definition($session)};
|
||||
dav::dump 'editSubmissionForm::dump submission form def', \@defs ;
|
||||
for my $def ( @defs ) {
|
||||
my $properties = $def->{properties};
|
||||
for my $fieldName ( qw/title menuTitle url description canSubmitGroupId daysBeforeCleanup
|
||||
|
|
@ -309,15 +299,14 @@ dav::dump 'editSubmissionForm::dump submission form def', \@defs ;
|
|||
my %fieldParams = %{$properties->{$fieldName}};
|
||||
$fieldParams{name} = $fieldName;
|
||||
$fieldParams{value} = $params->{$fieldName} || $self ? $self->get($fieldName) : undef ;
|
||||
dav::dump 'editSubmissionForm::properties for ', $fieldName, \%fieldParams ;
|
||||
$newform->dynamicField(%fieldParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
dav::dump 'editSubmissionForm::dump before generate:',$fields;
|
||||
|
||||
my $formDescription = $params->{formDescription} || $self ? $self->getFormDescription : { };
|
||||
for my $fieldId ( @fieldNames ) {
|
||||
next if $fieldId eq 'submissionStatus';
|
||||
my $field = $fields->{$fieldId};
|
||||
$newform->yesNo(
|
||||
label => $field->{label},
|
||||
|
|
@ -328,19 +317,23 @@ dav::dump 'editSubmissionForm::dump before generate:',$fields;
|
|||
}
|
||||
$newform->submit;
|
||||
my $title = $assetId eq 'new' ? $i18n->get('new form') || 'new' : $asset->get('title');
|
||||
my $content = $asset->processStyle(
|
||||
$asset->processTemplate({
|
||||
if( $session->form->get('asJson') ) {
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
} else {
|
||||
$session->http->setMimeType( 'text/html' );
|
||||
}
|
||||
my $content = $asset->processTemplate({
|
||||
errors => $params->{errors} || [],
|
||||
backUrl => $parent->getUrl,
|
||||
pageTitle => $title,
|
||||
pageForm => $newform->print,
|
||||
},$parent->get('eventSubmissionTemplateId')));
|
||||
if( $session->form->get('asJson') ) {
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
return JSON->new->encode( { text => $content, title => $title } );
|
||||
} else {
|
||||
$session->http->setMimeType( 'text/html' );
|
||||
return $content;
|
||||
}
|
||||
},$parent->get('eventSubmissionTemplateId'));
|
||||
WebGUI::Macro::process( $session, \$content );
|
||||
if( $session->form->get('asJson') ) {
|
||||
return JSON->new->encode( { text => $content, title => $title, id => $assetId ne 'new' ? $assetId : 'new' . rand } );
|
||||
} else {
|
||||
return $asset->ems->processStyle( $content );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -375,7 +368,7 @@ calls ems->view
|
|||
|
||||
=cut
|
||||
|
||||
sub www_view { $_[0]->ems->www_view }
|
||||
sub www_view { $_[0]->ems->www_viewSubmissionQueue }
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -483,6 +476,7 @@ This method is called when data is purged by the system.
|
|||
=head2 view ( )
|
||||
|
||||
method called by the container www_view method.
|
||||
Note: this really shouldn't get called, all views are redirected elsewhere
|
||||
|
||||
=cut
|
||||
|
||||
|
|
@ -504,7 +498,6 @@ calls www_editSubmission with assetId == new
|
|||
=cut
|
||||
|
||||
sub www_addSubmission {
|
||||
dav::log __PACKAGE__ . '::www_addSubmission';
|
||||
my $self = shift;
|
||||
$self->www_editSubmission( { assetId => 'new' } );
|
||||
}
|
||||
|
|
@ -537,7 +530,6 @@ calls WebGUI::Asset::EMSSubmission->editSubmission
|
|||
=cut
|
||||
|
||||
sub www_editSubmission {
|
||||
dav::log __PACKAGE__ . '::www_editSubmission';
|
||||
my $self = shift;
|
||||
return $self->session->privilege->insufficient() unless $self->canEdit;
|
||||
return WebGUI::Asset::EMSSubmission->www_editSubmission($self,shift);
|
||||
|
|
@ -576,16 +568,18 @@ reference to the EMS asset that is parent to the new submission form asset
|
|||
|
||||
=cut
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
sub processForm {
|
||||
my $this = shift;
|
||||
my $form;
|
||||
my $session;
|
||||
if( $this eq __PACKAGE__ ) {
|
||||
my $parent = shift;
|
||||
$form = $parent->session->form;
|
||||
$session = $parent->session;
|
||||
$form = $session->form;
|
||||
} elsif( ref $this eq __PACKAGE__ ) {
|
||||
$form = $this->session->form;
|
||||
$session = $this->session;
|
||||
$form = $session->form;
|
||||
} else {
|
||||
return {_isValid => 0, errors => [ { text => 'invalid function call' } ] };
|
||||
}
|
||||
|
|
@ -597,11 +591,12 @@ 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;
|
||||
if( scalar( @{$params->{formDescription}{_fieldList}} ) == 0 ) {
|
||||
$params->{_isValid} = 0;
|
||||
push @{$params->{errors}}, {text => 'you should turn on at least one entry field' }; # TODO internationalize this
|
||||
my $i18n = WebGUI::International->new( $session, "Asset_EMSSubmissionForm" );
|
||||
push @{$params->{errors}}, {text => $i18n->get('turn on one field') };
|
||||
}
|
||||
dav::dump 'processForm::params:', $params;
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package WebGUI::Asset::Wobject::EventManagementSystem;
|
||||
|
||||
use lib '/root/pb/lib'; use dav;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
|
|
@ -47,7 +46,8 @@ adds the parameter to eventSubmissionGroups
|
|||
sub addGroupToSubmitList {
|
||||
my $self = shift;
|
||||
my $groupId = shift;
|
||||
my @ids = split(' ', $self->get('eventSubmissionGroups'));
|
||||
my ($idString) = $self->session->db->read('select eventSubmissionGroups from EventManagementSystem where assetId = ?', [ $self->getId ] )->array;
|
||||
my @ids = split(' ', $idString);
|
||||
my %h;
|
||||
@ids = map { $h{$_}++ == 0 ? $_ : () } ( $groupId, @ids );
|
||||
$self->update({eventSubmissionGroups => join( ' ', @ids ) });
|
||||
|
|
@ -302,6 +302,21 @@ sub deleteEventMetaField {
|
|||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 ems
|
||||
|
||||
this is called by the submission sub-system
|
||||
it is for compatability and ensures that the ems
|
||||
object is used for certain calls
|
||||
|
||||
=cut
|
||||
|
||||
sub ems {
|
||||
my $self = shift;
|
||||
return $self;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getBadges ()
|
||||
|
|
@ -443,7 +458,6 @@ get a sequence number for the submission id
|
|||
|
||||
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;
|
||||
|
|
@ -489,7 +503,6 @@ retuns an arrayref of the locations found in the submission location list
|
|||
sub getSubmissionLocations {
|
||||
my $self = shift;
|
||||
my $text = $self->get('submittedLocationsList');
|
||||
dav::log 'getSubmissionLocations:"', $text, '"';
|
||||
return undef if $text eq '';
|
||||
return [ split( /\s+/, $text ) ];
|
||||
}
|
||||
|
|
@ -745,7 +758,6 @@ display a form or links to forms to create a new submission
|
|||
=cut
|
||||
|
||||
sub www_addSubmission {
|
||||
dav::log __PACKAGE__ . '::www_addSubmission';
|
||||
my $self = shift;
|
||||
my $params = shift || {};
|
||||
my $session = $self->session;
|
||||
|
|
@ -765,20 +777,31 @@ dav::log __PACKAGE__ . '::www_addSubmission';
|
|||
$formId = $form->getId;
|
||||
} else {
|
||||
my $makeAnchorList =sub{ my $u=shift; my $n=shift; my $d=shift;
|
||||
return qq{<li><a href='$u' title='$d'>$n</a></li>} } ;
|
||||
return qq{<li><a href='$u' onclick='WebGUI.EMS.loadItemFromAnchor(this)' title='$d'>$n</a></li>} } ;
|
||||
my $listOfLinks = join '', ( map {
|
||||
$makeAnchorList->(
|
||||
$_->getUrl('func=addSubmission' ),
|
||||
$self->getUrl('func=viewSubmissionQueue#' . $_->getId . '_new' ), # _new has to match same in sub www_viewSubmissionQueue in this module
|
||||
$_->get('title'),
|
||||
WebGUI::HTML::filter($_->get('description'),'all')
|
||||
)
|
||||
} ( @new ) );
|
||||
return $self->processStyle( '<h1>' . $i18n->get('select form to submit') .
|
||||
'</h1><ul>' . $listOfLinks . '</ul>' );
|
||||
my $title = $i18n->get('select form to submit') ;
|
||||
my $asJson = $session->form->get('asJson');
|
||||
if( $asJson ) {
|
||||
$session->http->setMimeType( 'application/json' );
|
||||
} else {
|
||||
$session->http->setMimeType( 'text/html' );
|
||||
}
|
||||
my $content = '<h1>' . $title . '</h1><ul>' . $listOfLinks . '</ul>' ;
|
||||
use lib '/root/pb/lib'; use dav; dav::log $content;
|
||||
if( $asJson ) {
|
||||
return JSON->new->encode( { text => $content, title => $title, id => 'list' . rand } );
|
||||
} else {
|
||||
return $self->ProcessStyle( $content );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$form = WebGUI::Asset->newByDynamicClass($session,$formId);
|
||||
}
|
||||
$form = WebGUI::Asset->newByDynamicClass($session,$formId);
|
||||
if (!defined $form) {
|
||||
$session->errorHandler->error(__PACKAGE__ . " - failed to instanciate asset with assetId $formId");
|
||||
}
|
||||
|
|
@ -1010,7 +1033,6 @@ sub www_editSubmissionForm {
|
|||
return WebGUI::Asset::EMSSubmissionForm->www_editSubmissionForm($self,shift);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 www_editSubmissionFormSave
|
||||
|
|
@ -1254,7 +1276,6 @@ sub www_getAllSubmissions {
|
|||
my $session = $self->session;
|
||||
my $datetime = $session->datetime;
|
||||
my $form = $session->form;
|
||||
my $rowsPerPage = 25;
|
||||
my $tableInfo = {};
|
||||
|
||||
return $session->privilege->insufficient unless $self->canSubmit || $self->isRegistrationStaff;
|
||||
|
|
@ -1385,6 +1406,7 @@ sub www_getSubmissionById {
|
|||
} else {
|
||||
$result->{text} = $res->[0]->www_editSubmission;
|
||||
$result->{title} = $submissionId;
|
||||
$result->{id} = $submissionId;
|
||||
}
|
||||
$self->session->http->setMimeType('application/json');
|
||||
return JSON->new->encode($result);
|
||||
|
|
@ -2633,11 +2655,17 @@ sub www_viewSubmissionQueue {
|
|||
return $self->session->privilege->insufficient() unless $canSubmit || $isRegistrationStaff;
|
||||
|
||||
# this map returns an array of hash refs with an id,url pair to describe the submissionForm assets
|
||||
my @submissionFormUrls = map { {
|
||||
my @submissionFormUrls = map { { # edit form
|
||||
id => $_->getId,
|
||||
edit => 1,
|
||||
title => $_->get('title'),
|
||||
linkUrl => $self->getUrl('func=viewSubmissionQueue#' . $_->getId ),
|
||||
ajaxUrl => $_->getUrl('func=editSubmissionForm'),
|
||||
},{ # new submission ( _new has to match same in sub www_addSubmission in this module
|
||||
id => $_->getId . '_new',
|
||||
title => $_->get('title') . ' - ' . $i18n->get('add submission'),
|
||||
linkUrl => $self->getUrl('func=viewSubmissionQueue#' . $_->getId . '_new' ),
|
||||
ajaxUrl => $_->getUrl('func=addSubmission'),
|
||||
} } (
|
||||
@{$self->getLineage( ['children'],{ returnObjects => 1,
|
||||
includeOnlyClasses => ['WebGUI::Asset::EMSSubmissionForm'],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue