initial coding on activities

lots of debugging
This commit is contained in:
daviddelikat 2009-10-29 09:05:42 -05:00
parent cd66dbb780
commit debcdd08a5
7 changed files with 88 additions and 39 deletions

View file

@ -360,13 +360,9 @@ 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 $assetId = $self ? $self->getId : $params->{assetId} || $session->form->get('assetId');
my $assetId = $self ? $self->getId : $params->{assetId} || $session->form->get('assetId') || 'new';
if( ! defined( $assetId ) ) {
# if somebody calls without an assetId then display the queue for the EMS (grandparent)
dav::log 'EMSSubmission::www_editSubmission: asseId not defined';
return $parent->getParent->www_viewSubmissionQueue;
} elsif( $assetId ne 'new' ) {
if( $assetId ne 'new' ) {
dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
$self ||= WebGUI::Asset->newByDynamicClass($session,$assetId);
if (!defined $self) {

View file

@ -259,8 +259,16 @@ sub www_editSubmissionForm {
WebGUI::HTML::filter($_->get('description'),'all')
)
} ( @$res ) );
return $parent->processStyle( '<h1>' . $i18n->get('select form to edit') .
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;
}
}
} elsif( $assetId ne 'new' ) {
$self ||= WebGUI::Asset->newByDynamicClass($session,$assetId);

View file

@ -50,7 +50,7 @@ sub addGroupToSubmitList {
my @ids = split(' ', $self->get('eventSubmissionGroups'));
my %h;
@ids = map { $h{$_}++ == 0 ? $_ : () } ( $groupId, @ids );
$self->update({eventSubmissionGroups => join( ' ', @ids ) });
$self->addRevision({eventSubmissionGroups => join( ' ', @ids ) });
}
#-------------------------------------------------------------------
@ -107,6 +107,7 @@ returns true is the current user can submit to any form attached to this EMS
sub canSubmit {
my $self = shift;
my $user = $self->session->user;
return 0 if ! $self->hasSubmissionForms;
for my $groupId (split ' ', $self->get('eventSubmissionGroups')) {
return 1 if $user->isInGroup($groupId);
}
@ -433,7 +434,7 @@ 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) } );
$self->addRevision( { nextSubmissionId => ($submissionId + 1) } );
return $submissionId;
}