summaryrefslogtreecommitdiffstats
path: root/shorewall-controller.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-09-22 20:58:06 +0000
committerTed Trask <ttrask01@yahoo.com>2008-09-22 20:58:06 +0000
commitca8952c1a3f5107563020604585ada9f6b088860 (patch)
tree637a8fbe876a688ad45b1b619f24947b3824a1cb /shorewall-controller.lua
parent3f3cf113c69e8fc334ae6c12559a2e5ec8406a0b (diff)
downloadacf-shorewall-ca8952c1a3f5107563020604585ada9f6b088860.tar.bz2
acf-shorewall-ca8952c1a3f5107563020604585ada9f6b088860.tar.xz
Rewrite of shorewall to use new libraries, ... Moved statusbasic to status, status to details, expert to listfiles. Changed check to not have a page. Used links for status, edit, startstop. Didn't change config, so it still doesn't work.
git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@1480 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'shorewall-controller.lua')
-rw-r--r--shorewall-controller.lua149
1 files changed, 32 insertions, 117 deletions
diff --git a/shorewall-controller.lua b/shorewall-controller.lua
index 967c4d6..da88e40 100644
--- a/shorewall-controller.lua
+++ b/shorewall-controller.lua
@@ -1,9 +1,7 @@
module(..., package.seeall)
--- This is the object/text used when we want to add a new record
-
-require("format")
-
+require("controllerfunctions")
+--[[
local newrecordtxt = "[New]"
-- ################################################################################
@@ -18,12 +16,40 @@ local function displaycmdsave(self)
})
return cmdsave
end
-
+--]]
-- ################################################################################
-- PUBLIC FUNCTIONS
default_action = "status"
+function status(self)
+ return self.model.getstatus()
+end
+
+function details(self)
+ return self.model.getstatusdetails()
+end
+
+function startstop(self)
+ return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata)
+end
+
+function listfiles(self)
+ return self.model.getfilelist()
+end
+
+function edit(self)
+ return controllerfunctions.handle_form(self, function() return self.model.getfiledetails(self.clientdata.filename) end, self.model.updatefiledetails, self.clientdata, "Save", "Edit File", "File Saved")
+end
+
+function check(self)
+ return self:redirect_to_referrer(self.model.configcheck())
+end
+
+function logfile(self)
+ return self.model.getlogfile()
+end
+--[[
function editrecords(self,types,record,errormessage)
local recorddetails = {}
local edit = {}
@@ -445,17 +471,6 @@ function editrecords(self,types,record,errormessage)
}
end
-function status(self)
- return { status=self.model.getstatusdetails() }
-end
-function statusbasic(self)
- return {
- status=self.model.getstatus(),
- version=self.model.getversion(),
- autostart=self.model.getautostart(),
- }
-end
-
function config(self)
-- If we made some changes to a recods... then proceed with the modification
@@ -623,104 +638,4 @@ function config(self)
configmessage=configmessage,
}
end
-
-function check(self)
-
- local config = self.model:configcheck()
-
- return {
- option={ script=self.conf.script,
- prefix=self.conf.prefix,
- controller = self.conf.controller,
- action = "expert",
- link = self.conf.script .. self.conf.prefix .. self.conf.controller, },
- config = config,
- startstop = startstop,
- debugclientdata = self.clientdata,
- }
-
-end
-
-function logfile(self)
-
- local config = self.model:getlogfile()
-
- return {
- option={ script=self.conf.script,
- prefix=self.conf.prefix,
- controller = self.conf.controller,
- action = "expert",
- link = self.conf.script .. self.conf.prefix .. self.conf.controller, },
- config = config,
- startstop = startstop,
- debugclientdata = self.clientdata,
- }
-
-end
-
-function expert(self)
- return {
- option={ script=self.conf.script,
- prefix=self.conf.prefix,
- controller = self.conf.controller,
- action = "expert",
- link = self.conf.script .. self.conf.prefix .. self.conf.controller, },
- config = self.model:getfilelist(),
- startstop = startstop,
- debugclientdata = self.clientdata,
- }
-end
-
-function edit(self)
-
- -- Save changes
- local cmdsaveresult, cmdsaveerror
- if ( self.clientdata.cmdsave) then
- local filetochange = cfe ({ name=self.clientdata.filename, value=self.clientdata.filecontent, })
- cmdsaveresult, cmdsaveerror = self.model:updatefilecontent(filetochange)
- self.clientdata.name = self.clientdata.filename
- end
-
- local config = self.model:getfiledetails(cfe({
- name="editfile",
- value=self.clientdata.name,
- }))
-
- -- Display save button
- config.cmdsave = displaycmdsave()
- if (cmdsaveresult) then
- config.cmdsave.descr="* Changes has been saved!"
- redirect(self,"expert")
- end
-
- return {
- option={ script=self.conf.script,
- prefix=self.conf.prefix,
- controller = self.conf.controller,
- action = "edit",
- link = self.conf.script .. self.conf.prefix .. self.conf.controller, },
- modifications = modifications,
- config = config,
- startstop = startstop,
- debugclientdata = self.clientdata,
- }
-
-end
-
-function startstop(self)
- local result
- if self.clientdata.action then
- result = self.model:startstop_service(self.clientdata.action)
- self.sessiondata.syslogstartstopresult = result
- self.redirect_to_referrer(self)
- end
-
- local status = self.model.getstatus()
- if self.sessiondata.syslogstartstopresult then
- result = self.sessiondata.syslogstartstopresult
- self.sessiondata.syslogstartstopresult = nil
- end
-
- return cfe({ type="group", value={status=status, result=result} })
-end
-
+--]]