From 9b8a758b54ffa703067c23b36b9ca801e8cb8d90 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Wed, 14 May 2008 11:38:29 +0000 Subject: Rebuilding the config-view-file to be more easy to use (and a bit more good looking). git-svn-id: svn://svn.alpinelinux.org/acf/shorewall/trunk@1117 ab2d0c66-481e-0410-8bed-d214d4d58bed --- shorewall-config-html.lsp | 153 ++++++++++++++++++++++++++++++++++++++++++---- shorewall-controller.lua | 4 -- shorewall-model.lua | 15 +++-- 3 files changed, 149 insertions(+), 23 deletions(-) diff --git a/shorewall-config-html.lsp b/shorewall-config-html.lsp index 80e0e9f..41ca945 100644 --- a/shorewall-config-html.lsp +++ b/shorewall-config-html.lsp @@ -1,5 +1,29 @@ DEBUGGING

DEBUG INFO: CFE

") +io.write(html.cfe_unpack(form)) +io.write("
") +--]] + +local descr = { + ['interfaces'] = { + ['labels'] = { "ZONE", "INTERFACES", "BROADCAST", "OPTIONS" }, + ['width'] = { "100", "100", "100", "*" } + }, + ['zones'] = { + ['labels'] = { "ZONE", "INTERFACES", "BROADCAST", "OPTIONS" }, + ['width'] = { "100", "100", "100", "*" } + }, + ['policy'] = { + ['labels'] = { "SOURCE", "DEST", "POLICY", "LOG LEVEL", "LIMIT:BURST" }, + ['width'] = { "100", "100", "100", "100" } + }, + ['rules'] = { + ['labels'] = { "ACTION", "SOURCE", "DEST", "PROTO", "DEST
PORT", "SOURCE
PORT(S)", "ORIGINAL
DEST", "RATE
LIMIT", "USER/
GROUP", "MARK", }, + ['width'] = { "100", "70", "70", "70", "100", } + }, + } ?>

SYSTEM INFO

@@ -24,44 +48,147 @@ displayinfo(myform,tags)

Interfaces

+
- + + + + "> + + + + + -
+ + .png' width='16' height='16' alt> + + + + + + + + + + + +

Defince zones

+
- + + + + "> + + + + + + + + .png' width='16' height='16' alt> + + + + + + + + + + +

Default policy

+
- + + + + "> + + + + + + + + .png' width='16' height='16' alt> + + + + + + + + + + +

Rules

+
- + + + + "> + + + + + + + + .png' width='16' height='16' alt> + + + + + + + + + + +
+

MANAGEMENT

diff --git a/shorewall-controller.lua b/shorewall-controller.lua index 4b0eba0..def860e 100644 --- a/shorewall-controller.lua +++ b/shorewall-controller.lua @@ -524,10 +524,6 @@ function config(self) local status=self.model.getstatus() -- Add a [New] record to the options - table.insert(config.interfaces.option, newrecordtxt) - table.insert(config.zones.option, newrecordtxt) - table.insert(config.policy.option, newrecordtxt) - table.insert(config.rules.option, newrecordtxt) table.insert(config.params.option, newrecordtxt) -- Add button diff --git a/shorewall-model.lua b/shorewall-model.lua index 023ceed..92c4640 100644 --- a/shorewall-model.lua +++ b/shorewall-model.lua @@ -49,7 +49,11 @@ local function read_config(file) local output = {} for k,v in pairs(filecontent) do if not string.find ( v, "^[;#].*" ) and not (string.find (v, "^%s*$")) then - table.insert(output, v) + local details = {} + for v in string.gmatch(v, "%S+") do + table.insert(details, v) + end + table.insert(output, details) end end return output @@ -213,8 +217,11 @@ function getconfig() name = "params", label="List of parameters", type="select", - option=read_config("params"), + option={}, }) + for k,v in pairs(read_config("params")) do + table.insert(config.params.option, v[1]) + end config.params.size=#config.params.option + 1 config.interfaces = cfe({ @@ -223,7 +230,6 @@ function getconfig() type="select", option=read_config("interfaces"), }) - config.interfaces.size=#config.interfaces.option + 1 config.zones = cfe({ name = "zones", @@ -231,7 +237,6 @@ function getconfig() type="select", option=read_config("zones"), }) - config.zones.size=#config.zones.option + 1 config.policy = cfe({ name = "policy", @@ -239,7 +244,6 @@ function getconfig() type="select", option=read_config("policy"), }) - config.policy.size=#config.policy.option + 1 config.rules = cfe({ name = "rules", @@ -247,7 +251,6 @@ function getconfig() type="select", option=read_config("rules"), }) - config.rules.size=#config.rules.option + 1 return config -- cgit v1.2.3