not exactly working at the moment

This commit is contained in:
daviddelikat 2009-10-28 10:13:48 -05:00
parent 9db3e02444
commit cd66dbb780
4 changed files with 88 additions and 66 deletions

View file

@ -420,12 +420,20 @@ dav::log 'EMSSubmission::www_editSubmission: asseId ne new';
}
# TODO add the comment form
$newform->submit;
return $asset->processStyle(
my $title = $assetId eq 'new' ? $i18n->get('new submission') || 'new' : $asset->get('submissionId');
my $content = $asset->processStyle(
$asset->processTemplate({
errors => $params->{errors} || [],
backUrl => $parent->getUrl,
pageForm => $newform->print,
},$parent->getParent->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;
}
}
#-------------------------------------------------------------------

View file

@ -322,12 +322,21 @@ dav::dump 'editSubmissionForm::dump before generate:',$fields;
);
}
$newform->submit;
return $asset->processStyle(
my $title = $assetId eq 'new' ? $i18n->get('new form') || 'new' : $asset->get('title');
my $content = $asset->processStyle(
$asset->processTemplate({
errors => $params->{errors} || [],
backUrl => $parent->getUrl,
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;
}
}
#-------------------------------------------------------------------

View file

@ -1349,8 +1349,8 @@ sub www_getSubmissionById {
$result->{hasError} = 1;
$result->{errors} = [ 'failed to load submission' ];
} else {
$result->{itemText} = $res->[0]->www_editSubmission;
$result->{submissionId} = $submissionId;
$result->{text} = $res->[0]->www_editSubmission;
$result->{title} = $submissionId;
}
$self->session->http->setMimeType('application/json');
return JSON->new->encode($result);