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