diff options
Diffstat (limited to 'snort-status-html.lsp')
-rw-r--r-- | snort-status-html.lsp | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/snort-status-html.lsp b/snort-status-html.lsp index 5c35e30..c7c8cef 100644 --- a/snort-status-html.lsp +++ b/snort-status-html.lsp @@ -1,17 +1,37 @@ <? local view = ... ?> -<h1>SYSTEM INFO</h1> - -<dl> -<dt>Program status</dt> -<DD><? if (view.status.enabled) then io.write('Enabled') else io.write('Disabled') end ?></DD> -</dl> - -<dl> -<dt>Program version</dt> -<dd><?= view.status.version ?></dd> -</dl> +<? +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 > 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 +end +?> +<H1>SYSTEM INFO</H1> +<DL> +<? +local myform = view.status +local tags = { "status", "version", } +displayinfo(myform,tags,"viewonly") +?> +</DL> <H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2> <DL> |