summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-04-17 00:43:17 +0000
committerTed Trask <ttrask01@yahoo.com>2014-04-17 00:43:17 +0000
commitd6e8f214d59c9f70cd6c53cf82c9977328705245 (patch)
tree4dba421720ee83d7870da3bd94992b8ebfe980cb
parent1471dfac72a978562aac19fa7a1396a0c04b5222 (diff)
downloadacf-vlc-daemon-d6e8f214d59c9f70cd6c53cf82c9977328705245.tar.bz2
acf-vlc-daemon-d6e8f214d59c9f70cd6c53cf82c9977328705245.tar.xz
Changes to use new htmlviewfunctions functions and standardize logfile viewer
This closes a bug where log filename was not validated
-rw-r--r--vlc-controller.lua3
-rw-r--r--vlc-logfile-html.lsp48
-rw-r--r--vlc-model.lua4
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") %>
-
-<h1>Logfile</h1>
-<h2>File Details</h2>
-<%
-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 = ...
%>
-<h2>File Content</h2>
-<% if form.type == "form" then %>
-<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>
-<% htmlviewfunctions.displayformstart(form) %>
-<input type="hidden" name="filename" value="<%= html.html_escape(form.value.filename.value) %>">
-<% end %>
-<textarea name="filecontent">
-<%= html.html_escape(form.value.filecontent.value) %>
-</textarea>
-<% if form.value.filecontent.errtxt then %><p class='error'><%= string.gsub(html.html_escape(form.value.filecontent.errtxt), "\n", "<br/>") %></p><% end %>
-<% if form.value.filecontent.descr then %><p class='descr'><%= string.gsub(html.html_escape(form.value.filecontent.descr), "\n", "<br/>") %></p><% end %>
-
-<% if form.type == "form" then %>
-<% htmlviewfunctions.displayformend(form) %>
-<% end %>
-</form>
-
-<%
---[[
-print("<h2>Debug info for page '"..tostring(page_info.action).."'</h2>")
---form["value"]["filecontent"]["value"]=nil
-print("<h3>form</h3>")
-print(htmlviewfunctions.cfe_unpack(form))
-print("<h3>viewlibrary</h3>")
-print(htmlviewfunctions.cfe_unpack(viewlibrary))
-print("<h3>page_info</h3>")
-print(htmlviewfunctions.cfe_unpack(page_info))
-print("<h3>session</h3>")
-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)