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

Use clean urls for view owners after running view_search



Bug #1006634, part 3

The view_search() function retrieves data about the user or group who
owns each view in the result set, and this owner data is displayed in
the Group pages and Latest pages blocks, and Shared pages.  When the
urlid column is also pulled from the db, user and group urls can be
generated using the new functions.

Change-Id: I4a018d8deba4a38ab8999161ad3feefd7edc36b0
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 0d28fabc
......@@ -32,9 +32,9 @@
{if $view.sharedby}
<span class="owner">{str tag=by section=view}
{if $view.group}
<a href="{$WWWROOT}group/view.php?id={$view.group}">{$view.sharedby}</a>
<a href="{group_homepage_url($view.groupdata)}">{$view.sharedby}</a>
{elseif $view.owner}
<a href="{$WWWROOT}user/view.php?id={$view.owner}">{$view.sharedby}</a>
<a href="{profile_url($view.user)}">{$view.sharedby}</a>
{else}
{$view.sharedby}
{/if}
......
......@@ -7,9 +7,9 @@
{if $view.sharedby}
<td class="right">
{if $view.group && $loggedin}
<a href="{$WWWROOT}group/view.php?id={$view.group}" class="s">{$view.sharedby}</a>
<a href="{group_homepage_url($view.groupdata)}" class="s">{$view.sharedby}</a>
{elseif $view.owner && $loggedin}
<a href="{$WWWROOT}user/view.php?id={$view.owner}" class="s">{$view.sharedby}</a>
<a href="{profile_url($view.user)}" class="s">{$view.sharedby}</a>
{else}
{$view.sharedby}
{/if}
......
......@@ -3424,10 +3424,10 @@ class View {
}
if (!empty($owners)) {
$owners = get_records_select_assoc('usr', 'id IN (' . join(',', $owners) . ')', null, '',
'id,username,firstname,lastname,preferredname,admin,staff,studentid,email,profileicon');
'id,username,firstname,lastname,preferredname,admin,staff,studentid,email,profileicon,urlid');
}
if (!empty($groups)) {
$groups = get_records_select_assoc('group', 'id IN (' . join(',', $groups) . ')', null, '', 'id,name');
$groups = get_records_select_assoc('group', 'id IN (' . join(',', $groups) . ')', null, '', 'id,name,urlid');
}
if (!empty($institutions)) {
$institutions = get_records_assoc('institution', '', '', '', 'name,displayname');
......@@ -3439,6 +3439,7 @@ class View {
$v->user = $owners[$v->owner];
} else if ($v->group) {
$v->sharedby = $groups[$v->group]->name;
$v->groupdata = $groups[$v->group];
} else if ($v->institution) {
$v->sharedby = $institutions[$v->institution]->displayname;
}
......
......@@ -5,9 +5,9 @@
{if $view.sharedby}
<span class="owner">
{if $view.group}
<a href="{$WWWROOT}group/view.php?id={$view.group}">{$view.sharedby}</a>
<a href="{group_homepage_url($view.groupdata)}">{$view.sharedby}</a>
{elseif $view.owner}
<a href="{$WWWROOT}user/view.php?id={$view.owner}">{$view.sharedby}</a>
<a href="{profile_url($view.user)}">{$view.sharedby}</a>
{else}
{$view.sharedby}
{/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