summaryrefslogtreecommitdiffstats
path: root/dhcp-home-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-08-09 14:37:15 +0000
committerTed Trask <ttrask01@yahoo.com>2008-08-09 14:37:15 +0000
commite45a01ccebf7c9a756e3d27e3fe6abbeb8797a36 (patch)
tree338fd422d828a395b9070fb7201e89e5895c07cd /dhcp-home-html.lsp
parentc4de6d7e2aea4520dbfb9070ecb1d9f01185a092 (diff)
downloadacf-dhcp-e45a01ccebf7c9a756e3d27e3fe6abbeb8797a36.tar.bz2
acf-dhcp-e45a01ccebf7c9a756e3d27e3fe6abbeb8797a36.tar.xz
Rewrite of dhcp to modify existing config file rather than just generate a new one. Still need to add support for hosts, currently only supports globals and subnets.
git-svn-id: svn://svn.alpinelinux.org/acf/dhcp/trunk@1373 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'dhcp-home-html.lsp')
-rw-r--r--dhcp-home-html.lsp113
1 files changed, 16 insertions, 97 deletions
diff --git a/dhcp-home-html.lsp b/dhcp-home-html.lsp
index 7125145..1591f76 100644
--- a/dhcp-home-html.lsp
+++ b/dhcp-home-html.lsp
@@ -1,108 +1,27 @@
-<%
- local form = ...
- local data = form.option
-%>
+<% local view, viewlibrary, page_info, session = ... %>
+<% require("viewfunctions") %>
-<%
-function displayinfo(myform,tags,viewonly)
- 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) 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) 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
-end
-%>
-
-<H1>SYSTEM INFO</H1>
-<DL>
-<%
-local myform = form.info
-local tags = { "status", "version", "autostart", }
-displayinfo(myform,tags,"viewonly")
-%>
-</DL>
-
-<H2>Change/Generate settings</H2>
+<% if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("status")
+end %>
-<H3>Global</H3>
+<H1>Global Settings</H1>
<DL>
<dt>Edit global settings</dt>
-<dd><form action="<% io.write(data.script .. data.prefix .. data.controller .. "/settings") %>" method="POST">
-<input type=submit name="cmd" value="edit" class="submit">
-</form></dd>
-
-
-<dt>Global Config Pre/Post Code</dt>
-<dd><form action="<% io.write(data.script .. data.prefix .. data.controller .. "/editspc") %>" method="POST">
-<input type=submit name="cmd" value="edit" class="submit">
+<dd><form action="<%= page_info.script .. page_info.prefix .. page_info.controller .. "/settings" %>" method="POST">
+<input type=submit value="Edit" class="submit">
</form></dd>
</DL>
-<H3>Subnet declarations</H3>
-
-<DL>
-<dt>Edit subnet</dt>
-<dd><form action="<% io.write(data.script .. data.prefix .. data.controller .. "/editnet") %>" method="POST">
-<select class="select" name="network" size="1">
- <option value="choose">-- Choose Network --</option>
-<%
- for k,v in ipairs(form.info.subnets) do
- io.write("<option>" .. v .. "</option>")
- end
-%>
-</select><input type=submit name="cmd" value="edit" class="submit">
-</form></dd>
-
-<dt>Add new subnet</dt>
-<dd><form action="<% io.write(data.script .. data.prefix .. data.controller .. "/createnet") %>" method="POST">
-<input type=submit name="cmd" value="new" class="submit">
-</form></dd>
-</DL>
-
-<h3>Generate config</h3>
-<DL>
-<dt>Generate Configuration File</dt>
-<dd><form action="<% io.write(data.script .. data.prefix .. data.controller .. "/home") %>" method="POST">
-<input type=submit name="cmd" value="generate" class="submit"></form>
-<% if form.genmsg ~= nil then io.write( "<p class='error'>" .. form.genmsg .. "</p>" ) end %></dd>
-</DL>
-
-<% -- MANAGEMENT BUTTONS
-local cmdform = form.management
-local cmdresult = form.cmdmanagement
-local tags = { "start", "stop", "restart" }
-if (cmdform) and (cmdform[tags[1]]) then
+<% if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("listsubnets")
+end %>
- io.write('<form name="management" action="" method="POST">')
- io.write('<H1>MANAGEMENT</H1>')
- io.write('<dl>')
- io.write('<dt>' .. cmdform[tags[1]]["label"] .. '</dt>')
- io.write('<dd>')
- for k,v in pairs(tags) do
- if (cmdform[v]) then
- io.write(html.form[cmdform[v].type](cmdform[v]))
- end
- end
- io.write('</dd>')
+<% --[[if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("listhosts")
+end --]] %>
- if (cmdresult) and (cmdresult.action) and (#cmdresult.action.descr > 0) then
- io.write('<dt>' .. cmdresult.label .. '</dt>')
- io.write('<dd><pre>' .. cmdresult.action.descr .. '</pre></dd>')
- end
- io.write('</dl></form>')
+<% if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("startstop")
end %>