Commit 5ee51442 authored by Leigh B Stoller's avatar Leigh B Stoller

Fixes to NavBar login/loguout handling.

parent 8664e568
...@@ -917,7 +917,10 @@ function LoginByModal() ...@@ -917,7 +917,10 @@ function LoginByModal()
// Clear previous error. // Clear previous error.
$("#quickvm_login_form_error").html(""); $("#quickvm_login_form_error").html("");
HideModal("#quickvm_login_modal"); HideModal("#quickvm_login_modal");
$("#loginbutton").html(uid + " logged in"); $("#loginstatus").html("<a>" + uid + " logged in</a>");
$("#loginstatus").removeClass("hidden");
$("#quickvm_actions_menu").removeClass("hidden");
$("#loginbutton").addClass("hidden");
} }
} }
var xmlthing = $.ajax({ var xmlthing = $.ajax({
...@@ -950,8 +953,9 @@ function Logout() ...@@ -950,8 +953,9 @@ function Logout()
alert("Logout failed!"); alert("Logout failed!");
} }
else { else {
// Need to stick the button back in ... $("#loginstatus").addClass("hidden");
$("#loginbutton").html(""); $("#quickvm_actions_menu").addClass("hidden");
$("#loginbutton").removeClass("hidden");
} }
} }
var xmlthing = $.ajax({ var xmlthing = $.ajax({
......
...@@ -88,11 +88,13 @@ function SPITHEADER($thinheader = 0) ...@@ -88,11 +88,13 @@ function SPITHEADER($thinheader = 0)
</div> </div>
<ul class='nav navbar-nav navbar-right'>"; <ul class='nav navbar-nav navbar-right'>";
if (!$disable_accounts) { if (!$disable_accounts) {
if ($login_user) { echo "<li id='loginstatus'>".
echo "<li><a id='loginbutton'>$login_uid logged in</a></li>\n"; ($login_user ? "<a>$login_uid logged in</a>" : "") . "</li>\n";
}
elseif (!NOLOGINS()) { if (!NOLOGINS()) {
echo "<li><a class='btn btn-primary navbar-btn' echo "<li id='loginbutton' " .
($login_user ? "class='hidden'" : "") . ">" .
" <a class='btn btn-primary navbar-btn'
id='loginbutton' id='loginbutton'
data-toggle='modal' data-toggle='modal'
href='#quickvm_login_modal' href='#quickvm_login_modal'
...@@ -104,9 +106,10 @@ function SPITHEADER($thinheader = 0) ...@@ -104,9 +106,10 @@ function SPITHEADER($thinheader = 0)
echo " </ul> echo " </ul>
<ul class='nav navbar-nav navbar-left'> <ul class='nav navbar-nav navbar-left'>
<li><a href='quickvm.php'>Home</a></li>\n"; <li><a href='quickvm.php'>Home</a></li>\n";
if (!$disable_accounts && $login_user) { if (!$disable_accounts) {
echo " <li class='dropdown'> echo " <li id='quickvm_actions_menu' class='dropdown ".
<a href='#' class='dropdown-toggle' data-toggle='dropdown'> (!$login_user ? "hidden" : "") . "'>" .
"<a href='#' class='dropdown-toggle' data-toggle='dropdown'>
Actions <b class='caret'></b></a> Actions <b class='caret'></b></a>
<ul class='dropdown-menu'> <ul class='dropdown-menu'>
<li><a href='myprofiles.php'>My Profiles</a></li> <li><a href='myprofiles.php'>My Profiles</a></li>
......
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