diff options
Diffstat (limited to 'interfaces-read-html.lsp')
-rw-r--r-- | interfaces-read-html.lsp | 66 |
1 files changed, 34 insertions, 32 deletions
diff --git a/interfaces-read-html.lsp b/interfaces-read-html.lsp index b736209..a0cb44a 100644 --- a/interfaces-read-html.lsp +++ b/interfaces-read-html.lsp @@ -5,11 +5,11 @@ html = require("acf.html") <% showoption = function(option) if option.errtxt or option.value ~= "" then %> - <TR><TD WIDTH='120px' STYLE='font-weight:bold;border:none;'><%= html.html_escape(option.label) %></TD> - <TD STYLE='border:none;'<% if option.errtxt then io.write("class='error'") end %>> - <%= string.gsub(html.html_escape(tostring(option.value)), "\n", "<BR>") %> - <% if option.errtxt then io.write("<BR>"..html.html_escape(option.errtxt)) end %> - </TD></TR> + <tr><td width='120px' style='font-weight:bold;border:none;'><%= html.html_escape(option.label) %></td> + <td style='border:none;'<% if option.errtxt then io.write("class='error'") end %>> + <%= string.gsub(html.html_escape(tostring(option.value)), "\n", "<br/>") %> + <% if option.errtxt then io.write("<br/>"..html.html_escape(option.errtxt)) end %> + </td></tr> <% end %> <% end %> @@ -19,43 +19,45 @@ html = require("acf.html") viewlibrary.dispatch_component("status") end %> -<H1>Configured interfaces</H1> -<DL> +<h1>Configured Interfaces</h1> <% for i,entry in ipairs(view.value) do local interface = entry.value %> - <DT><IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/devices/network-wired.png' width='16' height='16'> <%= html.html_escape(interface.name.value) %></DT><DD> - <TABLE STYLE='margin-bottom:10px'> + <div class='item'><div class='left'><IMG SRC='<%= html.html_escape(page_info.wwwprefix..page_info.staticdir) %>/tango/16x16/devices/network-wired.png' width='16' height='16'> <%= html.html_escape(interface.name.value) %></div> + <div class='right'> + <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 viewlibrary.check_permission("update") or viewlibrary.check_permission("delete") or viewlibrary.check_permission("ifup") or viewlibrary.check_permission("ifdown") then %> + <tr><td colspan=2 style='border:none;'> <% if viewlibrary.check_permission("update") then %> - <A HREF='update?name=<%= html.html_escape(interface.name.value) %>&redir=read'>Edit </A> + <a href='update?name=<%= html.html_escape(interface.name.value) %>&redir=read'>Edit </a> <% end if viewlibrary.check_permission("delete") then %> - <A HREF='delete?name=<%= html.html_escape(interface.name.value) %>&submit=true&redir=read'>Delete </A> + <a href='delete?name=<%= html.html_escape(interface.name.value) %>&submit=true&redir=read'>Delete </a> <% end if viewlibrary.check_permission("ifup") then %> - <A HREF='ifup?name=<%= html.html_escape(interface.name.value) %>&submit=true&redir=read'>ifup </A> + <a href='ifup?name=<%= html.html_escape(interface.name.value) %>&submit=true&redir=read'>ifup </a> <% end if viewlibrary.check_permission("ifdown") then %> - <A HREF='ifdown?name=<%= html.html_escape(interface.name.value) %>&submit=true&redir=read'>ifdown </A> + <a href='ifdown?name=<%= html.html_escape(interface.name.value) %>&submit=true&redir=read'>ifdown </a> + <% end %> + </td></tr> <% end %> - </TR> - </TABLE> + + <% + 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 %> + </table> + </div></div><!-- end .item --> <% end %> -</DD> -</DL> -<H1>Restart Networking</H1> -<DL> -<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> -<DT>Restart Networking</DT> -<DD><form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/restart?redir=read") %>"><input class="submit" type="submit" name="submit" value="Restart"></form></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> +<div class='item'><p class='left'>Restart Networking</p> +<div class='right'> +<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/restart?redir=read") %>"><input class="submit" type="submit" name="submit" value="Restart"></form> +</div></div><!-- end .item --> |