diff options
Diffstat (limited to 'interfaces-config-html.lsp')
-rw-r--r-- | interfaces-config-html.lsp | 84 |
1 files changed, 39 insertions, 45 deletions
diff --git a/interfaces-config-html.lsp b/interfaces-config-html.lsp index e3a13e9..f0cc8ef 100644 --- a/interfaces-config-html.lsp +++ b/interfaces-config-html.lsp @@ -1,45 +1,39 @@ -<? local view = ... ?> - -<h1>Interfaces file</h1> - -<h2>New interface</h2> -<dl> -<dt>Create new interface</dt> -<dd>[<a href="create?iface=">Create</a>]</dd> -</dl> - -<h2>Existing interface(s)</h2> - -<? for i=0,table.maxn(view.iface) do - local iface="" - if i > 0 then do - j = view.iface[i] - iface = j.name.value ?> -<h3><?= j.name.value ?></h3> -<dl> -<dt>Method</dt> -<dd><?= j.method.value ?></dd> -<? if ( j.method.value == "dhcp" ) then ?> - <dt>Hostname</dt> - <dd><?= j.address.value ?></dd> -<? elseif ( j.address.value ~= "" ) then?> - <dt>Address</dt> - <dd><?= j.address.value ?>/<?= j.netmask.value ?></dd> -<? end ?> -<? if (j.comment.value ~= "") then ?> - <dt>Comments</dt> - <dd><?= j.comment.value ?></dd> -<? end ?> - -<? local val = {value="update", type="submit", option="", errtxt=""}?> - -<dt>Modify this interface</dt> -<dd>[<a href="<?= view.actions.link .. "update?iface=" .. j.name.value ?>">update</a>] -[<a href="<?= view.actions.link .. "delete?iface=" .. j.name.value ?>">delete</a>]</dd> -</dl> -<? end ?> -<? end ?> -<? end ?> - - - +<? local form = ... +require("viewfunctions") +?> +<? +--[[ 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>INTERFACES</H1> +<H2>Edit interfaces</H2> +<DL> +<? +local myform = form.iface +for k,v in pairs(myform) do + local myform=v + if (myform.name.value ~= "") then + io.write("<DT><IMG SRC='/static/tango/16x16/devices/network-wired.png' width='16' height='16'> " .. (myform.name.value or '') .. "</DT><DD>") + io.write("<TABLE STYLE='margin-bottom:10px'>") + local tags = { "edit", "method", "address", "netmask", "gateway", "provider", "hostname", "pre-up", "up", "down", "post-down", "comment", } + for k1,v1 in pairs(tags) do + if (myform[v1]['value'] ~= "") then + io.write("<TR><TD WIDTH='120px' STYLE='font-weight:bold;'>" .. myform[v1]['label'] .. "</TD>") + if (myform[v1]['type'] == "link") then + io.write("<TD>[ <A HREF='update?iface=" .. myform.name.value .. "'>" .. string.gsub(myform[v1]['value'], "\n", "<BR>") .. "</A> ]</TD></TR>") + else + io.write("<TD>" .. string.gsub(myform[v1]['value'], "\n", "<BR>") .. "</TD></TR>") + end + end + end + io.write("</TABLE>") + end + +end +io.write("</DD>") +?> +</DL> |