From d6e8f214d59c9f70cd6c53cf82c9977328705245 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 17 Apr 2014 00:43:17 +0000 Subject: Changes to use new htmlviewfunctions functions and standardize logfile viewer This closes a bug where log filename was not validated --- vlc-controller.lua | 3 +-- vlc-logfile-html.lsp | 48 ++++-------------------------------------------- vlc-model.lua | 4 ++-- 3 files changed, 7 insertions(+), 48 deletions(-) diff --git a/vlc-controller.lua b/vlc-controller.lua index ddfef2d..3799d8e 100644 --- a/vlc-controller.lua +++ b/vlc-controller.lua @@ -20,8 +20,7 @@ function mymodule.expert(self) end function mymodule.logfile(self) - return self.model.get_filedetails(self.clientdata.name or "", self.clientdata.grep) - + return self.model.getlogfile() end return mymodule diff --git a/vlc-logfile-html.lsp b/vlc-logfile-html.lsp index 78baaa5..16c583a 100644 --- a/vlc-logfile-html.lsp +++ b/vlc-logfile-html.lsp @@ -1,46 +1,6 @@ -<% local form, viewlibrary, page_info = ... %> -<% htmlviewfunctions = require("htmlviewfunctions") %> -<% html = require("acf.html") %> - -

Logfile

-

File Details

-<% -htmlviewfunctions.displayitem(form.value.filename) -htmlviewfunctions.displayitem(form.value.filesize) -htmlviewfunctions.displayitem(form.value.mtime) ---if form.value.grep.value ~= "" then --- htmlviewfunctions.displayitem(form.value.grep) ---end +<% local data, viewlibrary = ... %> -

File Content

-<% if form.type == "form" then %> -<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> -<% htmlviewfunctions.displayformstart(form) %> - -<% end %> - -<% if form.value.filecontent.errtxt then %>

<%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "
") %>

<% end %> -<% if form.value.filecontent.descr then %>

<%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "
") %>

<% end %> - -<% if form.type == "form" then %> -<% htmlviewfunctions.displayformend(form) %> -<% end %> - - -<% ---[[ -print("

Debug info for page '"..tostring(page_info.action).."'

") ---form["value"]["filecontent"]["value"]=nil -print("

form

") -print(htmlviewfunctions.cfe_unpack(form)) -print("

viewlibrary

") -print(htmlviewfunctions.cfe_unpack(viewlibrary)) -print("

page_info

") -print(htmlviewfunctions.cfe_unpack(page_info)) -print("

session

") -print(htmlviewfunctions.cfe_unpack(session)) ---]] -%> +<% if viewlibrary and viewlibrary.dispatch_component then + viewlibrary.dispatch_component("alpine-baselayout/logfiles/view", {filename=data.value}) +end %> diff --git a/vlc-model.lua b/vlc-model.lua index e210e25..5a8da68 100644 --- a/vlc-model.lua +++ b/vlc-model.lua @@ -41,7 +41,7 @@ function mymodule.getconfigfile() return modelfunctions.getfiledetails(configfile) end -function mymodule.get_filedetails() +function mymodule.getlogfile () local path=logfile local path2 if fs.is_file(configfile) then @@ -50,7 +50,7 @@ function mymodule.get_filedetails() end end if path2 then path=path2 end - return modelfunctions.getfiledetails(path) + return cfe({ value=path, label="VLC logfile" }) end function mymodule.setconfigfile(self, filedetails) -- cgit v1.2.3