summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-01-09 16:55:59 +0000
committerMika Havela <mika.havela@gmail.com>2008-01-09 16:55:59 +0000
commitd20181da4d975c5d8649f65ce7f33baef23907f2 (patch)
treef17f14d74bcd02b7fa5a6f374f5504feced581ed
parent9ad995cea4060451485664a102657dfe82258dc8 (diff)
downloadacf-alpine-baselayout-d20181da4d975c5d8649f65ce7f33baef23907f2.tar.bz2
acf-alpine-baselayout-d20181da4d975c5d8649f65ce7f33baef23907f2.tar.xz
Trying to figure out what to show and how
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@521 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--syslog-config-html.lsp70
-rw-r--r--syslog-controller.lua8
-rw-r--r--syslog-expert-html.lsp63
-rw-r--r--syslog-model.lua5
-rw-r--r--syslog-status-html.lsp28
-rw-r--r--syslog-superexpert-html.lsp23
6 files changed, 105 insertions, 92 deletions
diff --git a/syslog-config-html.lsp b/syslog-config-html.lsp
index b32d323..9ef330a 100644
--- a/syslog-config-html.lsp
+++ b/syslog-config-html.lsp
@@ -1,71 +1,25 @@
-<? view = ... ?>
-<h1>System logging</h1>
-<h2>System info</h2>
-<form>
-<DT>Process status</DT>
-<DD><?= view.status.status ?></DD>
+<? local view = ... ?>
-<DT>Daemon control</DT>
-<dd><form action="" method="POST">
-<input type=submit name="srvcmd" value="start" class="submit">
-<input type=submit name="srvcmd" value="stop" class="submit">
-<input type=submit name="srvcmd" value="restart" class="submit"></form>
-</dd>
+<h1>CONFIGURATION</h1>
-<? if (view.srvcmdresult) then ?>
-<dt>Previous action</dt>
-<dd><pre><?= view.srvcmdresult ?></pre></dd>
-<? end ?>
+<H2>Enable/Disable</H2>
+<DT>Change status for this program</DT>
+<DD><input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>Enable
+<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>Disable</DD>
-<H2>Configuration</H2>
+<H2>Guided setup</H2>
-<H3>General settings</H3>
-<DT>Log to given file</DT>
-<DD><input type="text" class="text" name="smallerlogg" value="<?= view.config.logfile ?>"/>
-<P>(default=/var/log/messages)</P></DD>
-
-<DT>Set local log level</DT>
-<DD><input class="radio" type="radio" name="loglevel" value="1" <? if (tostring(view.config.loglevel) == "1") then io.write('checked') end ?>>1
-<input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>2
-<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>3
-<input class="radio" type="radio" name="loglevel" value="4" <? if (tostring(view.config.loglevel) == "4") then io.write('checked') end ?>>4
-<input class="radio" type="radio" name="loglevel" value="5" <? if (tostring(view.config.loglevel) == "5") then io.write('checked') end ?>>5
-<input class="radio" type="radio" name="loglevel" value="" <? if (tostring(view.config.loglevel) == "") then io.write('checked') end ?>>Default
-<p>(1=Quiet, 5=Noisy, Default=Not specifyed any loglevel in the config)</P>
-</DD>
+<H3>Remote logging</H3>
-<DT>Smaller logging output</DT>
+<DT>Activate remote logging</DT>
<DD><input type="checkbox" name="smallog" <? if (view.config.smallog) then io.write('checked') end ?>/></DD>
-<H3>Save logs for a longer period</H3>
-<DT>Max size (KB) before rotate</DT>
-<DD><input type="text" class="text" name="maxsize" value="<?= view.config.maxsize ?>"/>
-<p>(default=200KB, 0=off)</p>
-</DD>
-
-<DT>Number of rotated logs to keep</DT>
-<DD><input type="text" class="text" name="logrotate" value="<?= view.config.logrotate ?>"/>
-<p>(default=1, max=99, 0=purge)</p>
-</DD>
-
-<H3>Remote logging</H3>
-
<DT>Log to IP or hostname on PORT</DT>
<DD><input type="text" class="text" name="host" value="<?= view.config.remote ?>"/>
<P>(default PORT=514/UDP)</P></DD>
-<H2>Save above settings</H2>
-<DT>Save settings</DT>
-<DD><input class="submit" type="submit" value="Save"/></DD>
-
-</form>
-
-<?
---[[ DEBUG INFORMATION
-view = ...
-require("debugs")
-io.write(debugs.variables(view))
---]]
-?>
+<H2>Save and apply above settings</H2>
+<DT>Apply settings</DT>
+<DD><input class="submit" type="submit" value="Apply"/></DD>
diff --git a/syslog-controller.lua b/syslog-controller.lua
index 8869fec..65034ca 100644
--- a/syslog-controller.lua
+++ b/syslog-controller.lua
@@ -6,7 +6,7 @@ end
function status(self)
- return self.model.getstatus()
+ return { status=self.model.getstatus() }
end
function config(self)
@@ -24,7 +24,7 @@ function config(self)
return { status = self.model.getstatus(), srvcmdresult=srvcmdresult, config= self.model.getconfig() }
end
-function expert(self)
- return {status="Work in progress!"}
-end
+expert = config
+
+superexpert = expert
diff --git a/syslog-expert-html.lsp b/syslog-expert-html.lsp
index fb43eae..c8f5570 100644
--- a/syslog-expert-html.lsp
+++ b/syslog-expert-html.lsp
@@ -1,12 +1,51 @@
-<? ctl = ... ?>
-<h1>System logging</h1>
-<h2>Status</h2>
-<P>WORK IN PROGRESS!!!</P>
-
-<?
---[[ DEBUG INFORMATION
-view = ...
-require("debugs")
-io.write(debugs.variables(view))
---]]
-?>
+<? local view = ... ?>
+
+<h1>CONFIGURATION</h1>
+
+<H2>Enable/Disable</H2>
+<DT>Change status for this program</DT>
+<DD><input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>Enable
+<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>Disable</DD>
+
+<H2>Expert config</H2>
+<H3>General settings</H3>
+
+<DT>Log to given file</DT>
+<DD><input type="text" class="text" name="smallerlogg" value="<?= view.config.logfile ?>"/>
+<P>(default=/var/log/messages)</P></DD>
+
+<DT>Set local log level</DT>
+<DD><input class="radio" type="radio" name="loglevel" value="1" <? if (tostring(view.config.loglevel) == "1") then io.write('checked') end ?>>1
+<input class="radio" type="radio" name="loglevel" value="2" <? if (tostring(view.config.loglevel) == "2") then io.write('checked') end ?>>2
+<input class="radio" type="radio" name="loglevel" value="3" <? if (tostring(view.config.loglevel) == "3") then io.write('checked') end ?>>3
+<input class="radio" type="radio" name="loglevel" value="4" <? if (tostring(view.config.loglevel) == "4") then io.write('checked') end ?>>4
+<input class="radio" type="radio" name="loglevel" value="5" <? if (tostring(view.config.loglevel) == "5") then io.write('checked') end ?>>5
+<input class="radio" type="radio" name="loglevel" value="" <? if (tostring(view.config.loglevel) == "") then io.write('checked') end ?>>Default
+<p>(1=Quiet, 5=Noisy, Default=Not specifyed any loglevel in the config)</P>
+</DD>
+
+<DT>Smaller logging output</DT>
+<DD><input type="checkbox" name="smallog" <? if (view.config.smallog) then io.write('checked') end ?>/></DD>
+
+<H3>Save logs for a longer period</H3>
+<DT>Max size (KB) before rotate</DT>
+<DD><input type="text" class="text" name="maxsize" value="<?= view.config.maxsize ?>"/>
+<p>(default=200KB, 0=off)</p>
+</DD>
+
+<DT>Number of rotated logs to keep</DT>
+<DD><input type="text" class="text" name="logrotate" value="<?= view.config.logrotate ?>"/>
+<p>(default=1, max=99, 0=purge)</p>
+</DD>
+
+<H3>Remote logging</H3>
+
+<DT>Log to IP or hostname on PORT</DT>
+<DD><input type="text" class="text" name="host" value="<?= view.config.remote ?>"/>
+<P>(default PORT=514/UDP)</P></DD>
+
+<H2>Save and apply above settings</H2>
+<DT>Apply settings</DT>
+<DD><input class="submit" type="submit" value="Apply"/></DD>
+
+
diff --git a/syslog-model.lua b/syslog-model.lua
index 3413ccd..59747d1 100644
--- a/syslog-model.lua
+++ b/syslog-model.lua
@@ -39,8 +39,9 @@ local function readopts(optname)
local optstr = string.match(line, "^" .. optname .. "=\"?(.*)\"?")
if optstr then
local t = {}
- for k, v in string.gmatch(optstr, "(-%S+)%s+(%S+)") do
- opts[k] = v
+ for k, v in string.gmatch(optstr, "(%C*)") do
+-- for k, v in string.gmatch(optstr, "(-%S+)%s+(%S+)") do
+ opts[k] = optstr
end
end
end
diff --git a/syslog-status-html.lsp b/syslog-status-html.lsp
index 62d497f..1192c49 100644
--- a/syslog-status-html.lsp
+++ b/syslog-status-html.lsp
@@ -1,30 +1,26 @@
<? local view = ... ?>
-<h1>System logging</h1>
+<h1>SYSTEM INFO</h1>
<h2>SYSTEM INFO</h2>
-<dt>Program version</dt>
-<dd><?= view.version ?></dd>
-
<dt>Process status</dt>
-<dd><?= view.status ?></dd>
+<dd><?= view.status.status ?></dd>
+
+<dt>Program version</dt>
+<dd><?= view.status.version ?></dd>
-<? if (view.logfile) then ?>
+<H3>GENERAL CONFIGURATIONS</H3>
+<? if (view.status.logfile) then ?>
<dt>Logfile</dt>
-<dd><?= view.logfile ?></dd>
+<dd><?= view.status.logfile ?></dd>
<? end ?>
-<? if (view.remote) then ?>
+<? if (view.status.remote) then ?>
<dt>Remote logging to</dt>
-<dd><?= view.remote ?></dd>
+<dd><?= view.status.remote ?></dd>
<? end ?>
-<?
---[[ DEBUG INFORMATION
-view = ...
-require("debugs")
-io.write(debugs.variables(view))
---]]
-?>
+
+
diff --git a/syslog-superexpert-html.lsp b/syslog-superexpert-html.lsp
new file mode 100644
index 0000000..cac5f57
--- /dev/null
+++ b/syslog-superexpert-html.lsp
@@ -0,0 +1,23 @@
+<? local view = ... ?>
+
+<h1>EDIT CONFIGURATION</h1>
+
+<h2>File details</h2>
+
+<dt>File name</dt>
+<dd>/etc/conf.d/syslogd</dd>
+
+<dt>File size</dt>
+<dd>60</dd>
+
+<dt>Last modified</dt>
+<dd>Mon Aug 20 16:58:19 2007</dd>
+
+<h3>File content</h3>
+
+<form name="myform" action="" method="POST">
+<input name="name" type=hidden value="">
+<textarea name="modifications"></textarea>
+
+<input type="submit" name="cmd" value="Apply" class="submit"><p class="error"></p></form>
+