Commit f71bac79 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Fix copy form & rename template on group views page


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 51aa39fb
{include file="header.tpl"}
{if $views}
<table class="fullwidth">
{foreach from=$views item=view}
<tr class="{cycle values='r0,r1'}">
<td>
<h5><a href="{$WWWROOT}view/view.php?id={$view.id}">{$view.title}</a></h5>
{if $view.description}
<div>{$view.description|clean_html|safe}</div>
{/if}
</td>
<td class="right">
{if $view.copyform}{$view.copyform|safe}{/if}
</td>
</tr>
{/foreach}
</table>
<div class="center">{$pagination|safe}</div>
{else}
<div class="message">{str tag="noviewstosee" section="group"}</div>
{/if}
{include file="footer.tpl"}
{auto_escape off}
{include file="header.tpl"}
{if $views}
<table class="fullwidth">
{foreach from=$views item=view}
<tr>
<td class="{cycle values='r0,r1'}">
<h5><a href="{$WWWROOT}view/view.php?id={$view.id}">{$view.title|escape}</a> {str tag=by section=view}
<a href="{$WWWROOT}{if $view.group}group{else}user{/if}/view.php?id={if $view.group}{$view.group}{else}{$view.owner}{/if}">{if $view.sharedby}{$view.sharedby}{else}{$groupname}{/if}</a>
</h5>
<span>
{if $view.description}
{$view.description}
{/if}
{if $view.description && $view.artefacts}<br>{/if}
{if $view.artefacts}
<strong>{str tag="artefacts" section="view"}:</strong>
{foreach from=$view.artefacts item=artefact name=artefacts}<a href="{$WWWROOT}view/artefact.php?artefact={$artefact.id}&amp;view={$view.id}" class="link-artefacts">{$artefact.title|escape}</a>{if !$.foreach.artefacts.last}, {/if}{/foreach}
{/if}
{if $view.template}
<a href="">{str tag=copythisview section=view}</a>
{/if}
</span>
</td>
</tr>
{/foreach}
</table>
<div class="center">{$pagination}</div>
{else}
<div class="message">{str tag="noviewstosee" section="group"}</div>
{/if}
{include file="footer.tpl"}
{/auto_escape}
......@@ -38,8 +38,6 @@ require_once(get_config('libroot') . 'view.php');
require_once(get_config('libroot') . 'group.php');
require_once('pieforms/pieform.php');
//@todo: group menu; group sideblock
$limit = param_integer('limit', 5);
$offset = param_integer('offset', 0);
define('GROUP', param_integer('group'));
......@@ -50,24 +48,26 @@ if (!is_logged_in() && !$group->public) {
define('TITLE', $group->name . ' - ' . get_string('groupviews', 'view'));
$member = group_user_access($group->id);
$shared = param_boolean('shared', 0) && $member;
$can_edit = group_user_can_edit_views($group->id);
$createviewform = pieform(create_view_form($group->id));
$smarty = smarty();
$smarty->assign('heading', $group->name);
// If the user can edit group views, show a page similar to the my views
// page, otherwise just show a list of the views owned by this group that
// are visible to the user.
if ($can_edit) {
$data = View::get_myviews_data($limit, $offset, $group->id);
$createviewform = pieform(create_view_form($group->id));
}
else {
$data = View::view_search(null, null, (object) array('group' => $group->id), null, $limit, $offset);
// Add a copy view form for all templates in the list
foreach ($data->data as &$v) {
if ($v['template']) {
$v['copyform'] = pieform(create_view_form(null, null, $v['id']));
}
}
}
$userid = $USER->get('id');
$pagination = build_pagination(array(
'url' => get_config('wwwroot') . 'view/groupviews.php?group='.$group->id,
'count' => $data->count,
......@@ -77,16 +77,13 @@ $pagination = build_pagination(array(
'resultcounttextplural' => get_string('views', 'view')
));
$smarty->assign('groupviews', 1);
$smarty->assign('member', $member);
$smarty = smarty();
$smarty->assign('views', $data->data);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('createviewform', $createviewform);
if ($can_edit) { // && !$shared) {
if ($can_edit) {
$smarty->assign('createviewform', $createviewform);
$smarty->display('view/index.tpl');
} else {
$smarty->display('view/sharedviews.tpl');
$smarty->display('view/groupviews.tpl');
}
?>
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