diff options
| -rw-r--r-- | vlc-controller.lua | 7 | ||||
| -rw-r--r-- | vlc-expert-html.lsp | 1 | ||||
| -rw-r--r-- | vlc-logfile-html.lsp | 22 | ||||
| -rw-r--r-- | vlc-model.lua | 10 | ||||
| -rw-r--r-- | vlc-startstop-html.lsp | 22 | ||||
| -rw-r--r-- | vlc-status-html.lsp | 12 | 
6 files changed, 26 insertions, 48 deletions
diff --git a/vlc-controller.lua b/vlc-controller.lua index 8199735..12f0fe6 100644 --- a/vlc-controller.lua +++ b/vlc-controller.lua @@ -1,8 +1,5 @@  module(..., package.seeall) --- Load libraries -require("controllerfunctions") -  mvc = {}  mvc.on_load = function(self, parent)  	self.model.set_processname(string.match(self.conf.prefix, "[^/]+")) @@ -15,11 +12,11 @@ function status(self)  end  function startstop(self) -	return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata) +	return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)  end  function expert(self) -	return controllerfunctions.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config File", "Configuration File Set") +	return self.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config File", "Configuration File Set")  end  function logfile(self) diff --git a/vlc-expert-html.lsp b/vlc-expert-html.lsp index 5db9173..ce8d397 100644 --- a/vlc-expert-html.lsp +++ b/vlc-expert-html.lsp @@ -1,5 +1,4 @@  <% local form, viewlibrary, page_info, session = ... %> -<% require("viewfunctions") %>  <% if viewlibrary and viewlibrary.dispatch_component then  	viewlibrary.dispatch_component("status") diff --git a/vlc-logfile-html.lsp b/vlc-logfile-html.lsp index ab79f8a..7cc9795 100644 --- a/vlc-logfile-html.lsp +++ b/vlc-logfile-html.lsp @@ -1,15 +1,15 @@  <% local form, viewlibrary, page_info = ... %> -<% require("viewfunctions") %> +<% require("htmlviewfunctions") %>  <H1>Logfile</H1>  <H2>File Details</H2>  <DL>  <%  -displayitem(form.value.filename) -displayitem(form.value.filesize) -displayitem(form.value.mtime) +htmlviewfunctions.displayitem(form.value.filename) +htmlviewfunctions.displayitem(form.value.filesize) +htmlviewfunctions.displayitem(form.value.mtime)  --if form.value.grep.value ~= "" then ---	displayitem(form.value.grep) +--	htmlviewfunctions.displayitem(form.value.grep)  --end  %>  </DL> @@ -19,7 +19,7 @@ displayitem(form.value.mtime)  <DL>  <% if form.type == "form" then %>  <% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %> -<% displayformstart(form) %> +<% htmlviewfunctions.displayformstart(form) %>  <input type="hidden" name="filename" value="<%= html.html_escape(form.value.filename.value) %>">  <% end %>  <textarea name="filecontent"> @@ -29,7 +29,7 @@ displayitem(form.value.mtime)  <% 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 %> -<% displayformend(form) %> +<% htmlviewfunctions.displayformend(form) %>  <% end %>  </form>  </DL> @@ -39,12 +39,12 @@ displayitem(form.value.mtime)  print("<H2>Debug info for page '"..tostring(page_info.action).."'</H2>")  --form["value"]["filecontent"]["value"]=nil  print("<H3>form</H3>")  -print(cfe_unpack(form))  +print(htmlviewfunctions.cfe_unpack(form))   print("<H3>viewlibrary</H3>")  -print(cfe_unpack(viewlibrary))  +print(htmlviewfunctions.cfe_unpack(viewlibrary))   print("<H3>page_info</H3>")  -print(cfe_unpack(page_info))  +print(htmlviewfunctions.cfe_unpack(page_info))   print("<H3>session</H3>")  -print(cfe_unpack(session))  +print(htmlviewfunctions.cfe_unpack(session))   --]]  %> diff --git a/vlc-model.lua b/vlc-model.lua index 3e6e5f3..d1fe1ee 100644 --- a/vlc-model.lua +++ b/vlc-model.lua @@ -2,7 +2,7 @@ module(..., package.seeall)  -- Load libraries  require("modelfunctions") -require("fs") +fs = require("acf.fs")  -- ################################################################################  -- SET VARIABLES @@ -25,8 +25,12 @@ end  -- ################################################################################  -- PUBLIC FUNCTIONS -function startstop_service(action) -	return modelfunctions.startstop_service(processname, action) +function get_startstop(clientdata)        +        return modelfunctions.get_startstop(processname) +end + +function startstop_service(startstop, action)         +        return modelfunctions.startstop_service(startstop, action)  end  function getstatus() diff --git a/vlc-startstop-html.lsp b/vlc-startstop-html.lsp deleted file mode 100644 index c98208b..0000000 --- a/vlc-startstop-html.lsp +++ /dev/null @@ -1,22 +0,0 @@ -<% local data, viewlibrary, page_info = ... %> - -<H1>Management</H1> - -<% if data.value.result then %> -<H2>Previous action result</H2> -<% if data.value.result.value ~= "" then %> -<P CLASS='descr'><%= string.gsub(html.html_escape(data.value.result.value), "\n", "<BR>") %></P> -<% end if data.value.result.errtxt then %> -<P CLASS='error'><%= string.gsub(html.html_escape(data.value.result.errtxt), "\n", "<BR>") %></P> -<% end end %> - -<DL> -<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>" method="POST"> -<DT>Program control-panel</DT> -<DD> -<% for i,act in ipairs(data.value.actions.value) do %> -	<input class="submit" type="submit" name="action" value="<%= act %>"> -<% end %> -</DD> -</form> -</DL> diff --git a/vlc-status-html.lsp b/vlc-status-html.lsp index 5518c04..3b578a9 100644 --- a/vlc-status-html.lsp +++ b/vlc-status-html.lsp @@ -1,16 +1,16 @@  <% local data, viewlibrary, page_info, session = ...  -require("viewfunctions") +require("htmlviewfunctions")  %> -<% displaycommandresults({"install","edit"}, session) %> -<% displaycommandresults({"startstop"}, session) %> +<% htmlviewfunctions.displaycommandresults({"install","edit"}, session) %> +<% htmlviewfunctions.displaycommandresults({"startstop"}, session) %>  <H1>System Info</H1>  <DL>  <% -displayitem(data.value.status) +htmlviewfunctions.displayitem(data.value.status) -displayitem(data.value.version) +htmlviewfunctions.displayitem(data.value.version)  if data.value.version and data.value.version.errtxt and viewlibrary.check_permission("apk-tools/apk/install") then  %>  	<DT>Install package</DT> @@ -20,7 +20,7 @@ if data.value.version and data.value.version.errtxt and viewlibrary.check_permis  <%  end -displayitem(data.value.autostart) +htmlviewfunctions.displayitem(data.value.autostart)  if not (data.value.version and data.value.version.errtxt) and data.value.autostart and data.value.autostart.errtxt and viewlibrary.check_permission("alpine-baselayout/rc/edit") then  %>  	<DT>Enable autostart</DT>  | 
