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

More fixes to view microheader links


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 75434fad
......@@ -110,6 +110,7 @@ $string['emailingfailed'] = 'Profile saved, but emails were not sent to: %s';
$string['loseyourchanges'] = 'Lose your changes?';
$string['editprofile'] = 'Edit Profile';
$string['editmyprofile'] = 'Edit My Profile';
$string['Title'] = 'Title';
$string['Created'] = 'Created';
......
......@@ -34,6 +34,7 @@ $string['createviewstepthree'] = 'Create View Step Three: Access';
$string['createtemplate'] = 'Create Template';
$string['editdetails'] = 'Edit Details';
$string['editviewdetails'] = 'Edit Details for View "%s"';
$string['editview'] = 'Edit View';
$string['editblocksforview'] = 'Edit View "%s"';
$string['editaccess'] = 'Edit Access';
$string['editaccessforview'] = 'Edit Access for View "%s"';
......
......@@ -535,6 +535,7 @@ div.rbuttons .small-logo {
/**************************** Top of page elements ****************************/
.viewheader {
text-align: center;
padding: 0 .5em 0;
margin: 0 .25em 1px;
}
......@@ -542,13 +543,11 @@ div.rbuttons .small-logo {
vertical-align: top;
padding: 0;
}
.viewheader .nav {
float: right;
.viewheader .links {
padding: 0 .5em .25em;
font-size: .9em;
}
.viewheader .links {
float: left;
.viewheader .nav {
padding: 0 .5em .25em;
font-size: .9em;
}
......
......@@ -7,10 +7,21 @@
<div id="containerX">
<div id="loading-box"></div>
<div id="top-wrapper">
<div class="viewheader">
<div class="viewheader rel">
<div class="rbuttons">
<a class="small-logo" href="{$WWWROOT}"><img src="{theme_url filename='images/site-logo-small.png'}" alt="{$sitename|escape}"></a>
</div>
<div class="links lbuttons">
{if $microheaderlinks}
{foreach from=$microheaderlinks item=item}
<a href="{$item.url}">{$item.name|escape}</a>&nbsp;
{/foreach}
{elseif $backurl}<a class="btn-reply" href="{$backurl}">{str tag=back}</a>&nbsp;
{/if}
</div>
<div class="nav">
{if $LOGGEDIN}
<a href="{$WWWROOT}user/view.php">{$userdisplayname|escape}</a>&nbsp;
<a href="{$WWWROOT}user/view.php">{$userdisplayname|escape}</a>&nbsp;:
{foreach from=$MAINNAV item=item}
{if $item.path}
<a href="{if get_config('httpswwwroot') && $item.url=='account/'}{$HTTPSWWWROOT}{else}{$WWWROOT}{/if}{$item.url|escape}">{$item.title|escape}</a>&nbsp;
......@@ -18,24 +29,7 @@
{/foreach}
{if $mnethost}<a href="{$mnethost.url}">{str tag=backto arg1=$mnethost.name}</a>&nbsp;{/if}
{/if}
<a class="small-logo" href="{$WWWROOT}"><img src="{theme_url filename='images/site-logo-small.png'}" alt="{$sitename|escape}"></a>
</div>
{if $LOGGEDIN}
<div class="links">
{if $backurl}<a class="btn-reply" href="{$backurl}">{str tag=back}</a>&nbsp;{/if}
{if $edit_profile || $viewtype == 'profile'}
<a href="{$WWWROOT}user/view.php">{str tag=viewmyprofilepage}</a>&nbsp;
<a class="btn-edit" href="{$WWWROOT}view/blocks.php?profile=1">{str tag=editmyprofilepage}</a>&nbsp;
<a class="btn-edit" href="{$WWWROOT}artefact/internal/index.php">{str tag=editprofile section=artefact.internal}</a>
{elseif !empty($viewtype)}
<a href="{$WWWROOT}view/index.php">{str tag=myviews}</a>&nbsp;
<a class="btn-edit" href="{$WWWROOT}view/edit.php?id={$viewid}&amp;new={$new}">{str tag=editdetails section=view}</a>
<a class="btn-edit" href="{$WWWROOT}view/access.php?id={$viewid}&amp;new={$new}">{str tag=editaccess section=view}</a>
{elseif $can_edit}
<a class="btn-edit" href="{$WWWROOT}view/blocks.php?id={$viewid}&amp;new={$new}">{str tag=edit}</a>
{/if}
</div>
{/if}
<div class="center cb title">
<strong>{$viewtitle|escape}</strong>{if $ownername && $viewtype != 'profile'} {str tag=by section=view} <a href="{$WWWROOT}{$ownerlink}">{$ownername|escape}</a>{/if}</div>
</div>
......
......@@ -309,9 +309,19 @@ $smarty->assign('USERID', $userid);
$smarty->assign('userdisplayname', display_name($USER, null, true));
$smarty->assign('viewid', $view->get('id'));
$smarty->assign('viewtitle', get_string('usersprofile', 'mahara', display_name($user, null, true)));
$smarty->assign('viewtype', 'profile');
if ($loggedinid && $loggedinid == $userid) {
$smarty->assign('can_edit', true);
$smarty->assign('edit_profile', true);
$microheaderlinks = array(
array(
'name' => get_string('editmyprofilepage'),
'url' => get_config('wwwroot') . 'view/blocks.php?profile=1',
),
array(
'name' => get_string('editmyprofile', 'artefact.internal'),
'url' => get_config('wwwroot') . 'artefact/internal/index.php',
),
);
$smarty->assign('microheaderlinks', $microheaderlinks);
}
if (isset($_SERVER['HTTP_REFERER'])) {
$smarty->assign('backurl', $_SERVER['HTTP_REFERER']);
......
......@@ -136,7 +136,7 @@ foreach (array_reverse($THEME->get_url('style/style.css', true, 'artefact/file')
// Tell the user to change the view theme if the current one is no
// longer available to them.
if (!isset($allowedthemes[$viewtheme])) {
if ($viewtheme && !isset($allowedthemes[$viewtheme])) {
$smarty = smarty(array(), $stylesheets, false, $extraconfig);
$smarty->assign('PAGEHEADING', hsc(TITLE));
$smarty->assign('formurl', get_config('wwwroot') . 'view/blocks.php');
......@@ -182,7 +182,40 @@ $smarty->assign('formurl', get_config('wwwroot') . 'view/blocks.php');
$smarty->assign('category', $category);
$smarty->assign('new', $new);
$smarty->assign('profile', $profile);
$smarty->assign('viewtype', $view->get('type'));
$viewid = $view->get('id');
$viewtype = $view->get('type');
$viewtitle = $view->get('title');
$owner = $view->get('owner');
if ($owner) {
if ($viewtype == 'profile') {
$microheaderlinks = array(
array(
'name' => get_string('viewmyprofilepage'),
'url' => get_config('wwwroot') . 'user/view.php',
),
array(
'name' => get_string('editmyprofile', 'artefact.internal'),
'url' => get_config('wwwroot') . 'artefact/internal/index.php',
),
);
$viewtitle = get_string('usersprofile', 'mahara', display_name($view->get('owner'), null, true));
}
else {
$microheaderlinks = array(
array(
'name' => get_string('editdetails', 'view'),
'url' => get_config('wwwroot') . 'view/edit.php?id=' . $viewid . '&amp;new=' . $new,
),
array(
'name' => get_string('editaccess', 'view'),
'url' => get_config('wwwroot') . 'view/access.php?id=' . $viewid . '&amp;new=' . $new,
),
);
}
$smarty->assign('microheaderlinks', $microheaderlinks);
}
$smarty->assign('userdisplayname', display_name($USER, null, true));
$smarty->assign('viewtype', $viewtype);
$smarty->assign('view', $view->get('id'));
$smarty->assign('groupid', $group);
$smarty->assign('institution', $institution);
......@@ -192,8 +225,7 @@ $smarty->assign('viewtheme', $viewtheme);
$smarty->assign('viewthemes', $allowedthemes);
$smarty->assign('viewid', $view->get('id'));
$smarty->assign('viewtitle', $view->get('title'));
$owner = $view->get('owner');
$smarty->assign('viewtitle', $viewtitle);
if ($owner) {
$smarty->assign('ownerlink', 'user/view.php?id=' . $owner);
}
......
......@@ -174,7 +174,8 @@ $smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->assign('new', $new);
$smarty->assign('viewid', $viewid);
$smarty->assign('viewtitle', $title);
$smarty->assign('viewtype', $view->get('type'));
$viewtype = $view->get('type');
$smarty->assign('viewtype', $viewtype);
$smarty->assign('feedback', $feedback);
$owner = $view->get('owner');
......@@ -187,7 +188,35 @@ else if ($group) {
$smarty->assign('ownerlink', 'group/view.php?id=' . $group);
}
if ($can_edit) {
$smarty->assign('can_edit', 1);
if ($viewtype == 'profile') {
$microheaderlinks = array(
array(
'name' => get_string('editmyprofilepage'),
'url' => get_config('wwwroot') . 'view/blocks.php?profile=1',
),
array(
'name' => get_string('editmyprofile', 'artefact.internal'),
'url' => get_config('wwwroot') . 'artefact/internal/index.php',
),
);
}
else {
$microheaderlinks = array(
array(
'name' => get_string('editdetails', 'view'),
'url' => get_config('wwwroot') . 'view/edit.php?id=' . $viewid . '&amp;new=' . $new,
),
array(
'name' => get_string('editview', 'view'),
'url' => get_config('wwwroot') . 'view/blocks.php?id=' . $viewid . '&amp;new=' . $new,
),
array(
'name' => get_string('editaccess', 'view'),
'url' => get_config('wwwroot') . 'view/access.php?id=' . $viewid . '&amp;new=' . $new,
),
);
}
$smarty->assign('microheaderlinks', $microheaderlinks);
}
if ($USER->is_logged_in()) {
$smarty->assign('userdisplayname', display_name($USER, null, true));
......
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