diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-03-05 13:43:54 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-03-05 13:43:54 +0000 |
commit | 1e43af128e100168a0214dde757b7c5ccb21e7f6 (patch) | |
tree | 1941778defec5686861d2a9fbd9553cb34d0365f /shorewall-controller.lua | |
parent | 192e7f7d10e67e03ae36141e4522155a3debe086 (diff) | |
download | acf-shorewall-1e43af128e100168a0214dde757b7c5ccb21e7f6.tar.bz2 acf-shorewall-1e43af128e100168a0214dde757b7c5ccb21e7f6.tar.xz |
Cleaned up the output when user chooses [new]
git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@821 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'shorewall-controller.lua')
-rw-r--r-- | shorewall-controller.lua | 56 |
1 files changed, 41 insertions, 15 deletions
diff --git a/shorewall-controller.lua b/shorewall-controller.lua index 9f0f83d..3f91b63 100644 --- a/shorewall-controller.lua +++ b/shorewall-controller.lua @@ -83,10 +83,25 @@ function edit_records(self,types,record) end end + -- Display save button + local cmdsave = displaycmdsave() + cmdsave.disabled="yes" -- DEBUGGING + cmdsave.descr="This button is not yet programmed to work" -- DEBUGGING + + -- Display delete button + cmddelete = cfe({ name="cmddelete", + label="Delete this record", + value="Delete", + type="submit", + }) + cmddelete.disabled="yes" -- DEBUGGING + cmddelete.descr="This button is not yet programmed to work" -- DEBUGGING + + if (types == "interfaces") then -- Fetch the list of existing interfaces - local interfaceslist = {} +-- local interfaceslist = {} -- local interfaces, int_w_loaded, int_m_loaded = self:new("alpine-baselayout/interfaces") -- if (int_m_loaded) then -- interfaceslist = interfaces.worker.read(interfaces) @@ -102,6 +117,10 @@ function edit_records(self,types,record) option={}, debug=interfaceslist, }) + -- IF user creates '[New]' record... then clean up the output. + if (record == newrecordtxt) then + edit[fieldnum]["value"] = "-" + end table.insert(edit[fieldnum]["option"], "-") for k,v in pairs(config.zones_list.option or {}) do table.insert(edit[fieldnum]["option"], string.match(v, "^%s*(%S*)")) @@ -143,21 +162,8 @@ function edit_records(self,types,record) name="field".. fieldnum, value=recordtable[fieldnum], }) - end - - -- Display save button - local cmdsave = displaycmdsave() - cmdsave.disabled="yes" -- DEBUGGING - cmdsave.descr="This button is not yet programmed to work" -- DEBUGGING - -- Display delete button - cmddelete = cfe({ name="cmddelete", - label="Delete this record", - value="Delete", - type="submit", - }) - cmddelete.disabled="yes" -- DEBUGGING - cmddelete.descr="This button is not yet programmed to work" -- DEBUGGING + end if (types == "zones") then @@ -178,6 +184,10 @@ function edit_records(self,types,record) type="select", option={"ipv4", "ipsec", "firewall",} }) + -- IF user creates '[New]' record... then clean up the output. + if (record == newrecordtxt) then + edit[fieldnum]["value"] = "ipv4" + end -- IF the value is not one of the existing options, then warn and add this option. for k,v in pairs(edit[fieldnum]["option"]) do edit[fieldnum]["errtxt"] = "'" .. edit[fieldnum]["value"] .. "' is not a valid option!" @@ -227,6 +237,10 @@ function edit_records(self,types,record) type="select", option=self.model.get_defined_zones(), }) + -- IF user creates '[New]' record... then clean up the output. + if (record == newrecordtxt) then + edit[fieldnum]["value"] = "all" + end table.insert(edit[fieldnum]["option"], "$FW") table.insert(edit[fieldnum]["option"], "all") -- IF the value is not one of the existing options, then warn and add this option. @@ -252,6 +266,10 @@ function edit_records(self,types,record) type="select", option=self.model.get_defined_zones(), }) + -- IF user creates '[New]' record... then clean up the output. + if (record == newrecordtxt) then + edit[fieldnum]["value"] = "all" + end table.insert(edit[fieldnum]["option"], "$FW") table.insert(edit[fieldnum]["option"], "all") -- IF the value is not one of the existing options, then warn and add this option. @@ -277,6 +295,10 @@ function edit_records(self,types,record) type="select", option={"ACCEPT","DROP","REJECT","CONTINUE","QUEUE","NONE"} }) + -- IF user creates '[New]' record... then clean up the output. + if (record == newrecordtxt) then + edit[fieldnum]["value"] = "DROP" + end -- IF the value is not one of the existing options, then warn and add this option. for k,v in pairs(edit[fieldnum]["option"]) do edit[fieldnum]["errtxt"] = "'" .. edit[fieldnum]["value"] .. "' is not a valid option!" @@ -329,6 +351,10 @@ function edit_records(self,types,record) "COMMENT", }, }) + -- IF user creates '[New]' record... then clean up the output. + if (record == newrecordtxt) then + edit[fieldnum]["value"] = "DROP" + end -- IF the value is not one of the existing options, then warn and add this option. for k,v in pairs(edit[fieldnum]["option"]) do edit[fieldnum]["errtxt"] = "Attention! '" .. edit[fieldnum]["value"] .. "' could be a invalid option (or is a action defined in 'actions')." |