Commit 3d364fba authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic
Browse files

Bug 1871722: add cancel button to Collections manage views

to get the url for the cancel button I added back the code removed here
https://reviews.mahara.org/#/c/10633/12/htdocs/collection/views.php

behatnotneeded

Change-Id: I29e17a2dd5ffca4b69c9bb6c547af0ff3c848177
parent b20ef6c6
......@@ -55,30 +55,40 @@ EOF;
$owner = $collection->get('owner');
$groupid = $collection->get('group');
$institutionname = $collection->get('institution');
$urlparams = array();
if (!empty($groupid)) {
define('MENUITEM', 'engage/index');
define('MENUITEM_SUBPAGE', 'views');
define('GROUP', $groupid);
$group = group_current_group();
define('TITLE', $group->name . ' - ' . get_string('editviews', 'collection'));
$baseurl = get_config('wwwroot') . 'view/groupviews.php';
$urlparams['group'] = $groupid;
}
else if (!empty($institutionname)) {
if ($institutionname == 'mahara') {
define('ADMIN', 1);
define('MENUITEM', 'configsite/views');
$baseurl = get_config('wwwroot') . 'admin/site/views.php';
}
else {
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/institutionviews');
$baseurl = get_config('wwwroot') . 'view/institutionviews.php';
}
define('TITLE', get_string('editviews', 'collection'));
$urlparams['institution'] = $institutionname;
}
else {
define('MENUITEM', 'create/views');
define('TITLE', get_string('editviews', 'collection'));
$baseurl = get_config('wwwroot') . 'view/index.php';
}
define('SUBSECTIONHEADING', $collection->get('name'));
if ($urlparams) {
$baseurl .= '?' . http_build_query($urlparams);
}
$accessurl = get_config('wwwroot') . 'view/accessurl.php?collection=' . $id;
if ($collection->is_submitted()) {
......@@ -163,6 +173,7 @@ setpageicon($smarty, 'icon-folder-open');
$smarty->assign('id', $id);
$smarty->assign('INLINEJAVASCRIPT', $inlinejs);
$smarty->assign('accessurl', $accessurl);
$smarty->assign('baseurl', $baseurl);
$smarty->assign('displayurl', get_config('wwwroot') . 'collection/views.php?id=' . $id);
$smarty->assign('removeurl', get_config('wwwroot') . 'collection/deleteview.php?id=' . $id);
$smarty->assign('views', $views);
......
......@@ -69,8 +69,10 @@
</fieldset>
</div>
</div>
<div id="collectiondonewrap">
<a class="btn btn-primary" href="{$accessurl}">{str tag=nexteditaccess section=collection}</a>
<div id="collectiondonewrap" class=" primary submitcancel form-group">
<a class="btn-primary submitcancel submit btn" href="{$accessurl}">{str tag=nexteditaccess section=collection}</a>
<a class="btn-primary submitcancel cancel btn" href="{$baseurl}">{str tag=cancel}</a>
</div>
{include file="footer.tpl"}
......@@ -26,7 +26,7 @@ if ($collectionid = param_integer('collection', null)) {
$collection = new Collection($collectionid);
$views = $collection->views();
if (empty($views)) {
$SESSION->add_error_msg(get_string('emptycollectionnoaccessurl', 'collection'));
$SESSION->add_error_msg(get_string('emptycollectionnoeditaccess', 'collection'));
redirect('/collection/views.php?id=' . $collectionid);
}
// Pick any old view, they all have the same access records.
......
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