Commit bbb85f00 authored by Richard Mansfield's avatar Richard Mansfield

Use clean urls on view/artefact.php

Bug #1006634, part 3

The template can be simplified a bit by using View::display_title()
instead of generating titles and links for the view and its owner.

The owner_link function is called by display_title, and is updated
here to return clean urls.

Change-Id: Ia4653b2050be1f3b4443130165dcfcbe94a6121b
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 001f9c41
......@@ -3678,10 +3678,10 @@ class View {
public function owner_link() {
if ($this->owner) {
return get_config('wwwroot') . 'user/view.php?id=' . $this->owner;
return profile_url($this->get_owner_object());
}
else if ($this->group) {
return get_config('wwwroot') . 'group/view.php?id=' . $this->group;
return group_homepage_url($this->get_group_object());
}
return null;
}
......
......@@ -3,8 +3,7 @@
{if $notrudeform}<div class="message delete">{$notrudeform|safe}</div>{/if}
<h2>
<a href="{$WWWROOT}view/view.php?id={$viewid}">{$viewtitle}</a>{if $ownername} {str tag=by section=view}
<a href="{$WWWROOT}{$ownerlink}">{$ownername}</a>{/if}{foreach from=$artefactpath item=a}:
{$view->display_title()|safe}{foreach from=$artefactpath item=a}:
{if $a.url}<a href="{$a.url}">{/if}{$a.title}{if $a.url}</a>{/if}{if $hasfeed}<a href="{$feedlink}"><img class="feedicon" src="{theme_url filename='images/rss.gif'}"></a>{/if}
{/foreach}
</h2>
......
......@@ -165,22 +165,13 @@ if (get_config('viewmicroheaders')) {
$smarty->assign('microheadertitle', $view->display_title(true, false));
}
$smarty->assign('view', $view);
$smarty->assign('viewid', $viewid);
$smarty->assign('viewtitle', $view->get('title'));
$smarty->assign('feedback', $feedback);
$smarty->assign('hasfeed', $hasfeed);
$smarty->assign('feedlink', $feedlink);
$viewowner = $view->get('owner');
if ($viewowner) {
$smarty->assign('ownerlink', 'user/view.php?id=' . $viewowner);
}
else if ($view->get('group')) {
$smarty->assign('ownerlink', 'group/view.php?id=' . $view->get('group'));
}
$smarty->assign('ownername', $view->formatted_owner());
if (isset($addfeedbackform)) {
$smarty->assign('enablecomments', 1);
$smarty->assign('anonfeedback', $anonfeedback);
......
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