diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-03-28 11:44:58 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-03-28 11:44:58 +0000 |
commit | 70b28419e50d7947ab1220517e5c3495aca73a93 (patch) | |
tree | da6e5122d68befca005f27b4dff04af7911bf870 /interfaces-update-html.lsp | |
parent | c2af45dbef7d1cd8036bb6f94e03649bd2e9b786 (diff) | |
download | acf-alpine-baselayout-70b28419e50d7947ab1220517e5c3495aca73a93.tar.bz2 acf-alpine-baselayout-70b28419e50d7947ab1220517e5c3495aca73a93.tar.xz |
Cleaned up 'read' tab so it only allows read (no edit actions).
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@856 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'interfaces-update-html.lsp')
-rw-r--r-- | interfaces-update-html.lsp | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/interfaces-update-html.lsp b/interfaces-update-html.lsp index 09743f3..228e8e0 100644 --- a/interfaces-update-html.lsp +++ b/interfaces-update-html.lsp @@ -1,11 +1,45 @@ <? local form = ... ?> +<? +--[[ 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>") +--]] +?> + +<? +function displayinfo(myform,tags,viewonly) + io.write("<DL>") + for k,v in pairs(tags) do + if (myform[v]) and (myform[v]["value"]) then + local val = myform[v] + io.write("\t<DT") + if (#val.errtxt > 0) then + val.class = "error" + io.write(" class='error'") + end + io.write(">" .. val.label .. "</DT>\n") + if (viewonly) then + io.write("\t\t<DD>" .. val.value .. "\n") + else + io.write("\t\t<DD>" .. html.form[val.type](val) .. "\n") + end + if (val.descr) and (#val.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>\n") end + if (#val.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>\n") end + io.write("\t\t</DD>\n") + end + end + io.write("</DL>") +end +?> + <h1>Update Interface <?= form.value.name.value ?></h1> <form action="<?= form.option.script .. "/" .. form.option.prefix .. form.option.controller .. "/" .. form.option.action .. form.option.extra ?>" method="POST"> -<? local myform = form.value +<? -- We redefine the list of tags from the model (iface_tags) because -- the VIEW can choose the order to display the data. The Controller @@ -14,15 +48,9 @@ -- In this case, we don't show "name" - since its already known local tags = { "comment", "method", "address", "netmask", "gateway", "hostname", "provider", "pre-up", "up", "down", "post-down", "cmd" } +local myform = form.value +displayinfo(myform,tags) -for i,v in pairs(tags) do - local val = myform[v] ?> -<dt><? if (val.label) then io.write(val.label) else io.write (v) end ?></dt> - <? if val.name == "" then - val.name = v - end - ?> - <dd><?= html.form[val.type](val) ?></dd> -<? end ?> +?> </form> |