summaryrefslogtreecommitdiffstats
path: root/health-storage-html.lsp
blob: 786a32c27a3f1ae684ffa93abb6b6e61d3447295 (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
<% local view = ... %>
<% 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 %>

<h1>Storage</h1>

<h2>Floppy capacity</h2>
<% 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 %>

<h2>Harddrive capacity</h2>
<% 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 %>

<h2>RAM Disk capacity</h2>
<% 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 %>
<h2>Disk partitions</h2>
<pre><%= html.html_escape(view.value.partitions.value) %></pre>
<% end %>