From e45a01ccebf7c9a756e3d27e3fe6abbeb8797a36 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Sat, 9 Aug 2008 14:37:15 +0000 Subject: 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 --- dhcp-home-html.lsp | 113 ++++++++--------------------------------------------- 1 file changed, 16 insertions(+), 97 deletions(-) (limited to 'dhcp-home-html.lsp') 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" .. val.label .. "\n") - if (viewonly) then - io.write("\t\t
" .. val.value .. "\n") - else - io.write("\t\t
" .. html.form[val.type](val) .. "\n") - end - if (val.descr) and (#val.descr > 0) then io.write("\t\t

" .. string.gsub(val.descr, "\n", "
") .. "

\n") end - if (val.errtxt) then io.write("\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

\n") end - io.write("\t\t
\n") - end - end -end -%> - -

SYSTEM INFO

-
-<% -local myform = form.info -local tags = { "status", "version", "autostart", } -displayinfo(myform,tags,"viewonly") -%> -
- -

Change/Generate settings

+<% if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("status") +end %> -

Global

+

Global Settings

Edit global settings
-
" method="POST"> - -
- - -
Global Config Pre/Post Code
-
" method="POST"> - +
" method="POST"> +
-

Subnet declarations

- -
-
Edit subnet
-
" method="POST"> - -
- -
Add new subnet
-
" method="POST"> - -
-
- -

Generate config

-
-
Generate Configuration File
-
" method="POST"> -
-<% if form.genmsg ~= nil then io.write( "

" .. form.genmsg .. "

" ) end %>
-
- -<% -- 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('
') - io.write('

MANAGEMENT

') - io.write('
') - io.write('
' .. cmdform[tags[1]]["label"] .. '
') - io.write('
') - for k,v in pairs(tags) do - if (cmdform[v]) then - io.write(html.form[cmdform[v].type](cmdform[v])) - end - end - io.write('
') +<% --[[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('
' .. cmdresult.label .. '
') - io.write('
' .. cmdresult.action.descr .. '
') - end - io.write('
') +<% if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("startstop") end %> -- cgit v1.2.3