summaryrefslogtreecommitdiffstats
path: root/syslog-config-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-05-13 20:02:56 +0000
committerTed Trask <ttrask01@yahoo.com>2008-05-13 20:02:56 +0000
commit4b82433c8a6149f14e24bdca209bfcf54cedbaa3 (patch)
treeac5cb1d808f96ad7cded6c9ae0a73df9bd3989d5 /syslog-config-html.lsp
parent4d05e67ca4d9e29cea6fc3390a700b237a20d31e (diff)
downloadacf-alpine-baselayout-4b82433c8a6149f14e24bdca209bfcf54cedbaa3.tar.bz2
acf-alpine-baselayout-4b82433c8a6149f14e24bdca209bfcf54cedbaa3.tar.xz
Rewrote syslog to use components and remove view-specific code from controller.
Also made sure not to write to conf file unless all variables pass validation. git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1116 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'syslog-config-html.lsp')
-rw-r--r--syslog-config-html.lsp132
1 files changed, 30 insertions, 102 deletions
diff --git a/syslog-config-html.lsp b/syslog-config-html.lsp
index ff068e1..ac5b77e 100644
--- a/syslog-config-html.lsp
+++ b/syslog-config-html.lsp
@@ -1,4 +1,5 @@
-<? local form = ... ?>
+<? local form, viewlibrary = ... ?>
+<? require("viewfunctions") ?>
<?
--[[ DEBUG INFORMATION
io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
@@ -7,119 +8,49 @@ io.write("</span>")
--]]
?>
-<?
-function informationform(myform,tags)
- io.write("<DL>")
- for k,v in pairs(tags) do
- if (myform[v]) then
- local val = myform[v]
- io.write("\t<DT")
- if (val.errtxt) then io.write(" class='error'") end
- io.write(">" .. val.label .. "</DT>\n")
-
- io.write("\t\t<DD>" .. val.value .. "\n")
- 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
- io.write("</DL>")
-end
-?>
-<?
-function configform(myform,tags)
- io.write("<DL>")
- for k,v in pairs(tags) do
- if (myform[v]) then
- local val = myform[v]
- io.write("\t<DT")
- if (val.errtxt) then io.write(" class='error'") end
- io.write(">" .. val.label .. "</DT>\n")
-
- io.write("\t\t<DD>" .. html.form[val.type](val) .. "\n")
- 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
- io.write("</DL>")
-end
-?>
-
-<H1>SYSTEM INFO</H1>
-<?
-local myform = form.status
-local tags = { "status", "version", }
-informationform(myform,tags)
-?>
-
-<H1>CONFIGURATION</H1>
-<? local myform = form.config ?>
-<form action="<?= form.option.script .. "/" .. form.option.prefix ..
- form.option.controller .. "/" .. form.option.action ?>" method="POST">
-
-<? --[[ ?>
-<H2>GUIDED CONFIGURATION</H2>
-<H3>REMOTE LOGGING</H3>
-<?
-local tags = { "remotelogging", }
-configform(myform,tags)
-?>
+<? ---[[ ?>
+<? if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("basicstatus")
+end ?>
<? --]] ?>
-<? ---[[ ?>
+<H1>CONFIGURATION</H1>
+<? if form.descr then ?><P CLASS='descr'><?= string.gsub(form.descr, "\n", "<BR>") ?></P><? end ?>
+<? if form.errtxt then ?><P CLASS='error'><?= string.gsub(form.errtxt, "\n", "<BR>") ?></P><? end ?>
+<form action="" method="POST">
<H2>ADVANCED CONFIGURATION</H2>
<H3>GENERAL</H3>
+<DL>
<?
-local tags = { "logfile", "loglevel", "smallerlogs", }
-configform(myform,tags)
+ displayformitem(form.value.logfile, "logfile")
+ displayformitem(form.value.loglevel, "loglevel")
+ displayformitem(form.value.smallerlogs, "smallerlogs")
?>
-
+</DL>
<H3>LOGROTATE</H3>
-<?
-local tags = { "maxsize", "numrotate", }
-configform(myform,tags)
+<DL>
+<?
+ displayformitem(form.value.maxsize, "maxsize")
+ displayformitem(form.value.numrotate, "numrotate")
?>
-
+</DL>
<H3>REMOTE LOGGING</H3>
+<DL>
<?
-local tags = { "localandnetworklog", "remotelogging", }
-configform(myform,tags)
+ displayformitem(form.value.localandnetworklog, "localandnetworklog")
+ displayformitem(form.value.remotelogging, "remotelogging")
?>
-<? --]] ?>
-
+</DL>
<H2>SAVE AND APPLY ABOVE SETTINGS</H2>
-<?
-local tags = { "cmdsave", }
-configform(myform,tags)
-?>
+<DL><DT>Save/Apply above settings</DT><DD><input class="submit" type="submit" name="save" value="Save"></DD></DL>
</form>
-<?
-local cmdform = form.management
-local tags = { "start", "stop", "restart" }
-if (cmdform) and (cmdform[tags[1]]) then
+<? ---[[ ?>
+<? if viewlibrary and viewlibrary.dispatch_component then
+ viewlibrary.dispatch_component("startstop")
+end
?>
- <form name="management" action="" method="POST">
- <H1>MANAGEMENT</H1>
- <dl>
- <dt><?= cmdform[tags[1]]["label"] ?></dt>
- <dd>
- <? for k,v in pairs(tags) do ?>
- <? if (cmdform[v]) then ?>
- <? io.write(html.form[cmdform[v].type](cmdform[v])) ?>
- <? end ?>
- <? end ?>
- </dd>
-
- <? if (form.cmdmanagement) and (#form.cmdmanagement.descr > 0) then ?>
- <dt>Previous action result</dt>
- <dd><pre><?= form.cmdmanagement.descr ?></pre></dd>
- <? end ?>
- </dl>
- </form>
-
-<? end ?>
+<? --]] ?>
<?
--[[ DEBUG INFORMATION
@@ -128,6 +59,3 @@ io.write(html.cfe_unpack(form))
io.write("</span>")
--]]
?>
-
-
-