summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vlc-controller.lua18
-rw-r--r--vlc-model.lua19
2 files changed, 20 insertions, 17 deletions
diff --git a/vlc-controller.lua b/vlc-controller.lua
index 12f0fe6..ddfef2d 100644
--- a/vlc-controller.lua
+++ b/vlc-controller.lua
@@ -1,25 +1,27 @@
-module(..., package.seeall)
+local mymodule = {}
-mvc = {}
-mvc.on_load = function(self, parent)
+mymodule.mvc = {}
+mymodule.mvc.on_load = function(self, parent)
self.model.set_processname(string.match(self.conf.prefix, "[^/]+"))
end
-default_action = "status"
+mymodule.default_action = "status"
-function status(self)
+function mymodule.status(self)
return self.model.getstatus()
end
-function startstop(self)
+function mymodule.startstop(self)
return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end
-function expert(self)
+function mymodule.expert(self)
return self.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config File", "Configuration File Set")
end
-function logfile(self)
+function mymodule.logfile(self)
return self.model.get_filedetails(self.clientdata.name or "", self.clientdata.grep)
end
+
+return mymodule
diff --git a/vlc-model.lua b/vlc-model.lua
index aa9470f..e210e25 100644
--- a/vlc-model.lua
+++ b/vlc-model.lua
@@ -1,4 +1,4 @@
-module(..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -11,7 +11,7 @@ local processname="vlc"
local configfile = "/etc/conf.d/"..tostring(processname)
local logfile = "/var/log/vlc/vlc.log"
-function set_processname(p)
+function mymodule.set_processname(p)
processname = p
configfile = "/etc/conf.d/"..tostring(processname)
end
@@ -24,24 +24,24 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-function getstatus()
+function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, tostring(processname).." Status")
end
-function getconfigfile()
+function mymodule.getconfigfile()
-- FIXME Validate
return modelfunctions.getfiledetails(configfile)
end
-function get_filedetails()
+function mymodule.get_filedetails()
local path=logfile
local path2
if fs.is_file(configfile) then
@@ -53,12 +53,13 @@ function get_filedetails()
return modelfunctions.getfiledetails(path)
end
-function setconfigfile(self, filedetails)
+function mymodule.setconfigfile(self, filedetails)
-- FIXME Validate
return modelfunctions.setfiledetails(self, filedetails, {configfile})
end
-function getleases()
+function mymodule.getleases()
return modelfunctions.getfiledetails(leasefile)
end
+return mymodule