Whoami link

The 'logged in as' message in the header into an active hypoerlink that loads the details page for the current user.
Also fixed a bug where, when reloading, the search page would fail due to scl being undefined.

Fixed a typo
replaced                {'user-facet':'details', 'pkey':whoami_pkey},2);
with                    {'user-facet':'details', 'user-pkey':whoami_pkey},2);
This commit is contained in:
Adam Young
2010-09-24 10:47:40 -04:00
parent 346615d4a0
commit 65b455edf9
4 changed files with 14 additions and 4 deletions

View File

@@ -40,7 +40,7 @@
<img src="ipalogo.png" /> <img src="ipalogo.png" />
</span> </span>
<span id="loggedinas" class="header-loggedinas"> <span id="loggedinas" class="header-loggedinas">
<a>Logged in as <strong>hardcoded@FREEIP.ORG</strong></a> <a href="#">Logged in as <strong>hardcoded@FREEIP.ORG</strong></a>
</span> </span>
</div> </div>

View File

@@ -14,7 +14,6 @@ body{ font: 62.5% "Trebuchet MS", sans-serif; margin: 50px;}
.input_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;} .input_link span.ui-icon {margin: 0 5px 0 0;position: absolute;left: .2em;top: 50%;margin-top: -8px;}
a { a {
text-decoration: none; text-decoration: none;
border: 0; border: 0;
@@ -39,10 +38,12 @@ div.header a {
div.header a:link { div.header a:link {
text-decoration: none; text-decoration: none;
color: white;
} }
div.header a:visited { div.header a:visited {
text-decoration: none; text-decoration: none;
color: white;
} }
div.header div.header-logo { div.header div.header-logo {

View File

@@ -23,6 +23,10 @@
function search_create(obj_name, scl, container) function search_create(obj_name, scl, container)
{ {
if (!scl){
scl = [];
}
function find_on_click() { function find_on_click() {
var filter = $(this).prev('input[type=text]').val(); var filter = $(this).prev('input[type=text]').val();
var state = {}; var state = {};

View File

@@ -37,7 +37,7 @@ var admin_tabs_lists = [
]; ];
var self_serv_tabs_lists = var self_serv_tabs_lists =
[ [
['identity', 'IDENTITY', [ ['identity', 'IDENTITY', [
['user', 'Users', ipa_entity_setup]]]]; ['user', 'Users', ipa_entity_setup]]]];
@@ -47,11 +47,16 @@ var nav_tabs_lists;
/* main (document onready event handler) */ /* main (document onready event handler) */
$(function() { $(function() {
var whoami_pkey;
function whoami_on_win(data, text_status, xhr) { function whoami_on_win(data, text_status, xhr) {
$(window).bind('hashchange', window_hashchange); $(window).bind('hashchange', window_hashchange);
if (!data.error){ if (!data.error){
var whoami = data.result.result[0]; var whoami = data.result.result[0];
whoami_pkey=whoami.uid[0];
$('#loggedinas').find('strong').text(whoami.krbprincipalname[0]); $('#loggedinas').find('strong').text(whoami.krbprincipalname[0]);
$('#loggedinas a').fragment(
{'user-facet':'details', 'user-pkey':whoami_pkey},2);
if (whoami.hasOwnProperty('memberof_rolegroup') && if (whoami.hasOwnProperty('memberof_rolegroup') &&
whoami.memberof_rolegroup.length > 0){ whoami.memberof_rolegroup.length > 0){
nav_tabs_lists = admin_tabs_lists; nav_tabs_lists = admin_tabs_lists;
@@ -59,7 +64,7 @@ $(function() {
}else{ }else{
nav_tabs_lists = self_serv_tabs_lists; nav_tabs_lists = self_serv_tabs_lists;
var state = {'user-pkey': whoami.uid[0], var state = {'user-pkey':whoami_pkey ,
'user-facet': jQuery.bbq.getState('user-facet') || 'user-facet': jQuery.bbq.getState('user-facet') ||
'details'}; 'details'};
$.bbq.pushState(state); $.bbq.pushState(state);