-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
182 lines (149 loc) · 5.52 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- The above meta tag must immediately follow the head element (no empty newlines) for IE7 to render in 'standards mode -->
<meta charset="utf-8" />
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- The title at the top of the page. -->
<title>Trialist Participant Management</title>
<!-- JSON because IE<8 -->
<script
src="https://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.min.js">
</script>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- jQuery stuff -->
<script src="js/jquery-1.9.0.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<!-- Less stuff -->
<script src="js/less-1.3.3.min.js"></script>
<!-- Bootstrap stuff -->
<link
href="https://fonts.googleapis.com/css?family=Limelight|Flamenco|Federo|Yesteryear|Josefin Sans|Spinnaker|Sansita One|Handlee|Droid Sans|Oswald:400,300,700"
media="screen" rel="stylesheet" type="text/css" />
<link href="bootstrap/css/bootstrap.min.css" media="screen"
rel="stylesheet" type="text/css" />
<link href="bootstrap/css/bootstrap-responsive.min.css" media="screen"
rel="stylesheet" type="text/css" />
<link href="bootstrap/less/dropdowns.less" rel="stylesheet/less" />
<link href="bootstrap/less/sprites.less" rel="stylesheet/less" />
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- CSS Stuff -->
<link href="css/UserSetup.css" media="screen" rel="stylesheet"
type="text/css" />
</head>
<body>
<!--
This JavaScript should be run before any of the page is rendered.
-->
<script type="text/javascript">
/**
* Retrieves a cookie's value.
*/
function getCookie(name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for(i = 0; i < ARRcookies.length; i++)
{
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
x=x.replace(/^\s+|\s+$/g,"");
if (x == name)
{
return unescape(y);
}
}
}
/**
* Redirects the user to the login page.
*/
function redirectToLogin() {
<!--
$.cookie('trialist_redirect', '/trialist', {path: '/'});
document.location = "/web";
//-->
}
/**
* Retrieves the authentication token cookie or redirects the user to
* the login page.
*
* @return The user's authentication token or null if no authentication
* token exists.
*/
function getAuthToken() {
// Attempt to retrieve the authentication token.
var authToken = getCookie("auth_token");
// If the token is missing, redirect the user back to the login
// page.
if(
(authToken === null) ||
(typeof authToken === "undefined") ||
(authToken === ""))
{
// Set the authentication token to null;
authToken = null;
// Send the user to the login page.
redirectToLogin();
}
// Check to see if it is a valid auth token
var failure = function() {
redirectToLogin();
}
var success = function(data) {
if (data['result'] === "failure") {
redirectToLogin();
}
}
var parameters = {
"client" : "TrialistWeb"
};
$.post("/app/user/whoami", parameters, success)
.fail(failure);
// Return whatever we have as the authentication token.
return authToken;
}
// Check for the authentication token before loading the page. If it
// doesn't exist, we will be redirected to the homepage before any of
// the UI elements are rendered.
getAuthToken();
</script>
<script type="text/javascript">
// Expire the redirect cookie once a successful login occurs.
// This cannot happen in the above script tag because the browser
// can continue executing that JavaScript after the redirect to "/"
// has occurred.
$.cookie('trialist_redirect', '/trialist', { path: '/', expires: new Date() });
</script>
<div class="container">
<div class="container-fluid">
<div class="row-fluid">
<div class="span7">
<h2>Trialist Participant Management</h2>
</div>
<div class="pull-right">
<img src="images/omh_logo-white.png"
style="height: 91px; width: 225px;" alt="Open mHealth Logo" />
</div>
</div>
</div>
<div class="row-fluid light-grey" style="padding-top: 30px; padding-bottom: 30px;">
<div class="span4" style="padding-left: 5px;">
<h3>
<a href="results.html" style="color: white;">To
Participant Results</a>
</h3>
</div>
<div class="span5"></div>
<div class="span3 text-right" style="padding-right: 5px;">
<h3>
<a href="setup.html" style="color: white;">To Participant Setup </a>
</h3>
</div>
</div>
</div>
</body>
</html>