Update service portal with new theme

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10609 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-09-22 18:29:44 +00:00
parent 85fced5f67
commit 3c32fd1eaa
3 changed files with 67 additions and 36 deletions

View File

@ -11,6 +11,44 @@ var gangliaTimer;
* Initialize service page
*/
function initServicePage() {
// Load theme
var theme = $.cookie('xcat_theme');
if (theme) {
switch (theme) {
case 'cupertino':
includeCss("css/themes/jquery-ui-cupertino.css");
break;
case 'dark_hive':
includeCss("css/themes/jquery-ui-dark_hive.css");
break;
case 'redmond':
includeCss("css/themes/jquery-ui-redmond.css");
break;
case 'start':
includeCss("css/themes/jquery-ui-start.css");
break;
case 'sunny':
includeCss("css/themes/jquery-ui-sunny.css");
break;
case 'ui_dark':
includeCss("css/themes/jquery-ui-ui_darkness.css");
break;
default:
includeCss("css/themes/jquery-ui-start.css");
}
} else {
includeCss("css/themes/jquery-ui-start.css");
}
// Load jQuery stylesheets
includeCss("css/query.dataTables.css");
includeCss("css/superfish.css");
includeCss("css/jstree.css");
includeCss("css/jquery.jqplot.css");
// Load custom stylesheet
includeCss("css/service.css");
// Reuqired JQuery plugins
includeJs("js/jquery/jquery.dataTables.min.js");
includeJs("js/jquery/jquery.cookie.min.js");

View File

@ -6,7 +6,7 @@ $(document).ready(function() {
$('#content').remove();
var winHeight = document.body.clientHeight;
var diagHeight = $('#logdialog').css('height');
var diagHeight = $('#login').css('height');
diagHeight = diagHeight.substr(0, diagHeight.length - 2);
diagHeight = Number(diagHeight);
@ -18,31 +18,31 @@ $(document).ready(function() {
tmpHeight = parseInt((winHeight - diagHeight - 50) / 2);
}
$('#logdialog').css('margin', tmpHeight + 'px auto');
$('#login').css('margin', tmpHeight + 'px auto');
$('button').bind('click', function(){
authenticate();
}).button();
if (document.location.protocol == 'http:') {
$('#logstatus').html('You are using an unencrypted session!');
$('#logstatus').css('color', 'red');
$('#login_status').html('You are using an unencrypted session!');
$('#login_status').css('color', 'red');
}
if (!$('#username').val()) {
$('#username').focus();
if (!$("#login input[name='username']").val()) {
$("#login input[name='username']").focus();
} else {
$('#password').focus();
$("#login input[name='password']").focus();
}
// When enter is hit while in username, advance to password
$('#username').keydown(function(event) {
$("#login input[name='username']").keydown(function(event) {
if (event.keyCode == 13) {
$('#password').focus();
$("#login input[name='password']").focus();
}
});
// Submit authentication if enter is pressed in password field
$('#password').keydown(function(event) {
$("#login input[name='password']").keydown(function(event) {
if (event.keyCode == 13) {
authenticate();
}
@ -59,10 +59,10 @@ $(document).ready(function() {
*/
function onlogin(data, txtStatus) {
// Clear password field regardless of what happens
var usrName = $('#username').val();
$('#password').val('');
var usrName = $("#login input[name='username']").val();
$("#login input[name='password']").val('');
if (data.authenticated == 'yes') {
$('#logstatus').text('Login successful');
$('#login_status').text('Login successful');
window.location = 'service.php';
// Set user name cookie
@ -70,8 +70,8 @@ function onlogin(data, txtStatus) {
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
$.cookie('srv_usrname', usrName, { expires: exDate });
} else {
$('#logstatus').text('Authentication failure');
$('#logstatus').css('color', '#FF0000');
$('#login_status').text('Authentication failure');
$('#login_status').css('color', '#FF0000');
}
}
@ -79,12 +79,12 @@ function onlogin(data, txtStatus) {
* Authenticate user for new session
*/
function authenticate() {
$('#logstatus').css('color', '#000000');
$('#logstatus').html('Authenticating...');
$('#login_status').css('color', '#000000');
$('#login_status').html('Authenticating...');
var passwd = $('#password').val();
var passwd = $("#login input[name='password']").val();
$.post('lib/srv_log.php', {
username : $('#username').val(),
username : $("#login input[name='username']").val(),
password : passwd
}, onlogin, 'json');
}

View File

@ -10,21 +10,15 @@ require_once "lib/jsonwrapper.php";
* Load service page
*/
// Include CSS and Javascripts
// TODO Rebuild xCAT-UI-deps where version numbers are removed from:
// jquery-ui-default.css, jquery.min.js, jquery-ui.min.js
echo
'<html>
<head>
<title>xCAT Service Portal</title>
<link rel="shortcut icon" href="images/favicon.ico">
<link href="css/jquery-ui-default.css" rel=stylesheet type="text/css">
<link href="css/jquery.dataTables.css" rel=stylesheet type="text/css">
<link href="css/jquery.jqplot.css" rel=stylesheet type="text/css">
<link href="css/superfish.css" rel=stylesheet type="text/css">
<link href="css/service.css" rel=stylesheet type="text/css">
<link href="css/login.css" rel=stylesheet type="text/css">
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
<script type="text/javascript" src="js/ui.js"></script>
<script type="text/javascript" src="js/service/service.js"></script>
</head>';
@ -59,18 +53,17 @@ echo
if (!isAuthenticated()) {
// xcatauth.js will open a dialog box asking for the user name and password
echo
'<script src="js/jquery/jquery.cookie.min.js" type="text/javascript"></script>
<script src="js/srv_xcatauth.js" type="text/javascript"></script>
<div id="logdialog">
<div id="loginput" class="ui-corner-all">
'<script src="js/srv_xcatauth.js" type="text/javascript"></script>
<div id="login">
<div id="login_form">
<table>
<tr><td colspan=5></td></tr>
<tr><td align=right><img src="images/logo.png" width="50" height="30"></img></td><td colspan=4><p>eXtreme Cloud Administration Toolkit</p></td></tr>
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
<tr><td colspan=5></td></tr>
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input id=username type=text name=username></td><td></td></tr>
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input id=password type=password name=password></td><td></td></tr>
<tr><td></td><td></td><td></td><td align=right><button>Login</button></td><td></td></tr>
<tr><td></td><td colspan=5><span id=logstatus></span></td></tr>
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
<tr><td></td><td colspan=4><span id=login_status></span></td></tr>
</table>
</div>
<div id="loginfo">Open Source. EPL License.</div>