From f9a09e6fe4d8bd7743a7530d9ef3e848f5a373fe Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Mon, 3 Aug 2015 15:54:48 +0000 Subject: Modify logfile to use common view --- vlc-controller.lua | 2 +- vlc-logfile-html.lsp | 7 +------ vlc-model.lua | 13 +++++++------ 3 files changed, 9 insertions(+), 13 deletions(-) mode change 100644 => 120000 vlc-logfile-html.lsp diff --git a/vlc-controller.lua b/vlc-controller.lua index 3799d8e..f42d7a2 100644 --- a/vlc-controller.lua +++ b/vlc-controller.lua @@ -20,7 +20,7 @@ function mymodule.expert(self) end function mymodule.logfile(self) - return self.model.getlogfile() + return self.model.get_logfile(self, self.clientdata) end return mymodule diff --git a/vlc-logfile-html.lsp b/vlc-logfile-html.lsp deleted file mode 100644 index 16c583a..0000000 --- a/vlc-logfile-html.lsp +++ /dev/null @@ -1,6 +0,0 @@ -<% local data, viewlibrary = ... -%> - -<% if viewlibrary and viewlibrary.dispatch_component then - viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename=data.value}) -end %> diff --git a/vlc-logfile-html.lsp b/vlc-logfile-html.lsp new file mode 120000 index 0000000..ac8854f --- /dev/null +++ b/vlc-logfile-html.lsp @@ -0,0 +1 @@ +../logfile-html.lsp \ No newline at end of file diff --git a/vlc-model.lua b/vlc-model.lua index 5a8da68..abad8a9 100644 --- a/vlc-model.lua +++ b/vlc-model.lua @@ -41,16 +41,17 @@ function mymodule.getconfigfile() return modelfunctions.getfiledetails(configfile) end -function mymodule.getlogfile () - local path=logfile - local path2 +function mymodule.get_logfile(self, clientdata) + local retval = cfe({ type="group", value={}, label="Log File Configuration" }) + retval.value.filename = cfe({value=logfile, label="File name"}) + local path if fs.is_file(configfile) then for line in string.gmatch(fs.read_file(configfile) or "", "(.-)\n") do - path2=string.match(line,"^VLC_OPTS.*--logfile%s+(%S+)") or path2 + path=string.match(line,"^VLC_OPTS.*--logfile%s+(%S+)") or path end end - if path2 then path=path2 end - return cfe({ value=path, label="VLC logfile" }) + if path then retval.value.filename.value = path end + return retval end function mymodule.setconfigfile(self, filedetails) -- cgit v1.2.3