diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Makefile | 4 | ||||
-rw-r--r-- | app/logfiles/logfiles-controller.lua | 33 | ||||
-rw-r--r-- | app/logfiles/logfiles-model.lua | 22 | ||||
-rw-r--r-- | app/logfiles/logfiles-read-html.lsp | 8 | ||||
-rw-r--r-- | app/logfiles/logfiles.menu | 2 | ||||
-rw-r--r-- | app/menuhints.menu | 12 |
6 files changed, 79 insertions, 2 deletions
diff --git a/app/Makefile b/app/Makefile index 4c12bea..0a05980 100644 --- a/app/Makefile +++ b/app/Makefile @@ -15,6 +15,10 @@ APP_DIST= acf-util/logon-controller.lua\ welcome-controller.lua\ welcome-html.lsp\ welcome.menu\ + logfiles/logfiles-controller.lua\ + logfiles/logfiles-model.lua\ + logfiles/logfiles-read-html.lsp\ + logfiles/logfiles.menu\ EXTRA_DIST=README Makefile DISTFILES=$(APP_DIST) $(EXTRA_DIST) diff --git a/app/logfiles/logfiles-controller.lua b/app/logfiles/logfiles-controller.lua new file mode 100644 index 0000000..1770754 --- /dev/null +++ b/app/logfiles/logfiles-controller.lua @@ -0,0 +1,33 @@ +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) +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 + +-- Public methods + +read = function (self ) + return ({logfile = self.model:get("/var/log/mini_httpd.log")} ) +end + +--update = function (self) +-- return nil +--end + +--delete = function (self) +-- return nil +--end + +--create = update diff --git a/app/logfiles/logfiles-model.lua b/app/logfiles/logfiles-model.lua new file mode 100644 index 0000000..6198107 --- /dev/null +++ b/app/logfiles/logfiles-model.lua @@ -0,0 +1,22 @@ +module (..., package.seeall) + +-- no initializer in model - use controller.init for that + +local function read_file ( path ) + local file = io.open(path) + if ( file ) then + local f = file:read("*a") or "unknown" + file:close() + return f + else + return "Cant find '" .. path .. "'" + end +end + +get = function (self,path) + local file_content = {} + file_content = cfe{value=read_file(path), name=path} + file_name = cfe{value=path, name=file_name} + return file_content, file_name +end + diff --git a/app/logfiles/logfiles-read-html.lsp b/app/logfiles/logfiles-read-html.lsp new file mode 100644 index 0000000..b8864f8 --- /dev/null +++ b/app/logfiles/logfiles-read-html.lsp @@ -0,0 +1,8 @@ +<? local view = ... ?> +<html> +<body> +<h1>Logfile</h1> +<dt><?= view.logfile.name ?></dt> +<dd><textarea name="<?= view.logfile.name ?>"><?= view.logfile.value ?></textarea></dd> +</body> +</html> diff --git a/app/logfiles/logfiles.menu b/app/logfiles/logfiles.menu new file mode 100644 index 0000000..f775cfc --- /dev/null +++ b/app/logfiles/logfiles.menu @@ -0,0 +1,2 @@ +#CAT GROUP/DESC TAB ACTION +General Logfiles dlogfiles read diff --git a/app/menuhints.menu b/app/menuhints.menu index 5d36abb..f145b1f 100644 --- a/app/menuhints.menu +++ b/app/menuhints.menu @@ -4,5 +4,13 @@ # That number will override the defaults set here. # (i.e. Lowest specifically set priority wins) 10Home -80Setup -100Test + +20Networking +30Proxies +40Connectivity +50Backup/Packages +60General + +100Setup +110Test + |