diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-05-30 18:37:19 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-05-30 18:37:19 +0000 |
commit | a280c3b1faa2847b6d4f850a55d0cd4ea8453283 (patch) | |
tree | 762cd65291ba792b83e462f746e41b7381bb9d66 /interfaces-read-html.lsp | |
parent | 6c63347a6ae2f25de2bf8cf9aea93ea31a786418 (diff) | |
download | acf-alpine-baselayout-a280c3b1faa2847b6d4f850a55d0cd4ea8453283.tar.bz2 acf-alpine-baselayout-a280c3b1faa2847b6d4f850a55d0cd4ea8453283.tar.xz |
Updated interfaces to use new cfe model, add more iface families, add more flexibility to editing, show ip status, bring up/down interfaces, and general cleanup.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1191 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'interfaces-read-html.lsp')
-rw-r--r-- | interfaces-read-html.lsp | 80 |
1 files changed, 49 insertions, 31 deletions
diff --git a/interfaces-read-html.lsp b/interfaces-read-html.lsp index 505cbf6..33ab30f 100644 --- a/interfaces-read-html.lsp +++ b/interfaces-read-html.lsp @@ -1,47 +1,67 @@ -<? local form = ... +<? local view, viewlibrary, pageinfo, session = ... 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(html.cfe_unpack(view)) io.write("</span>") --]] ?> -<H1>SYSTEM INFO</H1> +<? 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 ?> + +<? if view.value.cmdresult then ?> +<H1>Command Result</H1> <DL> -<? -local myform = form.status -local tags = { "interfacesfile" } -displayinfo(myform,tags,"viewonly") -?> +<?= view.value.cmdresult.value ?> </DL> +<? end ?> + +<? if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("status") +end ?> -<H2>Configured interfaces</H2> +<H1>Configured interfaces</H1> <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='/skins/static/tango/16x16/devices/network-wired.png' width='16' height='16'> " .. (myform.name.value or '') .. "</DT><DD>") - io.write("<TABLE STYLE='margin-bottom:10px'>") --- io.write("<TR><TD COLSPAN=2 STYLE='font-weight:bold;border:none;'><IMG SRC='/skins/static/tango/16x16/devices/network-wired.png' width='16' height='16'> " .. (myform.name.value or '') .. "</TD></TR>") +<? 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'> - local tags = {"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;border:none;'>" .. myform[v1]['label'] .. "</TD>") - io.write("<TD STYLE='border:none;'>" .. string.gsub(myform[v1]['value'], "\n", "<BR>") .. "</TD></TR>") - end + <? + 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 - io.write("</TABLE>") - end - -end -io.write("</DD>") -?> + end ?> + <TR> + <? if session.permissions.interfaces.update then ?> + <A HREF='update?name=<?= interface.name.value ?>'>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> <? @@ -51,5 +71,3 @@ io.write(html.cfe_unpack(form)) io.write("</span>") --]] ?> - - |