summaryrefslogtreecommitdiffstats
path: root/shorewall-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'shorewall-controller.lua')
-rw-r--r--shorewall-controller.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/shorewall-controller.lua b/shorewall-controller.lua
index 094dcf9..07ec0b7 100644
--- a/shorewall-controller.lua
+++ b/shorewall-controller.lua
@@ -17,8 +17,23 @@ mvc.on_load = function(self, parent)
end
+check = function(self)
+ if self.clientdata.cmd == "restart" then
+ return ( {programstats = self.model:restart_service(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } )
+ end
+ return ( {check = self.model:check_config(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } )
+end
+
read = function(self)
+ if self.clientdata.cmd == "check" then
+ self.conf.action = "check"
+ self.conf.type = "redir"
+ error (self.conf)
+ end
+ if self.clientdata.cmd == "restart" then
+ return ( {programstats = self.model:restart_service(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } )
+ end
return ( {programstats = self.model:get_status(), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } )
end
@@ -29,7 +44,7 @@ end
edit = function (self)
local filename = self.clientdata.name or ""
local filecontent = self.clientdata.modifications or ""
- if self.clientdata.cmd == "update" then
+ if ( filecontent ~= "") then
local me = ( {filecontent = self.model:update_filecontent(filename,filecontent), url = ENV["SCRIPT_NAME"] .. self.conf.prefix .. self.conf.controller } )
if ( me.filecontent == nil ) then
list_redir(self)