Commit 82bd2a43 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Call the create view submit function before building the choose template page

parent 598e9495
......@@ -135,6 +135,7 @@ class PluginBlocktypeResumefield extends PluginBlocktype {
public static function default_artefact_config($ownertype=null, $ownerid=null, $configdata) {
$artefactid = null;
if ($ownertype == 'user') {
$artefacttype = null;
if (!empty($configdata['artefactid'])) {
$artefacttype = get_field('artefact', 'artefacttype', 'id', $configdata['artefactid']);
}
......
......@@ -2069,6 +2069,7 @@ function create_view_form($group=null, $institution=null, $template=null) {
'value' => $template,
);
$form['elements']['submit']['value'] = get_string('copyview', 'view');
$form['name'] .= $template;
}
return $form;
}
......@@ -2086,7 +2087,6 @@ function createview_submit(Pieform $form, $values) {
|| $institution && !$USER->can_edit_institution($institution)) {
throw new AccessDeniedException();
}
log_debug($group);
// Create a new view
$data = (object) array(
......
......@@ -34,6 +34,12 @@ $group = param_integer('group', null);
$institution = param_alphanum('institution', null);
View::set_nav($group, $institution);
if ($usetemplate = param_integer('usetemplate', null)) {
// If a form has been submitted, build it now and pieforms will
// call the submit function straight away
pieform(create_view_form($group, $institution, $usetemplate));
}
if ($group && !group_user_can_edit_views($group) || $institution && !$USER->can_edit_institution($institution)) {
throw new AccessDeniedException();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment