summaryrefslogtreecommitdiffstats
path: root/dansguardian-category-html.lsp
blob: c2ffce6efae1714abf2b0963e7436b66650fd7b5 (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
<? 
require("viewfunctions")
   local form = ... 
   local data = form.option
   local service = form.service
   local config = form.service.config
   
   local srv1fill = ""
   local srv2fill = "disabled"
   if form.info.status.value == "Enabled" then
   	srv1fill = "disabled"
   	srv2fill = ""
   end
   
   local ifthen = function( variable, value, result )
      if variable == value then
         io.write( result )
      end
   end
   
?>

<?
--[[ 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>
<DL>
<? 
local myform = form.info
local tags = { "status", "version", "autostart", }
displayinfo(myform,tags,"viewonly")
?>
</DL>

<h1>Modify Categories</h1>

<h2>Category list</h2>
<form action="" method="POST">
<dl>
<?
local myform = form["service"]["config"]["categories"]
for k,v in ipairs( myform ) do
	io.write("<DT ")
	if not (v.active) then io.write("CLASS='error'") end
	io.write("><img src='/static/tango/16x16/categories/applications-system.png' height='16' width='16'> "..v.name.."</DT>\n")
	io.write("<DD><TABLE>")
	if (v.option) then
		for k1,v1 in pairs(v.option) do
			io.write("<TR><TD STYLE='font-weight:bold;' WIDTH='180px' ")
			if not (v1.active) then io.write("CLASS='error'") end
			io.write(">".. v1.name .. "</TD><TD>[ <A HREF='editcategories?category=".. v.name .. "&object=".. v1.name .. "'>Edit</A> ]</TD></TD>" )
--			for k2,v2 in pairs(v1) do
				--io.write(html.form(v1.type(v1)))
--				io.write("<TD>")
--				io.write("[ " ..html.link(v2) .. " ] ")
--				io.write(tostring(v2))
--				io.write("</TD>")
--			end
			io.write("</TR>\n")
		end
			io.write("<TR><TD STYLE='font-weight:bold;' WIDTH='180px'><INPUT TYPE='text' CLASS='text'></TD><TD><INPUT TYPE='submit' CLASS='submit' VALUE='Create' disabled></TD></TD></TR>\n" )
	end
	io.write("</TABLE></DD>")
--io.write( "<BR><input type=\"checkbox\" name=\"cats\" value=\"" .. v .. "\"> " .. v .. "\n" )
end
?>
</dl>
</form>


<h1>MANAGEMENT</h1>
<form action="" method="POST">
<dl>
<DT>Daemon control</DT><dd><input class="submit" type="submit" name="srvcmd" value="start" <? io.write( srv1fill ) ?>> 
<input class="submit" type="submit" name="srvcmd" value="stop" <? io.write( srv2fill ) ?>>
<input class="submit" type="submit" name="srvcmd" value="restart" <? io.write( srv2fill ) ?>>
<? if (service.message) and (service.message.descr) and (#service.message.descr > 0) then ?><pre><? io.write( service.message.descr ) ?></pre><? end ?></dd>
</dl>
</form>