summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2007-12-06 07:14:37 +0000
committerMika Havela <mika.havela@gmail.com>2007-12-06 07:14:37 +0000
commit0475c30f9133a5835bc13dc784f03df0812bc483 (patch)
tree2fea2300fbff9f48480326874dcb0ed5bcc7e255
parent2b5a0f05362308d68c855425a682b4b532431c4c (diff)
downloadacf-openntpd-0475c30f9133a5835bc13dc784f03df0812bc483.tar.bz2
acf-openntpd-0475c30f9133a5835bc13dc784f03df0812bc483.tar.xz
Renamed files and deleted old files
git-svn-id: svn://svn.alpinelinux.org/acf/openntpd/trunk@414 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--openntpd-controller.lua62
-rw-r--r--openntpd-logfile-html.lsp21
-rw-r--r--openntpd-settings-html.lsp76
3 files changed, 97 insertions, 62 deletions
diff --git a/openntpd-controller.lua b/openntpd-controller.lua
deleted file mode 100644
index 9e520c6..0000000
--- a/openntpd-controller.lua
+++ /dev/null
@@ -1,62 +0,0 @@
-module (..., package.seeall)
-
--- Cause an http redirect to our "read" action
--- We use the self.conf table because it already has prefix,controller,etc
--- The redir code is defined in the application error handler (acf-controller)
-require("posix")
-local list_redir = function (self)
- self.conf.action = "read"
- self.conf.type = "redir"
- error (self.conf)
-end
-
-mvc={}
-mvc.on_load = function(self, parent)
- if (self.worker[self.conf.action] == nil ) or ( self.conf.action == "init" ) then
- self.worker[self.conf.action] = list_redir(self)
- end
-end
-
-
-settings = function (self)
- local cmd = self.clientdata.cmd
- local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller
- if ( cmd ~= nil ) then
- local startstop = self.model:startstop_service( cmd )
- posix.sleep(1) -- Wait for the process to start|stop
- local statusinfo = self.model:get()
- return ( {startstop = startstop, statusinfo = statusinfo, url = url } )
- else
- return ( {statusinfo = self.model:get(), startstop = "", url = url } )
- end
-end
-
-logfile = function (self)
- return ( {logfile = self.model:get_logfile(), url = url } )
-end
-
-read = function (self)
- local cmd = self.clientdata.cmd
- local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller
- return ( {statusinfo = self.model:get(), url = url } )
-end
-
-advanced = function (self)
- local filecontent = self.clientdata.modifications or ""
- local cmd = self.clientdata.cmd
- local url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller
-
- if ( filecontent ~= "") then
- local me = ( {filecontent = self.model:update_filecontent(filecontent), url = url } )
- return ( {startstop = "", statusinfo = self.model:get(), filecontent = self.model:get_filecontent(), url = url } )
- else
- if ( cmd ~= nil ) then
- local startstop = self.model:startstop_service( cmd )
- posix.sleep(1) -- Wait for the process to start|stop
- return ( {startstop = startstop, statusinfo = self.model:get(), filecontent = self.model:get_filecontent(), url = url } )
- else
- return ( {startstop = "", statusinfo = self.model:get(), filecontent = self.model:get_filecontent(), url = url } )
- end
- end
-end
-
diff --git a/openntpd-logfile-html.lsp b/openntpd-logfile-html.lsp
new file mode 100644
index 0000000..748bd09
--- /dev/null
+++ b/openntpd-logfile-html.lsp
@@ -0,0 +1,21 @@
+<? local view = ... ?>
+<html>
+<body>
+<h1>LOGFILE</h1>
+
+<h2>Details</h2>
+
+<dt>Logfile</dt>
+<dd><?= view.logfile.cmd ?></dd>
+
+<h2>Content</h2>
+<textarea name="" style="width:100%;height:450px;"><? io.write(view.logfile.value) ?></textarea>
+</body>
+</html>
+
+<?
+--[[ DEBUG INFORMATION
+require("debugs")
+io.write(debugs.variables(view))
+--]]
+?>
diff --git a/openntpd-settings-html.lsp b/openntpd-settings-html.lsp
new file mode 100644
index 0000000..f79da46
--- /dev/null
+++ b/openntpd-settings-html.lsp
@@ -0,0 +1,76 @@
+<? local view = ... ?>
+
+<h1>System time</h1>
+
+<h2>SYSTEM INFO</h2>
+
+<dt>Process status</dt>
+<dd><? io.write(view.statusinfo.status) ?><? if (view.startstop.status) then io.write(" (" .. view.startstop.status .. ")") end ?></dd>
+
+<dt>Start or stop process</dt>
+<dd><form name="start" action="" method="POST"><input type=submit name="cmd" value="start" style="width:100px"></form><form name="stop" action="" method="POST"><input type=submit name="cmd" value="stop" style="width:100px"></form></dd>
+
+
+<h2>NTPD SETTINGS</h2>
+
+<? --[[ FIXME!!! ?>
+<dt>Set time immediately at startup</dt>
+<dd><input type="checkbox" name=""></dd>
+
+<dt>Save the above settings</dt>
+<dd><input type="submit" value="Save"> (see above)</dd>
+<? --]] ?>
+
+<h3>'SET TIME' OPTIONS</h3>
+
+<dt>Timeserver hosts...</dt>
+<dd>
+<select name="" size="3" style="width:200px;">
+<? if (view.statusinfo.servers) then
+for i = 1, table.maxn(view.statusinfo.servers) do ?>
+ <option name="<? io.write(view.statusinfo.servers[i].value) ?>"><? io.write(view.statusinfo.servers[i].value) ?></option>
+<? end end ?>
+<? if (view.statusinfo.server) then
+for i = 1, table.maxn(view.statusinfo.server) do ?>
+ <option name="<? io.write(view.statusinfo.server[i].value) ?>"><? io.write(view.statusinfo.server[i].value) ?></option>
+<? end end ?>
+</select><BR>
+In most cases you could use <i><b>pool.ntp.org</b></i> or<br><i><b>[countryname].pool.ntp.org</i></b> (if listed in <i><b>http://www.pool.ntp.org/</b></i>).
+</dd>
+
+<? ---[[ FIXME!!! ?>
+<dt>Delete selected host</dt>
+<dd><input type="submit" value="Delete"> (see above)</dd>
+
+<dt>Add new host</dt>
+<dd><input type="text" name="" value=""> <input type="submit" value="Add"></dd>
+<? --]] ?>
+
+<h3>'PRESENT TIME' OPTIONS (ACT AS TIME SERVER)</h3>
+<dt>Listen on address...</dt>
+<dd>
+<select name="" size="3" style="width:200px;">
+<? if (view.statusinfo.listen) then
+for i = 1, table.maxn(view.statusinfo.listen) do ?>
+ <option name="<? io.write(view.statusinfo.listen[i].value) ?>"><? io.write(view.statusinfo.listen[i].value) ?></option>
+<? end end ?>
+</select><BR>Empty list = Listening (acting as server) is disabled<br>"*" = Listen on all local addresses
+</dd>
+
+<? ---[[ FIXME!!! ?>
+<dt>Delete selected address</dt>
+<dd><input type="submit" value="Delete"> (see above)</dd>
+
+
+<dt>Add new listen address</dt>
+<dd><input type="text" name="" value=""> <input type="submit" value="Add"></dd>
+<? --]] ?>
+
+
+
+<?
+--[[ DEBUG INFORMATION
+require("debugs")
+io.write(debugs.variables(view))
+--]]
+?>