Skip to content

Commit

Permalink
New js login form works
Browse files Browse the repository at this point in the history
  • Loading branch information
greghaynes committed Mar 25, 2010
1 parent 6a50eac commit d0b06ee
Show file tree
Hide file tree
Showing 18 changed files with 509 additions and 36 deletions.
12 changes: 2 additions & 10 deletions http/admin.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<html>

<head>
<link rel="stylesheet" href="css/jquery-ui.css" type="text/css" />
<link rel="stylesheet" href="css/main.css" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="text/javascript" src="js/xsbs.js"></script>
<script type="text/javascript">
var hostname = 'localhost:8081';
Expand All @@ -16,16 +18,6 @@

<body onload="start()">
<div id="content">
<h2>XSBS Admin Panel</h2>
<div id="topnav">
<ul id="topnav_list">
<li><a href="#" id="topnav_players">Players</a></li>
<li><a href="#" id="topnav_server">Server</a></li>
<li><a href="#" id="topnav_logout">Logout</a></li>
</ul>
</div>
<div id="main_content">
</div>
</div>
<div id="alerts"></div>
</body>
Expand Down
Binary file added http/css/images/ui-bg_flat_0_aaaaaa_40x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-bg_glass_95_fef1ec_1x400.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-bg_inset-soft_15_121212_1x100.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_666666_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_aaaaaa_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_bbbbbb_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_c98000_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_cccccc_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_cd0a0a_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added http/css/images/ui-icons_f29a00_256x240.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
480 changes: 480 additions & 0 deletions http/css/jquery-ui.css

Large diffs are not rendered by default.

53 changes: 27 additions & 26 deletions http/js/xsbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,35 +83,36 @@ function enableTopNav(hostname, username, password)
$('#topnav_logout').click(function() { window.location.reload(); });
}

function loadLoginPage(hostname, callback) {
html_page = '<h3>Please login</h3>Username: <input type=\"text\" id=\"username_input\" /><br />Password: <input type=\"password\" id=\"password_input\" /><br /><input type=\"submit\" value=\"Login\" id=\"login_submit\" /><br /><span id=\"login_status\"></span>';
displayAlert(html_page);
$('#login_submit').click(function() {
$('#login_status').empty();
$('#login_status').html('Trying login...');
var username = $('#username_input').val();
var password = $('#password_input').val();
tryLogin(hostname, username, password, function(data) {
error_code = data.error
$('#login_status').empty();
if(error_code == 'INVALID_LOGIN')
$('#login_status').html('Invalid login.');
else
$('#login_status').html('Unknown error.');
},
function(data) {
$('#login_status').empty();
$('#login_status').html('Success.');
callback(username, password);
});
function loginDialog(hostname, callback) {
$("<div id=\"dialog\" title=\"Please login\">Username:<input type=\"text\" id=\"username_input\" /><br />Password: <input type=\"password\" id=\"password\" /><br /><span id=\"login_status\"></span></div>").dialog(
{
modal: true,
buttons: {
"Login": function() {
$('#login_status').empty();
$('#login_status').html('Trying login...');
var username = $('#username_input').val();
var password = $('#password_input').val();
tryLogin(hostname, username, password,
function(data) {
error_code = data.error
$('#login_status').empty();
if(error_code == 'INVALID_LOGIN')
$('#login_status').html('Invalid login.');
else
$('#login_status').html('Unknown error.');
},
function(data) {
$('#login_status').empty();
$('#login_status').html('Success.');
callback(username, password);
});
}
}
});
}

function setup(hostname) {
loadLoginPage(hostname, function(username, password) {
clearAlert();
enableTopNav(hostname, username, password);
loadPlayerAdminPage(hostname, username, password);
});
loginDialog('localhost:8081', function(username, password) { })
}

0 comments on commit d0b06ee

Please sign in to comment.