summaryrefslogtreecommitdiffstats
path: root/interfaces-update-html.lsp
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-04-09 13:21:08 +0000
committerMika Havela <mika.havela@gmail.com>2008-04-09 13:21:08 +0000
commit10d4d3ab01a7ab59b8c07c8acb75c1b3ffd9c754 (patch)
tree95b1dada20bfa24eb983fe7df6ee3ccc3e5e81cf /interfaces-update-html.lsp
parentb4bb80d491873de680d6b5bee58afeb2e0333edb (diff)
downloadacf-alpine-baselayout-10d4d3ab01a7ab59b8c07c8acb75c1b3ffd9c754.tar.bz2
acf-alpine-baselayout-10d4d3ab01a7ab59b8c07c8acb75c1b3ffd9c754.tar.xz
Created a 'edit' page to edit interfaces.
Fixed so you can delete interfaces (I probably broke this earlier, not knowing it). Added a new tab to create new interface. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@965 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'interfaces-update-html.lsp')
-rw-r--r--interfaces-update-html.lsp43
1 files changed, 16 insertions, 27 deletions
diff --git a/interfaces-update-html.lsp b/interfaces-update-html.lsp
index 228e8e0..5c33872 100644
--- a/interfaces-update-html.lsp
+++ b/interfaces-update-html.lsp
@@ -1,4 +1,6 @@
-<? local form = ... ?>
+<? local form = ...
+require("viewfunctions")
+?>
<?
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
@@ -7,38 +9,13 @@ 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">
+<DL>
<?
-- We redefine the list of tags from the model (iface_tags) because
@@ -50,7 +27,19 @@ local tags = { "comment", "method", "address", "netmask", "gateway",
"hostname", "provider", "pre-up", "up", "down", "post-down", "cmd" }
local myform = form.value
displayinfo(myform,tags)
+-- Add the 'name' filed (but don't show it because it's {type='hidden'}
+io.write(html.form[myform.name.type](myform.name))
+?>
+</DL>
+<H2>Other actions</H2>
+<DL>
+<?
+local tags = { "cmddelete", }
+local myform = form.value
+displayinfo(myform,tags)
?>
+</DL>
+
</form>