PageRenderTime 18ms CodeModel.GetById 15ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/xCAT-UI/service.php

https://gitlab.com/qisback/xcat-core
PHP | 79 lines | 58 code | 7 blank | 14 comment | 3 complexity | 84787c328effd7140c437fd77eba79b8 MD5 | raw file
 1<?php
 2/**
 3 * Main xCAT self-service page
 4 */
 5require_once "lib/srv_functions.php";
 6require_once "lib/ui.php";
 7require_once "lib/jsonwrapper.php";
 8
 9/** 
10 * Load service page
11 */
12// Include CSS and Javascripts
13echo
14'<html>
15    <head>
16        <title>xCAT Service Portal</title>
17        <link rel="shortcut icon" href="images/favicon.ico">
18        <link href="css/login.css" rel=stylesheet type="text/css">
19        <script type="text/javascript" src="js/jquery/jquery.min.js"></script>
20        <script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
21        <script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
22        <script type="text/javascript" src="js/ui.js"></script>
23        <script type="text/javascript" src="js/service/service.js"></script>
24    </head>';
25
26// Create header menu
27echo
28'<body>
29    <div id="header" class="ui-widget-header">
30        <img style="margin: 0px 20px; position: relative; float: left;" src="images/logo.gif" height="100%"/>
31        <div style="margin: 10px 20px; position: relative; float: left; color: white; font: bold 14px sans-serif;">xCAT Service Portal</div>';
32        
33// Create user name and log out section
34if (isset($_SESSION['srv_username'])){
35    echo 
36        "<div>
37            <span style='padding: 0 6px; color: white; font-weight: bold;'>{$_SESSION['srv_username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/srv_logout.php'>Log out</a>
38        </div>";
39}
40
41echo '</div>';
42
43// Create content area
44echo '<div class="content" id="content"></div>';
45
46// End of page
47echo
48    '</body>
49</html>';
50
51// Login user
52if (!isAuthenticated()) {
53    // xcatauth.js will open a dialog box asking for the user name and password
54    echo
55    '<script src="js/srv_xcatauth.js" type="text/javascript"></script>
56    <div id="login">
57        <div id="login-form">
58            <table>
59                <tr><td colspan=5></td></tr>
60                <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>
61                <tr><td colspan=5></td></tr>
62                <tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
63                <tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
64                <tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
65                <tr><td></td><td colspan=4><span id=login-status></span></td></tr>
66            </table>
67        </div>
68        <div id="log-info">Open Source. EPL License.</div>
69    </div>';
70} else {
71    // Initialize page
72    echo
73    '<script language="JavaScript" type="text/javascript"> 
74        $(document).ready(function() {
75            initServicePage();
76        }); 
77    </script>';
78}
79?>