summaryrefslogtreecommitdiffstats
path: root/openssh-connectedpeers-html.lsp
blob: 9740e7255d38ffb4f62b0d1335cb1a96fb65b7d4 (plain)
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
<% local data, viewlibrary, page_info = ... 
html = require("acf.html")
%>

<h1>Connected peers</h1>
<%
if #data == 0 then
	io.write("<p>No peers found</p>\n")
end
local col1="180px"
for k,v in pairs(data) do
	io.write("<h3>" .. html.html_escape(v.host))
	if v.name and v.name ~= v.host then io.write(" - "..html.html_escape(v.name)) end
	io.write("</h3>\n")
	io.write("<table>")
	for i=1, v.cnt do
		io.write("<tr>")
		if (v.tty[i]) then
			io.write("<td width='20px' style='padding-left:20px;vertical-align:top;'><img src='".. html.html_escape(page_info.wwwprefix..page_info.staticdir) .. "/tango/16x16/apps/utilities-terminal.png' height='16' width='16'></td>")
			io.write("<td style='padding-bottom:10px'>\n")
			io.write("<table>")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session user:</td><td>".. html.html_escape(v.tty[i].user) .. "</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session TTY:</td><td>".. html.html_escape(v.tty[i].tty) .. "</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Started:</td><td>".. html.html_escape(v.tty[i].time) .. "</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Idle:</td><td>".. html.html_escape(v.tty[i].idle) .. "</td></tr>\n")

			io.write("</table>")
			io.write("</td>\n")

		else
			io.write("<td width='20px' style='padding-left:20px;vertical-align:top;'><img src='".. html.html_escape(page_info.wwwprefix..page_info.staticdir) .. "/tango/16x16/emblems/emblem-unreadable.png' height='16' width='16'></td>")
			io.write("<td style='padding-bottom:10px'>\n")
			io.write("<table>")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session user:</td><td>No records</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session TTY:</td><td>No records</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Started:</td><td>No records</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Session Idle:</td><td>No records</td></tr>\n")
			io.write("<tr><td width='"..col1.."' style='font-weight:bold;'>Other:</td><td>This could be a sshfs session</td></tr>\n")

			io.write("</table>")
			io.write("</td>\n")
		end
		io.write("</tr>")
	end
	io.write("</table>")
end
%>