-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhtml_who.js
90 lines (80 loc) · 2.17 KB
/
html_who.js
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
// html_nodelist.js
load("nodedefs.js");
var include_age_gender=false;
var include_location=false;
var include_statistics=false;
function xtrn_name(code)
{
if(this.xtrn_area==undefined)
return(code);
for(s in xtrn_area.sec_list)
for(p in xtrn_area.sec_list[s].prog_list)
if(xtrn_area.sec_list[s].prog_list[p].code.toLowerCase()==code.toLowerCase())
return(xtrn_area.sec_list[s].prog_list[p].name);
return(code);
}
writeln("<font face=Arial,Helvetica,sans-serif>");
font_color = "<font color=black>";
// Table
writeln("<table border=0 width=100%>");
// Header
writeln("<thead>");
writeln("<tr bgcolor=white>");
write("<th align=center width=7%>" + font_color + "Node");
write("<th align=center width=20%>" + font_color + "User");
write("<th align=left>" + font_color + "Action/Status");
if(include_location)
write("<th align=left>" +font_color+ "Location");
if(include_age_gender) {
write("<th align=center width=7%>" + font_color + "Age");
write("<th align=center width=10%>" + font_color + "Gender\r\n");
}
write("<th align=center width=10%>" + font_color + "Time\r\n");
writeln("</thead>");
writeln("<tbody>");
var u = new User(0);
for(n=0;n<system.node_list.length;n++) {
if(system.node_list[n].status==NODE_INUSE) {
write("<tr>");
write(format("<td align=right><font size=-1>%d",n+1));
u.number=system.node_list[n].useron;
if(system.node_list[n].action==NODE_XTRN && system.node_list[n].aux)
action=format("running %s",xtrn_name(u.curxtrn));
else
action=format(NodeAction[system.node_list[n].action]
,system.node_list[n].aux);
write(format(
"<td align=center><a href=mailto:%s>%s</a>"
,u.email
,u.alias
));
write(format(
"<td><font color=yellow>%s"
,action
));
if(include_location)
write(format(
"<td align=left>%s"
,u.location
));
if(include_age_gender)
write(format(
"<td align=center>%d<td align=center>%s"
,u.age
,u.gender
));
t=time()-u.logontime;
if(t&0x80000000) t=0;
write(format(
"<td align=center>%u:%02u:%02u"
,Math.floor(t/(60*60))
,Math.floor(t/60)%60
,t%60
));
write("\r\n");
}
}
writeln("</tbody>");
writeln("</table>");
writeln("</font>");
writeln("</font>");