Commit a3e9c291 authored by Son Nguyen's avatar Son Nguyen
Browse files

Enable group collections tab for all group members (Bug #886080)



Group members can see group collections that they have access to via the
Collection tab even when they cannot edit group pages and collections.

Change-Id: I9201d4320c83762261ba57e232564b756ce8f051
Signed-off-by: default avatarSon Nguyen <son.nguyen@catalyst.net.nz>
parent 81167172
......@@ -49,7 +49,7 @@ if (!empty($groupid)) {
// Check if user can edit group collections <-> user can edit group views
$role = group_user_access($group->id);
$canedit = $role && group_role_can_edit_views($group, $role);
if (!$canedit) {
if (!$role) {
throw new GroupAccessDeniedException(get_string('cantlistgroupcollections', 'collection'));
}
......@@ -138,6 +138,9 @@ if (!empty($institutionname) && ($institutionname != 'mahara')) {
$smarty->assign('institutionselector', $s['institutionselector']);
$smarty->assign('INLINEJAVASCRIPT', $s['institutionselectorjs']);
}
if (empty($owner)) {
$smarty->assign('canedit', $canedit);
}
$smarty->assign('urlparamsstr', $urlparamsstr);
$smarty->assign('collections', $data->data);
$smarty->assign('pagination', $pagination['html']);
......
......@@ -1685,15 +1685,15 @@ function group_get_menu_tabs() {
'title' => get_string('Views', 'group'),
'weight' => 50,
);
$menu['collections'] = array(
'path' => 'groups/collections',
'url' => 'collection/index.php?group='.$group->id,
'title' => get_string('Collections', 'group'),
'weight' => 60,
);
if (group_role_can_edit_views($group, $role)) {
$menu['collections'] = array(
'path' => 'groups/collections',
'url' => 'collection/index.php?group='.$group->id,
'title' => get_string('Collections', 'group'),
'weight' => 60,
);
if (group_role_can_edit_views($group, $role)) {
$menu['share'] = array(
'path' => 'groups/share',
'url' => 'group/shareviews.php?group='.$group->id,
......
......@@ -3,18 +3,21 @@
<h2>{$PAGESUBHEADING}</h2>
{/if}
{if $institution}{$institutionselector|safe}{/if}
{if $canedit}
<div class="rbuttons {if $GROUP}pagetabs{/if}">
<a class="btn" href="{$WWWROOT}collection/edit.php?new=1{$urlparamsstr}">{str section=collection tag=newcollection}</a>
<a class="btn" href="{$WWWROOT}view/choosetemplate.php?searchcollection=1{$urlparamsstr}">{str section=collection tag=copyacollection}</a>
</div>
{/if}
<p class="intro">{str tag=collectiondescription section=collection}</p>
{if !$canedit}<p>{str tag=canteditgroupcollections section=collection}</p>{/if}
{if $collections}
<table id="myviews" class="fullwidth listing">
<tbody>
{foreach from=$collections item=collection}
<tr class="{cycle values='r0,r1'}">
<td>
{if !$collection->submitinfo}
{if !$collection->submitinfo && $canedit}
<div class="fr viewcontrolbuttons">
<a href="{$WWWROOT}collection/views.php?id={$collection->id}" title="{str tag=manageviews section=collection}"><img src="{theme_url filename='images/manage.gif'}" alt="{str tag=manageviews section=collection}"></a>
<a href="{$WWWROOT}collection/edit.php?id={$collection->id}" title="{str tag=edittitleanddescription section=view}"><img src="{theme_url filename='images/edit.gif'}" alt="{str tag=edit}"></a>
......
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