-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
378 lines (314 loc) · 12.3 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
background-color: #326696;
margin: 0px;
overflow: hidden;
font-family:Monospace;
font-size:13px;
text-align:center;
font-weight: bold;
text-align:center;
}
a {
color:#0078ff;
}
</style>
<link href="css/bootstrap.css" rel="stylesheet" media="screen">
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery-1.9.1.min.js"></script>
<!-- bootbox code -->
<script src="js/bootbox.min.js"></script>
<link href="theme.css" rel="stylesheet" media="screen">
</head>
<body onload="requestTimers()">
<script>
// Called by MDM to disable user input
function mdm_disable() {
$('#entry').prop("disabled", true);
$('#ok_button').prop("disabled", true);
$('#login-box').css('cursor', 'progress');
$('#entry').css('cursor', 'progress');
$('#ok_button').css('cursor', 'progress');
}
// Called by MDM to enable user input
function mdm_enable() {
$('#entry').prop("disabled", false);
$('#ok_button').prop("disabled", false);
$('#login-box').css('cursor', 'default');
$('#entry').css('cursor', 'text');
$('#ok_button').css('cursor', 'default');
}
// Called by MDM to allow the user to input a username
function mdm_prompt(message) {
mdm_enable();
//document.getElementById("welcome_message").innerHTML = message;
document.getElementById("label").innerHTML = message;
document.getElementById("entry").value = "";
document.getElementById("entry").type = "text";
document.getElementById("entry").placeholder = "Usuário";
document.getElementById("entry").focus();
}
// Called by MDM to allow the user to input a password
function mdm_noecho(message) {
mdm_enable();
//document.getElementById("welcome_message").innerHTML = message;
document.getElementById("entry").value = "";
document.getElementById("entry").type = "password";
document.getElementById("entry").placeholder = "Senha";
document.getElementById("entry").focus();
}
// Called by MDM to show a message (usually "Please enter your username")
function mdm_msg(message) {
//document.getElementById("message").innerHTML = message;
}
// Called by MDM to show a timed login countdown
function mdm_timed(message) {
if (message != "") {
document.getElementById("timed").style.display = 'block';
}
else {
document.getElementById("timed").style.display = 'none';
}
document.getElementById("timed").innerHTML = message;
}
// Called by MDM to show an error
function mdm_error(message) {
if (message != "") {
document.getElementById("error").style.display = 'block';
}
else {
document.getElementById("error").style.display = 'none';
}
document.getElementById("error").innerHTML = message;
}
// Send user input to MDM
function send_login() {
// read the value before we disable the field, as it will be changed to "disabled"
var value = document.getElementById("entry").value;
mdm_disable();
if (document.getElementById("entry").type == "password"){
//Depois que a senha é digitada, caso esteja errada, isso é necessário para que se possa logar novamente com outro usuário
document.getElementById("entry").value = "";
document.getElementById("entry").type = "text";
document.getElementById("entry").placeholder = "Usuário";
}
alert("LOGIN###" + value);
return false;
}
function init() {
document.getElementById("error").style.display = 'none';
document.getElementById("timed").style.display = 'none';
document.getElementById("current_session_picture").width = 16;
}
// Called by MDM to add a session to the list of sessions
function mdm_add_session(session_name, session_file) {
session_name = session_name.replace("Ubuntu", "Unity");
var filename = session_name.toLowerCase();
filename = filename.replace(/ /g, "-");
filename = filename.replace(/\(/g, "");
filename = filename.replace(/\)/g, "");
var link1 = document.createElement('a');
link1.setAttribute('href', "javascript:alert('SESSION###"+session_name+"###"+session_file+"');select_session('"+session_name+"','"+session_file+"');");
var link2 = document.createElement('a');
link2.setAttribute('href', "javascript:alert('SESSION###"+session_name+"###"+session_file+"');select_session('"+session_name+"','"+session_file+"');");
var picture = document.createElement('img');
picture.setAttribute('class', "session-picture");
picture.setAttribute('src', "../common/img/sessions/"+filename+".svg");
picture.setAttribute('onerror', "this.src='../common/img/sessions/default.svg';");
var name_div = document.createTextNode(session_name);
link1.appendChild(picture);
link2.appendChild(name_div);
var table = document.getElementById("sessions");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
cell1.width = "28px";
cell1.appendChild(link1);
var cell2 = row.insertCell(1);
cell2.appendChild(link2);
}
function select_session(session_name, session_file) {
var filename = session_name.toLowerCase();
filename = filename.replace(/ /g, "-");
filename = filename.replace(/\(/g, "");
filename = filename.replace(/\)/g, "");
document.getElementById("current_session_picture").src = "../common/img/sessions/"+filename+".svg";
document.getElementById("current_session_picture").title = session_name;
document.getElementById("current_session_picture").width = 16;
$('#current_session_picture').popover('hide');
}
// Called by MDM to add a language to the list of languages
function mdm_add_language(language_name, language_code) {
var filename = language_code.toLowerCase();
filename = filename.replace(".utf-8", "");
bits = filename.split("_");
if (bits.length == 2) {
filename = bits[1];
}
var link1 = document.createElement('a');
link1.setAttribute('href', "javascript:alert('LANGUAGE###"+language_code+"')");
var link2 = document.createElement('a');
link2.setAttribute('href', "javascript:alert('LANGUAGE###"+language_code+"')");
var picture = document.createElement('img');
picture.setAttribute('class', "language-picture");
picture.setAttribute('src', "../common/img/languages/"+filename+".png");
picture.setAttribute('onerror', "this.src='../common/img/languages/generic.png';");
picture.setAttribute('title', language_name);
var name_div = document.createTextNode(language_name);
link1.appendChild(picture);
link2.appendChild(name_div);
var table = document.getElementById("languages");
var rowCount = table.rows.length;
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
cell1.width = "25px";
cell1.appendChild(link1);
var cell2 = row.insertCell(1);
cell2.appendChild(link2);
}
function mdm_set_current_language(language_name, language_code) {
var filename = language_code.toLowerCase();
filename = filename.replace(".utf-8", "");
bits = filename.split("_");
if (bits.length == 2) {
filename = bits[1];
}
document.getElementById("current_language_flag").src = "img/language.svg";
document.getElementById("current_language_flag").title = language_name;
document.getElementById("current_language_flag").width = 16;
}
// Called by MDM if the SHUTDOWN command shouldn't appear in the greeter
function mdm_hide_shutdown() {
document.getElementById("shutdown").style.display = 'none';
}
// Called by MDM if the SUSPEND command shouldn't appear in the greeter
function mdm_hide_suspend() {
document.getElementById("suspend").style.display = 'none';
}
// Called by MDM if the RESTART command shouldn't appear in the greeter
function mdm_hide_restart() {
document.getElementById("restart").style.display = 'none';
}
// Called by MDM if the QUIT command shouldn't appear in the greeter
function mdm_hide_quit() {
document.getElementById("quit").style.display = 'none';
}
// Called by MDM if the XDMCP command shouldn't appear in the greeter
function mdm_hide_xdmcp() {
document.getElementById("xdmcp").style.display = 'none';
}
function quit_dialog() {
bootbox.dialog("<font>$areyousuretoquit</font>",
[
{
"label" : "<button type='button' class='shutdown-button'></span> $shutdown</button>",
"callback": function() {
alert('FORCE-SHUTDOWN###');
}
},
{
"label" : "<button type='button' class='suspend-button'></span> $suspend</button>",
"callback": function() {
alert('FORCE-SUSPEND###');
}
},
{
"label" : "<button type='button' class='restart-button'></span> $restart</button>",
"callback": function() {
alert('FORCE-RESTART###');
}
},
{
"label" : "<button type='button' class='cancel-button'></span> $cancel_label</button>"
}
]);
}
var WebIntervId;
function check_web() {
var rawFile = new XMLHttpRequest();
rawFile.open("GET", "/tmp/webStatus.log", false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
allText = allText.replace(/ON/g, "<img src=\"img/online.png\">");
allText = allText.replace(/OFF/g, "<img src=\"img/offline.png\">");
document.getElementById("webLabel").innerHTML=allText;
}
}
}
rawFile.send(null);
}
function requestTimers(){
WebIntervId = setInterval(check_web, 500);
}
</script>
<div id="background" class="background">
</div>
<div id="left_box">
<div id="top_box">
<div align="left" style="margin-left:20px; margin-top:15px; color:#DFDFDF" id="webLabel"></div>
<div id="top_inner_box">
</div>
</div>
<div id="middle_box">
<div id="login_box">
<img id="selected_avatar" onerror="this.src='img/logo.png'" src="img/logo_dcc.png"/></img>
<div id="selected_status"></div>
<div id="selected_user"></div>
<div id="selected_user_box" class="hide"><font class="selected_font_username" id="current_username"></font> <font class="selected_font_gecos" id="current_gecos"></font></div>
<form onSubmit="return send_login();">
<div id="entry_box"><input type="text" id="entry" placeholder="Usuário" autofocus></div>
</form>
<div id="sessions-title" class="hide">$selectsession</div>
<div id="sessions-body" class="hide">
<p>
<table class="table-striped table-hover table-condensed" id="sessions"></table>
</ul>
</p>
</div>
</div>
</div>
<div style="position:relative; top:-105px;color:#DFDFDF">Computer Science Labs<BR>Your university department here</div>
</div>
<div id="right-box">
<div id="quit" onClick="quit_dialog();"><span class="glyphicon glyphicon-off"></span></div>
<div id="error" class="alert alert-error"></div>
<div id="timed" class="alert alert-info"></div>
</div>
</body>
</html>
<script src="js/bootstrap.min.js"></script>
<script>
$('#entry_box').focus();
init();
$.fn.animateTo = function(appendTo, destination, duration, easing, complete) {
if(appendTo !== 'appendTo' &&
appendTo !== 'prependTo' &&
appendTo !== 'insertBefore' &&
appendTo !== 'insertAfter') return this;
var target = this.clone(true).css('visibility','hidden')[appendTo](destination);
this.css({
'position' : 'relative',
'top' : '0px',
'left' : '0px'
}).animate({
'top' : (target.offset().top - this.offset().top)+'px',
'left' : (target.offset().left - this.offset().left)+'px'
}, duration, easing, function() {
target.replaceWith($(this));
$(this).css({
'position' : 'static',
'top' : '',
'left' : ''
});
if($.isFunction(complete)) complete.call(this);
});
}
</script>