summaryrefslogtreecommitdiffstats
path: root/tinydns-status-html.lsp
blob: 17a1b60531a6d9c8ee5277866eb1c28491dd89a9 (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
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
<? local form = ... 
require("viewfunctions")
?>
<?
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
?>

<H1>SYSTEM INFO</H1>
<? 
local myform = form.status 
local tags = { "status", "version", "autostart", }
displayinfo(myform,tags,"viewonly")
?>

<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
<H3>Locations</H3>
<? 
local myform = form.config.locations
io.write("<DL>")
if (myform) and (myform.value) then
	local val = myform 
	io.write("\n\t<DT")
	if (#val.errtxt > 0) then 
		io.write(" class='error'")
	end
	io.write(">" .. val.label .. "</DT>")

	io.write("\n\t\t<DD>")
	for k,v in pairs(myform.value) do 
		io.write("<IMG SRC='/static/tango/16x16/places/start-here.png' width='16' height='16' alt> <B>" .. tostring(k) .. "</B>")
		for kk,vv in pairs(v) do 
			io.write(tostring("<BR><SPAN STYLE='margin-left:30px;'>" .. vv .. "</SPAN>\n"))
		end
		io.write("<BR>")
	end

	if (val.descr) and (#val.descr > 0) then io.write("\n\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>") end
	if (#val.errtxt > 0) then io.write("\n\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>") end
	io.write("\n\t\t</DD>")
end
io.write("</DL>")
?>

<? 
local function recurseoutput(table,cnt)
	if not (cnt) then cnt=0 end
	cnt = cnt + 1
	for k,v in pairs(table or {}) do
		if (table[k].label) then
		if not (tonumber(k)) or (v.value) then
--			if v.label then
				io.write("\n\t\t\t<IMG SRC='/static/tango/16x16/devices/computer.png' width='16' height='16' alt STYLE='margin-left:"..cnt..
					"0px'><SPAN STYLE=''> " .. tostring(v.label) .. "</SPAN><BR>")
				io.write("\n\t\t\t<TABLE STYLE='margin-left:90px;'>")
				for k1,v1 in pairs(v.option) do
					if (v1.label) then
						io.write("\n\t\t\t\t<TR>\n\t\t\t\t\t<TD  WIDTH='160px' STYLE=''>".. tostring(v1.label) .. 
						":</TD>\n\t\t\t\t\t<TD>".. tostring(v1.value) .."</TD>\n\t\t\t\t</TR>")
					end
				end
				io.write("\n\t\t\t</TABLE>")
--			end
		else
			io.write("\n\t\t\t<SPAN STYLE='margin-left:"..cnt.."0px;font-weight:bold;'> ".. 
				tostring(table[k].label) .. "</SPAN><BR>")
			recurseoutput(v,cnt)
		end
		end
	end
end
?>

<H3>Records</H3>
<? 
local tags = {"nsourdomain", "nsdomain", "host", "alias", "mx", "ptr", "cname", "soa", "generic", "all" }
local myform = form.config.settings
io.write("<DL>")
for k,v in pairs(tags) do 
	local myform = myform[v]
	if (myform) and (myform.value) then
		io.write("\n\t<DT")
		io.write(">" .. myform.label .. "</DT>")
		io.write("\n\t\t<DD>")

		for k,v in pairs(myform.value) do 
			recurseoutput(v)
		end
		io.write("\n\t\t</DD>")
	end
end
io.write("</DL>")
?>