summaryrefslogtreecommitdiffstats
path: root/lbu-commit-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'lbu-commit-html.lsp')
-rw-r--r--lbu-commit-html.lsp91
1 files changed, 55 insertions, 36 deletions
diff --git a/lbu-commit-html.lsp b/lbu-commit-html.lsp
index f86bef1..a23b907 100644
--- a/lbu-commit-html.lsp
+++ b/lbu-commit-html.lsp
@@ -1,53 +1,72 @@
-<? local view = ... ?>
-
-<h1>SYSTEM INFO</h1>
+<? 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>")
+--]]
+?>
+<?
+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>
- <dt>Program version</dt>
- <dd><?= view.status.version ?></dd>
-</dl>
+<H1>SYSTEM INFO</H1>
+<?
+local myform = form.status
+local tags = { "status", "version", }
+displayinfo(myform,tags,"viewonly")
+?>
<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
-<dl>
- <dt>Archives will be saved to</dt>
- <dd><?= view.status.LBU_MEDIA or "<p class=error>No default - (Needs to be configured)</p>" ?></DD>
- <dt>Archives will be encrypted</dt>
- <dd><? if (view.status.ENCRYPTION) then io.write("yes <I>(Using cipher: " .. view.status.DEFAULT_CIPHER .. ")</I>") else io.write("No") end ?></DD>
-</dl>
+<?
+local myform = form.status
+local tags = { "LBU_MEDIA", "ENCRYPTION", }
+displayinfo(myform,tags,"viewonly")
+?>
<H1>MANAGEMENT</H1>
-
<H2>Save to media</h2>
<form name="cmd" action="" method="POST">
-<dl>
- <dt>Simulate/Test a commit</dt>
- <dd><input type=submit class="submit" name="lbusimulate" value="simulate" ></dd>
- <dt>Actually Commit and save changes</dt>
- <dd><input type=submit class="submit" name="lbucommit" value="commit" ></dd>
-<? if (view.cmderror) and (view.cmderror["-d"]) then ?>
- <dt class=error>Remove existing apk.ovls from media</dt>
- <dd><input type="checkbox" class="checkbox" name="lbucleanmedia" >
-<p>By checking this box, you remove all existing archives from the <?= view.status.LBU_MEDIA ?> when commiting (adding the '-d' flag to the commit action).<br>This needs to be done when you want/dont want to encrypt your archive and there already exists archives on the media.<BR>There can only be one sort of arcive on the media.</p><p>If you dont remove existing apk.ovls from media, your commit will most likely fail.</p></dd>
-<? end ?>
-</dl>
+<?
+local tags = { "lbusimulate", "lbucommit", "lbucleanmedia", }
+displayinfo(myform,tags)
+?>
</form>
-
-
-
-<dl>
-<? if (view.cmdresult) then ?>
+<DL>
+<? if (form.cmdresult) then ?>
<dt>Result of previous action</dt>
- <dd><pre><?= view.cmdresult ?></pre></DD>
+ <dd><pre><?= form.cmdresult ?></pre></DD>
<? end ?>
-</dl>
+</DL>
<?
--[[ 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>")
--]]
?>