diff options
Diffstat (limited to 'syslog-expert-html.lsp')
-rw-r--r-- | syslog-expert-html.lsp | 109 |
1 files changed, 24 insertions, 85 deletions
diff --git a/syslog-expert-html.lsp b/syslog-expert-html.lsp index 2b1f238..37e1a4f 100644 --- a/syslog-expert-html.lsp +++ b/syslog-expert-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>") @@ -6,103 +7,41 @@ io.write(html.cfe_unpack(form)) 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) -?> +<? ---[[ ?> +<? if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("basicstatus") +end ?> +<? --]] ?> <H1>CONFIGURATION</H1> -<? local myform = form.config ?> -<form action="<?= form.option.script .. "/" .. form.option.prefix .. - form.option.controller .. "/" .. form.option.action ?>" method="POST"> - <H2>EXPERT CONFIGURATION</H2> <H3>FILE DETAILS</H3> +<DL> <? -local tags = { "filename", "filesize", "mtime", "sumerrors" } -informationform(myform,tags) +displayitem(form.value.filename) +displayitem(form.value.filesize) +displayitem(form.value.mtime) ?> +</DL> <H3>FILE CONTENT</H3> -<? -io.write(html.form[form.config.filecontent.type](form.config.filecontent)) -?> +<? 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"> +<textarea name="filecontent"> +<?= form.value.filecontent.value ?> +</textarea> <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 -?> - <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 ?> +<? ---[[ ?> +<? if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("startstop") +end ?> +<? --]] ?> <? --[[ DEBUG INFORMATION |