Commit 8a286245 authored by Robert Lyon's avatar Robert Lyon
Browse files

Bug 1724113: Fixing up portfolio access secret URL count



Only show the secret url info once for each portfolio
Also fix the sort by owner so pagination works correctly

behatnotneeded

Change-Id: I3ea9ef06b45ea785eeda154beb37a8da6ec27407
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
(cherry picked from commit dbfa06ba)
parent 9ab7047f
......@@ -3148,11 +3148,11 @@ function accesslist_stats_table($limit, $offset, $extra, $institution, $urllink)
$orderby = " views " . (!empty($extra['sortdesc']) ? 'DESC' : 'ASC');
break;
case "views":
$orderby = " title " . (!empty($extra['sortdesc']) ? 'DESC' : 'ASC');
$orderby = " title " . (!empty($extra['sortdesc']) ? 'DESC' : 'ASC') . ", displayname";
break;
case "owner":
default:
$orderby = " displayname " . (!empty($extra['sortdesc']) ? 'DESC' : 'ASC');
$orderby = " displayname " . (!empty($extra['sortdesc']) ? 'DESC' : 'ASC') . ", title, viewid";
}
$sql = "SELECT userid, displayname, viewid, collectionid, views, title, vctime
" . $fromsql . $wheresql . "
......@@ -3173,11 +3173,12 @@ function accesslist_stats_table($limit, $offset, $extra, $institution, $urllink)
SELECT *, 0 AS secreturls
FROM {view_access} WHERE view = ? AND token IS NULL
UNION
SELECT *, (SELECT COUNT(*) FROM {view_access} va2 WHERE token IS NOT NULL AND va2.view = va.view) AS secreturls
FROM {view_access} va WHERE va.view = ? AND va.token IS NOT NULL",
(SELECT *, (SELECT COUNT(*) FROM {view_access} va2 WHERE token IS NOT NULL AND va2.view = va.view) AS secreturls
FROM {view_access} va WHERE va.view = ? AND va.token IS NOT NULL LIMIT 1)",
array($item->viewid, $item->viewid));
$item->hasaccessrules = !empty($item->access);
}
if (!empty($extra['csvdownload'])) {
$csvfields = array('displayname', 'userurl', 'title', 'views', 'hasaccessrules');
$USER->set_download_file(generate_csv($data, $csvfields), $institution . 'accessstatistics.csv', 'text/csv');
......
{if $item->access}
{strip}
{foreach from=$item->access item=row name=ags}
{if $row->accesstype == 'loggedin'}
{str tag="registeredusers" section="view"}
......@@ -25,4 +26,5 @@
{if $row->secreturls}{str tag=secreturls section=view} ({$row->secreturls}){/if}
{if !$dwoo.foreach.ags.last}, {/if}
{/foreach}
{/strip}
{/if}
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