summaryrefslogtreecommitdiffstats
path: root/lbu-config-html.lsp
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-02-14 15:33:20 +0000
committerMika Havela <mika.havela@gmail.com>2008-02-14 15:33:20 +0000
commit422d93b32eb1c30d9a684146d258ed01ab99a850 (patch)
tree244d6fee9337f1e7e0843b405946d6cf2eb3882d /lbu-config-html.lsp
parent0201f4b56d290494cf5d01756670ae16b2e38936 (diff)
downloadacf-alpine-conf-422d93b32eb1c30d9a684146d258ed01ab99a850.tar.bz2
acf-alpine-conf-422d93b32eb1c30d9a684146d258ed01ab99a850.tar.xz
Rebuilt LBU so it uses cfe instead.v0.2
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-conf/trunk@719 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lbu-config-html.lsp')
-rw-r--r--lbu-config-html.lsp136
1 files changed, 68 insertions, 68 deletions
diff --git a/lbu-config-html.lsp b/lbu-config-html.lsp
index 13e94c3..22c1405 100644
--- a/lbu-config-html.lsp
+++ b/lbu-config-html.lsp
@@ -1,85 +1,85 @@
-<? 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")
+?>
<H1>CONFIG</H1>
<form name="config" action="" method="POST">
<H2>Advanced config</H2>
<H3>Storage media</H3>
-<dl>
- <dt <? if (view.errors) and (view.errors.LBU_MEDIA) then io.write("class='error'") end ?>>Default media for commit</dt>
- <dd><select name="LBU_MEDIA" size="1">
- <? if (view.config.LBU_MEDIA == "") then io.write("<option value='' selected='selected'>No default</option>") end ?>
- <? for i=1, table.maxn(view.config.LBU_MEDIA_LIST) do ?>
- <option value="<?= view.config.LBU_MEDIA_LIST[i]["value"] ?>"
- <? if (string.lower(view.config.LBU_MEDIA_LIST[i]["value"]) == string.lower(view.config.LBU_MEDIA or "")) then io.write("selected='selected'") end?>>
- <?= view.config.LBU_MEDIA_LIST[i]["name"] ?></option>
- <? end ?>
- </select>
- <p class=error><?= view.errors.LBU_MEDIA or "" ?></p></dd>
-</dl>
+<?
+local myform = form.config
+local tags = { "LBU_MEDIA", }
+displayinfo(myform,tags)
+?>
-<H3>Include/exclude list</H3>
-<dl>
- <dt>Included item(s)</dt>
- <dd><select name="lbu_included" size="3">
- <? for i=1, table.maxn(view.config.lbu_included or {}) do ?>
- <option value="<?= view.config.lbu_included[i] ?>"><?= view.config.lbu_included[i] ?></option>
- <? end ?>
- </select></dd>
- <dt>Delete selected include-item</dt>
- <dd><input name="cmd_delete_included" class="submit" type="submit" value="Delete" > (see above)</dd>
- <dt>Add item to inlude list</dt>
- <dd><input type="text" name="item_add_include" class="text" value="">
- <input name="cmd_add_include" class="submit" type="submit" value="Add"></dd>
- <dt>Excluded item(s)</dt>
- <dd><select name="lbu_excluded" size="3">
- <? for i=1, table.maxn(view.config.lbu_excluded or {}) do ?>
- <option value="<?= view.config.lbu_excluded[i] ?>"><?= view.config.lbu_excluded[i] ?></option>
- <? end ?>
- </select></dd>
- <dt>Delete selected exclude-item</dt>
- <dd><input name="cmd_delete_excluded" class="submit" type="submit" value="Delete" > (see above)</dd>
- <dt>Add item to exclude list</dt>
- <dd><input type="text" name="item_add_exclude" class="text" value="">
- <input name="cmd_add_exclude" class="submit" type="submit" value="Add"></dd>
-</dl>
+<H3>Included list</H3>
+<?
+local tags = { "lbu_included","cmd_delete_included", "item_add_included", "cmd_add_included", }
+displayinfo(myform,tags)
+?>
+
+<H3>Excluded list</H3>
+<?
+local tags = { "lbu_excluded","cmd_delete_excluded", "item_add_excluded", "cmd_add_excluded", }
+displayinfo(myform,tags)
+?>
<H3>Security/Encryption</H3>
-<dl>
- <dt>Password protected commits</dt>
- <dd><input type="checkbox" name="ENCRYPTION" <? if (view.config.ENCRYPTION) then io.write("checked=yes") end ?>></dd>
- <dt>Cipher to use at encryption</dt>
- <dd><select name="DEFAULT_CIPHER" size="1">
- <? if (view.config.DEFAULT_CIPHER == "") then io.write("<option value='' selected='selected'>No default</option>") end ?>
- <? for i=1, table.maxn(view.config.DEFAULT_CIPHER_LIST) do ?>
- <option value="<?= view.config.DEFAULT_CIPHER_LIST[i] ?>" <? if (string.lower(view.config.DEFAULT_CIPHER_LIST[i]) == string.lower(view.config.DEFAULT_CIPHER)) then io.write("selected='selected'") end?>><?= view.config.DEFAULT_CIPHER_LIST[i] ?></option>
- <? end ?>
- </select></dd>
- <dt <? if (view.errors) and (view.errors.PASSWORD) then io.write("class='error'") end ?>>Password when encrypting</dt>
- <dd><input type="text" class="text" value="<?= view.config.PASSWORD or "" ?>" name="PASSWORD">
- <p class=error><?= view.errors.PASSWORD or "" ?></p></dd>
-</dl>
+<?
+local tags = { "ENCRYPTION", "DEFAULT_CIPHER", "PASSWORD", }
+displayinfo(myform,tags)
+?>
<H2>Save and apply above settings</H2>
-<DL>
- <DT>Apply settings</DT>
- <DD><input class="submit" name="config_submit" type="submit" value="Apply" /></DD>
-</DL>
+<?
+local tags = { "config_submit" }
+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>")
--]]
?>
-
-<? -- vim: set filetype=lua : ?>