Fix nav template and add missing strings

This commit is contained in:
Fabio Comuni 2011-07-29 16:23:47 +02:00
parent 23d6339a41
commit d12e2cbfe9
2 changed files with 34 additions and 9 deletions

View file

@ -37,8 +37,26 @@ function nav(&$a) {
* Display login or logout
*/
$nav['usermenu']=array();
$userinfo = null;
if(local_user()) {
$nav['logout'] = Array('logout',t('Logout'), "", t('End this session'));
// user menu
$nav['usermenu'][] = Array('profile/' . $a->user['nickname'], t('Status'), "", t('Your posts and conversations'));
$nav['usermenu'][] = Array('profile/' . $a->user['nickname']. '?tab=profile', t('Profile'), "", t('Your profile page'));
$nav['usermenu'][] = Array('photos/' . $a->user['nickname'], t('Photos'), "", t('Your photos'));
$nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
$nav['usermenu'][] = Array('notes/', t('Personal notes'), "", t('Your personal photos'));
// user info
$r = q("SELECT micro FROM contact WHERE uid=%d AND self=1", intval($a->user['uid']));
$userinfo = array(
'icon' => (count($r) ? $r[0]['micro']: $a->get_baseurl()."/images/default-profile-mm.jpg"),
'name' => $a->user['username'],
);
}
else {
$nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
@ -137,6 +155,8 @@ function nav(&$a) {
'$sitelocation' => $sitelocation,
'$nav' => $nav,
'$banner' => $banner,
'$emptynotifications' => t('Nothing new here'),
'$userinfo' => $userinfo,
));
call_hooks('page_header', $a->page['nav']);

View file

@ -2,17 +2,22 @@
{# $langselector #}
<div id="site-location">$sitelocation</div>
<div id="banner">$banner</div>
</header>
<nav>
<ul>
<li id="nav-user-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-user-menu" title="$sitelocation"><img src="http://localhost/~fabio/friendika/photo/52728a08b979618a787e43664bfbae98-6.jpg" alt="User"></a>
<ul id="nav-user-menu" class="menu-popup">
<li><a href="profile">Profile</a></li>
<li><a href="photos">Photos</a></li>
{{ if $nav.notifications }}<li><a class="$nav.notifications.2" href="$nav.notifications.0" title="$nav.notifications.3" >$nav.notifications.1</a></li>{{ endif }}
{{ if $nav.messages }}<li><a class="$nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" >$nav.messages.1</a></li>{{ endif }}
</ul>
</li>
{{ if $userinfo }}
<li id="nav-user-linkmenu" class="nav-menu-icon"><a href="#" rel="#nav-user-menu" title="$sitelocation"><img src="$userinfo.icon" alt="$userinfo.name"></a>
<ul id="nav-user-menu" class="menu-popup">
{{ for $nav.usermenu as $usermenu }}
<li><a class="$usermenu.2" href="$usermenu.0" title="$usermenu.3">$usermenu.1</a></li>
{{ endfor }}
{{ if $nav.notifications }}<li><a class="$nav.notifications.2" href="$nav.notifications.0" title="$nav.notifications.3" >$nav.notifications.1</a></li>{{ endif }}
{{ if $nav.messages }}<li><a class="$nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" >$nav.messages.1</a></li>{{ endif }}
</ul>
</li>
{{ endif }}
{{ if $nav.community }}
<li id="nav-community-link" class="nav-menu">
@ -37,7 +42,7 @@
<li id="nav-notifications-linkmenu" class="nav-menu-icon"><a href="$nav.notifications.0" rel="#nav-notifications-menu" title="$nav.notifications.1"><span class="icon s22 notify">$nav.notifications.1</span></a>
<span id="notify-update" class="nav-notify"></span>
<ul id="nav-notifications-menu" class="menu-popup">
<li class="empty">Nothing new here</li>
<li class="empty">$emptynotifications</li>
</ul>
</li>
{{ endif }}