summaryrefslogtreecommitdiffstats
path: root/lbu-expert-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-expert-html.lsp')
-rw-r--r--lbu-expert-html.lsp83
1 files changed, 57 insertions, 26 deletions
diff --git a/lbu-expert-html.lsp b/lbu-expert-html.lsp
index 29c3bdd..cea7e4c 100644
--- a/lbu-expert-html.lsp
+++ b/lbu-expert-html.lsp
@@ -1,45 +1,76 @@
-<? local view = ... ?>
+<? local form = ... ?>
+<?
+--[[ DEBUG INFORMATION
+io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
+io.write(html.cfe_unpack(form))
+io.write("</span>")
+--]]
+?>
-<h1>SYSTEM INFO</h1>
+<?
+function displayinfo(myform,tags,viewonly)
+ io.write("<DL>")
+ 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
+ io.write("</DL>")
+end
+?>
-<DL>
- <dt>Program status</dt>
- <dd><?= view.status.status or "" ?></dd>
+<H1>SYSTEM INFO</H1>
+<?
+local myform = form.status
+local tags = { "status", "version", }
+displayinfo(myform,tags,"viewonly")
+?>
- <dt>Program version</dt>
- <dd><?= view.status.version ?></dd>
-</DL>
<h1>CONFIGURATION</h1>
<H2>Expert config</H2>
<h3>File details</h3>
-<DL>
- <dt>File name</dt>
- <dd><?= view.file.details.path ?></dd>
-
- <dt>File size</dt>
- <dd><?= view.file.details.size ?></dd>
+<?
+local myform = form.file
+local tags = { "name", "size", "mtime", }
+displayinfo(myform,tags,"viewonly")
+?>
- <dt>Last modified</dt>
- <dd><?= view.file.details.mtime ?></dd>
-</DL>
<h3>File content</h3>
-
<form name="myform" action="" method="POST">
-<input name="name" type=hidden value="">
-<textarea name="modifications"><?= view.file.content ?></textarea>
+<?
+local myform = form.file.modifications
+io.write(html.form[myform.type](myform))
+?>
<H2>Save and apply above settings</H2>
-<DL>
- <DT>Apply settings</DT>
- <DD><input class="submit" type="submit" name="cmdsave" value="Apply"/></DD>
-</DL>
+<?
+local myform = form.file
+local tags = { "cmdsave", }
+displayinfo(myform,tags)
+?>
+</form>
<?
--[[ DEBUG INFORMATION
-require("debugs")
-io.write(debugs.variables(view))
+io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
+io.write(html.cfe_unpack(form))
+io.write("</span>")
--]]
?>