Commit 8695ca39 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1676230: Style group view list page for non-editable member correctly



Previously we had a pair of different templates for this - but we just
need to have a flag to hide edit buttons when one can't doesn't have
edit rites

behatnotneeded

Change-Id: Iff591157ea787f25163c1243789337eceb95b2fd
Signed-off-by: default avatarRobert Lyon <robertl@catalyst.net.nz>
parent 8df92d8f
Loading
Loading
Loading
Loading
+28 −5
Original line number Diff line number Diff line
@@ -45,7 +45,32 @@ if (!empty($groupid)) {
        $limit = user_preferred_limit($limit);
        $offset = param_integer('offset', 0);

        $data = View::view_search(null, null, (object) array('group' => $group->id), null, $limit, $offset);
        $data = View::view_search(null, null, (object) array('group' => $group->id), null, $limit, $offset,
                                                 true, null, null, false, null, null,
                                                 null, null, true);
        $viewdata = $data->data;
        View::get_extra_view_info($viewdata, false);
        View::get_extra_collection_info($viewdata, false, 'collid');
        require_once('collection.php');
        if ($viewdata) {
            foreach ($viewdata as $id => &$item) {
                $item['uniqueid'] = 'u' . $item['id'] . '_' . $item['collid'];
                $item['vctime'] = $item['ctime'];
                $item['vmtime'] = $item['mtime'];
                if (!empty($item['collid'])) {
                    $collobj = new Collection($item['collid']);
                    $item['displaytitle'] = $collobj->get('name');
                    $item['collviews'] = $collobj->views();
                    $item['numviews'] = $item['numpages'];
                    if ($collobj->has_framework()) {
                        $item['framework'] = $collobj->collection_nav_framework_option();
                    }
                }
            }
        }

        $data->data  = $viewdata;

        // Add a copy view form for all templates in the list
        foreach ($data->data as &$v) {
            if ($v['template']) {
@@ -57,7 +82,7 @@ if (!empty($groupid)) {
            'count' => $data->count,
            'limit' => $limit,
            'offset' => $offset,
            'orderby' => $orderby,
            'orderby' => 'atoz',
            'group' => $groupid,
            'databutton' => 'showmorebtn',
            'jsonscript' => 'json/viewlist.php',
@@ -91,9 +116,7 @@ $smarty->assign('views', $data->data);
$smarty->assign('sitetemplate', View::SITE_TEMPLATE);
$smarty->assign('pagination', $pagination['html']);
if ($groupid && !$can_edit) {
    $html = $smarty->fetch('view/indexgroupresults.tpl');
    $smarty->assign('viewresults', $html);
    $smarty->display('view/groupviews.tpl');
    $smarty->assign('noedit', true);
}
else if ($groupid) {
    $smarty->assign('editlocked', $role == 'admin');
+0 −17
Original line number Diff line number Diff line
{include file="header.tpl"}

{if $views}
    <div id="groupviews" class="view-container">
        <div class="panel panel-default">
            <h2 class="panel-heading hidefocus" tabindex="-1">Results</h2>
            <div class="list-group">
                {$viewresults|safe}
            </div>
        </div>
    </div>
    <div>{$pagination|safe}</div>
{else}
<div class="no-results">{str tag="noviewstosee" section="group"}</div>
{/if}

{include file="footer.tpl"}
+0 −26
Original line number Diff line number Diff line
                {foreach from=$views item=view}
                <div class="list-group-item">
                    <a href="{$view.fullurl}" class="outer-link">
                        <span class="sr-only">{$view.title}</span>
                    </a>
                    <div class="row">
                         <div class="col-md-9">
                            <h3 class="title list-group-item-heading">{$view.title}</h3>
                            {if $view.description}
                                <div class="detail">
                                    {$view.description|clean_html|safe}
                                </div>
                            {/if}
                        </div>
                        {if $view.copyform}
                        <div class="col-md-3">
                            <div class="inner-link btn-action-list">
                                <div class="btn-top-right btn-group btn-group-top only-button">
                                    {$view.copyform|safe}
                                </div>
                            </div>
                        </div>
                        {/if}
                    </div>
                </div>
                {/foreach}
+3 −3
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
                                </button>
                                <span class="collnum-arrow icon icon-chevron-down"></span>
                                <ul class="dropdown-menu dropdown-menu-right" role="menu">
                                {if $view.collid && !$view.submittedto}
                                {if $view.collid && !$view.submittedto && !$noedit}
                                    <li>
                                        <a href="{$WWWROOT}collection/views.php?id={$view.collid}" title="{str tag=manageviews section=collection}">
                                            <span class="icon icon-list left" role="presentation" aria-hidden="true"></span>
@@ -51,7 +51,7 @@
                                        </a>
                                    </li>
                                {/if}
                                {if !$view.submittedto && (!$view.locked || $editlocked)}
                                {if !$view.submittedto && !$noedit && (!$view.locked || $editlocked)}
                                    <li>
                                    {if $view.collid}
                                        <a href="{$WWWROOT}collection/edit.php?id={$view.collid}" title="{str tag=edittitleanddescription section=view}">
@@ -64,7 +64,7 @@
                                        </a>
                                    </li>
                                {/if}
                                {if !$view.submittedto && $view.removable && (!$view.locked || $editlocked)}
                                {if !$view.submittedto && $view.removable && !$noedit && (!$view.locked || $editlocked)}
                                    <li>
                                    {if $view.collid}
                                        <a href="{$WWWROOT}collection/delete.php?id={$view.collid}" title="{str tag=deletecollection section=collection}">
+0 −17
Original line number Diff line number Diff line
{include file="header.tpl"}

{if $views}
    <div id="groupviews" class="view-container">
        <div class="panel panel-default">
            <h2 class="panel-heading hidefocus" tabindex="-1">Results</h2>
            <div class="list-group">
                {$viewresults|safe}
            </div>
        </div>
    </div>
    <div>{$pagination|safe}</div>
{else}
<div class="no-results">{str tag="noviewstosee" section="group"}</div>
{/if}

{include file="footer.tpl"}
Loading