summaryrefslogtreecommitdiffstats
path: root/interfaces-read-html.lsp
blob: d0984dc562251ad6163206d8785a6400a2b64dcb (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
<% local view, viewlibrary, page_info, session = ... 
require("viewfunctions")
%>
<%
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
io.write(html.cfe_unpack(view))
io.write("</span>")
--]]
%>

<% showoption = function(option)
	if option.errtxt or option.value ~= "" then %>
		<TR><TD WIDTH='120px' STYLE='font-weight:bold;border:none;'><%= option.label %></TD>
		<TD STYLE='border:none;'<% if option.errtxt then io.write("class='error'") end %>>
		<%= string.gsub(tostring(option.value), "\n", "<BR>") %>
		<% if option.errtxt then io.write("<BR>"..option.errtxt) end %>
		</TD></TR>
	<% end %>	
<% end %>

<% displaycommandresults({"update", "delete", "ifup", "ifdown", "restart"}, session) %>

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

<H1>Configured interfaces</H1>
<DL>
<% for i,entry in ipairs(view.value) do
	local interface = entry.value %>
	<DT><IMG SRC='/skins/static/tango/16x16/devices/network-wired.png' width='16' height='16'> <%= interface.name.value %></DT><DD>
	<TABLE STYLE='margin-bottom:10px'>

	<% 
	showoption(interface.family)
	if interface.method then showoption(interface.method) end
	for name,option in pairs(interface) do
		if name~="name" and name~="family" and name~="method" then
			showoption(option)
		end
	end %>
	<TR>
	<% if session.permissions.interfaces.update then %>
		<A HREF='update?name=<%= interface.name.value %>&redir=read'>Edit </A>
	<% end
	if session.permissions.interfaces.delete then %>
		<A HREF='delete?name=<%= interface.name.value %>'>Delete </A>
	<% end
	if session.permissions.interfaces.ifup then %>
		<A HREF='ifup?name=<%= interface.name.value %>'>ifup </A>
	<% end
	if session.permissions.interfaces.ifdown then %>
		<A HREF='ifdown?name=<%= interface.name.value %>'>ifdown </A>
	<% end %>
	</TR>
	</TABLE>
<% end %>
</DD>
</DL>

<H1>Restart Networking</H1>
<P class="error">WARNING!!! Restarting networking may cause the ACF web interface to stop functioning. Try refreshing this page after restarting. If that fails, you may have to use terminal access to recover.</P>
<DL>
<DT>Restart Networking</DT>
<DD><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/restart" %>"><input class="submit" type="submit" value="Restart"></form></DD>
</DL>