magic auth indicator (link is dead at the moment)

This commit is contained in:
friendica 2012-11-08 18:44:33 -08:00
parent c1b931549c
commit f66a3d26be
2 changed files with 28 additions and 15 deletions

View File

@ -36,8 +36,6 @@ EOT;
* Placeholder div for popup panel * Placeholder div for popup panel
*/ */
$a->page['nav'] .= '<div id="panel" style="display: none;"></div>' ;
/** /**
* *
* Our network is distributed, and as you visit friends some of the * Our network is distributed, and as you visit friends some of the
@ -46,14 +44,17 @@ EOT;
* *
*/ */
if(local_user()) {
$channel = $a->get_channel(); $channel = $a->get_channel();
$xchan = q("select * from xchan where xchan_hash = '%s' limit 1", $observer = $a->get_observer();
dbesc($channel['channel_hash']) }
); elseif(remote_user())
$observer = $a->get_observer();
$myident = ((is_array($channel) && isset($channel['channel_address'])) ? $channel['channel_address'] . '@' : '');
$sitelocation = $myident . substr($a->get_baseurl($ssl_state),strpos($a->get_baseurl($ssl_state),'//') + 2 ); $myident = (($channel) ? $channel['xchan_address'] : '');
$sitelocation = (($myident) ? $myident : $a->get_hostname());
// nav links: array of array('href', 'text', 'extra css classes', 'title') // nav links: array of array('href', 'text', 'extra css classes', 'title')
@ -76,16 +77,20 @@ EOT;
$nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos')); $nav['usermenu'][] = Array('photos/' . $channel['channel_address'], t('Photos'), "", t('Your photos'));
$nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events')); $nav['usermenu'][] = Array('events/', t('Events'), "", t('Your events'));
$userinfo = array(
'icon' => $xchan[0]['xchan_photo_s'],
'name' => $channel['channel_name'],
);
} }
else { else {
$nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in')); $nav['login'] = Array('login',t('Login'), ($a->module == 'login'?'selected':''), t('Sign in'));
} }
if($observer) {
$userinfo = array(
'icon' => $observer['xchan_photo_s'],
'name' => $observer['xchan_addr'],
);
}
$nav['lock'] = array('rmagic','',(($observer) ? 'lock' : 'unlock'), (($observer) ? $observer['xchan_addr'] : t('Click to authenticate to your home hub')));
/** /**
* "Home" should also take you home from an authenticated remote profile connection * "Home" should also take you home from an authenticated remote profile connection
@ -188,6 +193,7 @@ EOT;
'$banner' => $banner, '$banner' => $banner,
'$emptynotifications' => t('Nothing new here'), '$emptynotifications' => t('Nothing new here'),
'$userinfo' => $userinfo, '$userinfo' => $userinfo,
'$localuser' => local_user(),
'$sel' => $a->nav_sel, '$sel' => $a->nav_sel,
'$apps' => $a->get_apps(), '$apps' => $a->get_apps(),
)); ));

View File

@ -1,13 +1,18 @@
<header> <header>
{# $langselector #}
<div id="site-location">$sitelocation</div> <div id="site-location">$sitelocation</div>
<div id="banner">$banner</div> <div id="banner">$banner</div>
</header> </header>
<nav> <nav>
<ul> <ul>
{{ if $nav.lock }}
<li id="nav-rmagic-link" class="nav-menu-icon" >
<a class="icon $nav.lock.2" href="$nav.lock.0" title="$nav.lock.3" >$nav.lock.1</a>
</li>
{{ endif }}
{{ if $userinfo }} {{ 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> <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>
{{ if $localuser }}
<ul id="nav-user-menu" class="menu-popup"> <ul id="nav-user-menu" class="menu-popup">
{{ for $nav.usermenu as $usermenu }} {{ for $nav.usermenu as $usermenu }}
<li><a class="$usermenu.2" href="$usermenu.0" title="$usermenu.3">$usermenu.1</a></li> <li><a class="$usermenu.2" href="$usermenu.0" title="$usermenu.3">$usermenu.1</a></li>
@ -17,6 +22,7 @@
{{ if $nav.messages }}<li><a class="$nav.messages.2" href="$nav.messages.0" title="$nav.messages.3" >$nav.messages.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 }}
{{ if $nav.contacts }}<li><a class="$nav.contacts.2" href="$nav.contacts.0" title="$nav.contacts.3" >$nav.contacts.1</a></li>{{ endif }} {{ if $nav.contacts }}<li><a class="$nav.contacts.2" href="$nav.contacts.0" title="$nav.contacts.3" >$nav.contacts.1</a></li>{{ endif }}
</ul> </ul>
{{ endif }}
</li> </li>
{{ endif }} {{ endif }}
@ -100,3 +106,4 @@
</ul> </ul>
<div style="position: fixed; top: 3px; left: 5px; z-index:9999">$langselector</div> <div style="position: fixed; top: 3px; left: 5px; z-index:9999">$langselector</div>
<div id="panel" style="display: none;"></div>