Commit ea37d115 authored by Stacey Walker's avatar Stacey Walker
Browse files

collection: use new submitcancel form element (bug: 619266)


Signed-off-by: default avatarStacey Walker <stacey@catalyst.net.nz>
parent 918cd3c8
......@@ -58,13 +58,14 @@ else {
}
$elements = Collection::get_collectionform_elements($data);
$submitcancelstr = $new ? array(get_string('next') . ': ' . get_string('editviews', 'collection'), get_string('cancel'))
$submitstr = $new ? array('cancel' => get_string('cancel'), 'submit' => get_string('next') . ': ' . get_string('editviews', 'collection'))
: array(get_string('save'), get_string('cancel'));
$confirm = $new ? array('cancel' => get_string('confirmcancelcreatingcollection','collection')) : null;
$elements['submit'] = array(
'type' => 'submitcancel',
'value' => $submitcancelstr,
'goto' => get_config('wwwroot') . 'collection',
'type' => 'submitcancel',
'value' => $submitstr,
'confirm' => $confirm,
);
$form = pieform(array(
......@@ -89,4 +90,12 @@ function submit(Pieform $form, $values) {
$collection->post_edit_redirect($new);
}
function edit_cancel_submit() {
global $collection, $new;
if ($new && $collection) {
$collection->delete();
}
redirect('/collection/');
}
?>
......@@ -164,7 +164,7 @@ function addviews_submit(Pieform $form, $values) {
function manageviews_cancel_submit() {
global $collection, $new;
if ($new) {
if ($new && $collection) {
$collection->delete();
}
redirect('/collection/');
......
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