summaryrefslogtreecommitdiffstats
path: root/opennhrp-show-html.lsp
blob: 9b5ac4697af89e3e7e6c420a4283feb7f4804915 (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
49
50
51
52
53
54
55
56
57
<% local data, viewlibrary, page_info = ... 
require("viewfunctions")
%>

<% if viewlibrary and viewlibrary.dispatch_component then
	viewlibrary.dispatch_component("status")
end %>

<H1><%= html.html_escape(data.label) %></H1>
<DL>
<%
displayitem(data.value.status)
%>
<DT><%= html.html_escape(data.value.peers_list.label) %></DT>
<DD>
<%
	local found
	for intf,addresses in pairs(data.value.peers_list.value) do
		found = true
%>
		<TABLE STYLE='margin-bottom:10px;'>
		<TR><TD STYLE='font-weight:bold;border:none;'><IMG SRC='/skins/static/tango/16x16/places/network-server.png' width='16' height='16' alt> <%= html.html_escape(intf) %></TD><TD STYLE='border:none;'></TD></TR>
<%		for i,entries in ipairs(addresses) do
			io.write("<TR STYLE='padding-bottom:10px;'><TD WIDTH='150px' STYLE='font-weight:bold;padding-left:20px;border:none;'><IMG SRC='/skins/static/tango/16x16/status/")

			if entries.Type and (entries.Type.value == "incomplete") then
				io.write("network-error")
			elseif entries.Type and (entries.Type.value == "negative") then
				io.write("network-offline")
			elseif entries.Flags and (entries.Flags.value == "up") then
				io.write("network-idle")
			elseif entries.Flags and (entries.Flags.value == "used up") then
				io.write("network-transmit-receive")
			elseif entries.Flags and (entries.Flags.value == "used up") then
				io.write("network-offline")
			else
				io.write("network-error")
			end
			io.write(".png' width='16' height='16' title='" .. html.html_escape(entries.Type.descr) .. "'> " .. html.html_escape(entries["Protocol-Address"].value) .. "</TD><TD STYLE='font-weight:bold;border:none;'></TD></TR>\n")

    			for j,entry in pairs(entries) do
				if  j ~= "Protocol-Address" then
					io.write("<TR><TD STYLE='font-weight:bold;padding-left:40px;border:none;'>"..html.html_escape(entry.label).."</TD><TD STYLE='border:none;'>"..html.html_escape(entry.value))
					if entry.descr then
						io.write(" <I>(" .. html.html_escape(entry.descr) .. ")</I>")
					end
					io.write("</TD></TR>\n")
				end
			end
		end
		io.write("\t\t\t</TABLE>")
	end
	if not found then io.write("No peers found\n") end
%>
</DD>
</DL>