summaryrefslogtreecommitdiffstats
path: root/health-storage-html.lsp
blob: 233513276908fb43d0fb0801a259b6c5b834f75e (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
<% local view, viewlibrary, page_info, session = ... %> 
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>

<% displaydisk = function(disk, name)
io.write("<pre>"..html.html_escape(disk.value).."</pre>\n")
io.write('<table style="margin:0px;padding:0px;border:0px">\n')
io.write("	<tr>\n")
io.write("		<td>0%</td>\n")
if tonumber(disk.used) > 0 then
	io.write('		<td width="'..html.html_escape(disk.used)..'%" style="background:red;border:2px solid black;')
	if tonumber(disk.used) < 100 then io.write('border-right:none;') end
	io.write('"><center><b>')
	if ( tonumber(disk.used) > 10) then io.write(html.html_escape(disk.used) .. "%") end
	io.write('</b></center></td>\n')
end
if tonumber(disk.used) < 100 then
	io.write('		<td width="'..(100-tonumber(disk.used))..'%" style="background:#0c0;border:2px solid black;')
	if tonumber(disk.used) > 0 then io.write('border-left:none;') end
	io.write('"><center><b>')
	if ( 90 > tonumber(disk.used)) then io.write((100-tonumber(disk.used)) .. "%") end
	io.write('</b></center></td>\n')
end
io.write('		<td>100%</td>\n')
io.write("	</tr>\n")
io.write("</table>\n")
io.write('<table style="margin:0px;padding:0px;border:0px;margin-top:5px;">\n')
io.write("	<tr>\n")
io.write('		<td width="100px"><b>'..html.html_escape(name)..'</b></td><td style="background:red;border:2px solid black;" width="20px"></td><td width="70px"><b>=Used</b></td><td style="background:#0c0;border:2px solid black;" width="20px"></td><td><b>=Free</b></td>\n')
io.write("	</tr>\n")
io.write("</table>\n")
end %>

<%
local header_level = htmlviewfunctions.displayheader(view, page_info)
header_level = htmlviewfunctions.incrementheader(header_level)
%>

<% htmlviewfunctions.displayheader(cfe({label="Floppy capacity"}), page_info, header_level) %>
<% if (view.value.floppy) then
for name,floppy in pairs(view.value.floppy.value) do
	displaydisk(floppy, name)
end
else %>
<p>No Floppy mounted</p>
<% end %>

<% htmlviewfunctions.displayheader(cfe({label="Harddrive capacity"}), page_info, header_level) %>
<% if (view.value.hd) then 
for name,hd in pairs(view.value.hd.value) do
	displaydisk(hd, name)
end
else %>
<p>No Harddrive mounted</p>
<% end %>

<% htmlviewfunctions.displayheader(cfe({label="RAM Disk capacity"}), page_info, header_level) %>
<% if (view.value.ramdisk) then 
for name,ramdisk in pairs(view.value.ramdisk.value) do
	displaydisk(ramdisk, name)
end
else %>
<p>No RAM Disk mounted</p>
<% end %>

<% if view.value.partitions then %>
<% htmlviewfunctions.displayheader(cfe({label="Disk partitions"}), page_info, header_level) %>
<pre><%= html.html_escape(view.value.partitions.value) %></pre>
<% end %>