summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2012-04-18 01:23:12 +0000
committerTed Trask <ttrask01@yahoo.com>2012-04-18 01:23:12 +0000
commit15eff0f588679d3743475941345da9a46544f431 (patch)
tree9d17472b8f1935736fbab27e93eb1bb436ae4009
parentc7d77f2707c2898515042ab3ed22dfa10f15e47c (diff)
downloadacf-iptables-15eff0f588679d3743475941345da9a46544f431.tar.bz2
acf-iptables-15eff0f588679d3743475941345da9a46544f431.tar.xz
Started work on updating for acf-core-0.15
Removed controllerfunctions library (still needs more work and corresponding work in model) Updated startstop functionality and deleted view Updated for viewfunctions to htmlviewfunctions and modified require statements for acf libraries
-rw-r--r--iptables-controller.lua21
-rw-r--r--iptables-details-html.lsp1
-rw-r--r--iptables-editchain-html.lsp4
-rw-r--r--iptables-editrule-html.lsp60
-rw-r--r--iptables-html.lsp4
-rw-r--r--iptables-model.lua14
-rw-r--r--iptables-startstop-html.lsp24
7 files changed, 49 insertions, 79 deletions
diff --git a/iptables-controller.lua b/iptables-controller.lua
index 2cecc56..8ea7353 100644
--- a/iptables-controller.lua
+++ b/iptables-controller.lua
@@ -1,14 +1,5 @@
module(..., package.seeall)
--- Load libraries
-require("controllerfunctions")
-
--- ################################################################################
--- LOCAL FUNCTIONS
-
--- ################################################################################
--- PUBLIC FUNCTIONS
-
default_action = "status"
function status(self)
@@ -32,11 +23,11 @@ function manglerules(self)
end
function editchain(self)
- return controllerfunctions.handle_form(self, function() return self.model.read_chain(self.clientdata.table, self.clientdata.chain or "") end, self.model.update_chain, self.clientdata, "Save", "Edit Chain", "Chain saved")
+ return self.handle_form(self, function() return self.model.read_chain(self.clientdata.table, self.clientdata.chain or "") end, self.model.update_chain, self.clientdata, "Save", "Edit Chain", "Chain saved")
end
function createchain(self)
- return controllerfunctions.handle_form(self, function() return self.model.read_chain(self.clientdata.table) end, self.model.create_chain, self.clientdata, "Create", "Create New Chain", "Chain created")
+ return self.handle_form(self, function() return self.model.read_chain(self.clientdata.table) end, self.model.create_chain, self.clientdata, "Create", "Create New Chain", "Chain created")
end
function deletechain(self)
@@ -44,11 +35,11 @@ function deletechain(self)
end
function editrule(self)
- return controllerfunctions.handle_form(self, function() return self.model.read_rule(self.clientdata.table, self.clientdata.chain or "", self.clientdata.position or "") end, self.model.update_rule, self.clientdata, "Save", "Edit Rule", "Rule saved")
+ return self.handle_form(self, function() return self.model.read_rule(self.clientdata.table, self.clientdata.chain or "", self.clientdata.position or "") end, self.model.update_rule, self.clientdata, "Save", "Edit Rule", "Rule saved")
end
function createrule(self)
- return controllerfunctions.handle_form(self, function() return self.model.read_rule(self.clientdata.table, self.clientdata.chain, self.clientdata.position) end, self.model.create_rule, self.clientdata, "Create", "Create New Rule", "Rule created")
+ return self.handle_form(self, function() return self.model.read_rule(self.clientdata.table, self.clientdata.chain, self.clientdata.position) end, self.model.create_rule, self.clientdata, "Create", "Create New Rule", "Rule created")
end
function deleterule(self)
@@ -56,9 +47,9 @@ function deleterule(self)
end
function expert(self)
- return controllerfunctions.handle_form(self, self.model.readrulesfile, self.model.updaterulesfile, self.clientdata, "Save", "Edit Rules File", "Rules File Saved")
+ return self.handle_form(self, self.model.readrulesfile, self.model.updaterulesfile, self.clientdata, "Save", "Edit Rules File", "Rules File Saved")
end
function startstop(self)
- return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata)
+ return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end
diff --git a/iptables-details-html.lsp b/iptables-details-html.lsp
index c15ab2a..5310f67 100644
--- a/iptables-details-html.lsp
+++ b/iptables-details-html.lsp
@@ -1,5 +1,4 @@
<% local data, viewlibrary = ...
-require("viewfunctions")
%>
<% viewlibrary.dispatch_component("status") %>
diff --git a/iptables-editchain-html.lsp b/iptables-editchain-html.lsp
index 9514d5b..af06bb6 100644
--- a/iptables-editchain-html.lsp
+++ b/iptables-editchain-html.lsp
@@ -1,5 +1,5 @@
<% local form, viewlibrary, page_info = ...
-require("viewfunctions")
+require("htmlviewfunctions")
%>
<H1><%= html.html_escape(form.label) %></H1>
@@ -11,5 +11,5 @@ require("viewfunctions")
form.value.chain.readonly = true
end
local order = {"table", "chain", "policy"}
- displayform(form, order)
+ htmlviewfunctions.displayform(form, order)
%>
diff --git a/iptables-editrule-html.lsp b/iptables-editrule-html.lsp
index 7e4d156..da1fc61 100644
--- a/iptables-editrule-html.lsp
+++ b/iptables-editrule-html.lsp
@@ -1,5 +1,5 @@
<% local form, viewlibrary, page_info = ...
-require("viewfunctions")
+require("htmlviewfunctions")
%>
<H1><%= html.html_escape(form.label) %></H1>
@@ -10,47 +10,47 @@ form.value.table.type = "text"
form.value.chain.readonly = true
form.value.position.readonly = true
form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action
-displayformstart(form)
+htmlviewfunctions.displayformstart(form)
%>
<H2>Rule Identification</H2><DL>
<%
-displayformitem(form.value.table)
-displayformitem(form.value.chain)
-displayformitem(form.value.position)
+htmlviewfunctions.displayformitem(form.value.table)
+htmlviewfunctions.displayformitem(form.value.chain)
+htmlviewfunctions.displayformitem(form.value.position)
%>
</DL><H2>Basic Parameters</H2><DL>
<%
-displayformitem(form.value.jump)
-displayformitem(form.value.protocol)
-displayformitem(form.value.in_interface)
-displayformitem(form.value.out_interface)
-displayformitem(form.value.source)
-displayformitem(form.value.destination)
+htmlviewfunctions.displayformitem(form.value.jump)
+htmlviewfunctions.displayformitem(form.value.protocol)
+htmlviewfunctions.displayformitem(form.value.in_interface)
+htmlviewfunctions.displayformitem(form.value.out_interface)
+htmlviewfunctions.displayformitem(form.value.source)
+htmlviewfunctions.displayformitem(form.value.destination)
%>
</DL><DL id="details">
<%
-displayformitem(form.value.goto)
-displayformitem(form.value.fragment)
-displayformitem(form.value.set_counters)
+htmlviewfunctions.displayformitem(form.value.goto)
+htmlviewfunctions.displayformitem(form.value.fragment)
+htmlviewfunctions.displayformitem(form.value.set_counters)
%>
</DL><H2>Extended Parameters</H2><DL>
<%
-displayformitem(form.value.comment)
-displayformitem(form.value.addrtype_src_type)
-displayformitem(form.value.addrtype_dst_type)
-displayformitem(form.value.icmp_type)
-displayformitem(form.value.src_range)
-displayformitem(form.value.dst_range)
-displayformitem(form.value.mac_source)
-displayformitem(form.value.sports)
-displayformitem(form.value.dports)
-displayformitem(form.value.ports)
-displayformitem(form.value.state)
-displayformitem(form.value.tcp_sport)
-displayformitem(form.value.tcp_dport)
-displayformitem(form.value.udp_sport)
-displayformitem(form.value.udp_dport)
+htmlviewfunctions.displayformitem(form.value.comment)
+htmlviewfunctions.displayformitem(form.value.addrtype_src_type)
+htmlviewfunctions.displayformitem(form.value.addrtype_dst_type)
+htmlviewfunctions.displayformitem(form.value.icmp_type)
+htmlviewfunctions.displayformitem(form.value.src_range)
+htmlviewfunctions.displayformitem(form.value.dst_range)
+htmlviewfunctions.displayformitem(form.value.mac_source)
+htmlviewfunctions.displayformitem(form.value.sports)
+htmlviewfunctions.displayformitem(form.value.dports)
+htmlviewfunctions.displayformitem(form.value.ports)
+htmlviewfunctions.displayformitem(form.value.state)
+htmlviewfunctions.displayformitem(form.value.tcp_sport)
+htmlviewfunctions.displayformitem(form.value.tcp_dport)
+htmlviewfunctions.displayformitem(form.value.udp_sport)
+htmlviewfunctions.displayformitem(form.value.udp_dport)
%>
</DL><H2><%= html.html_escape(form.option) %></H2>
-<% displayformend(form) %>
+<% htmlviewfunctions.displayformend(form) %>
diff --git a/iptables-html.lsp b/iptables-html.lsp
index 832568f..13433f1 100644
--- a/iptables-html.lsp
+++ b/iptables-html.lsp
@@ -1,7 +1,7 @@
<% local data, viewlibrary, page_info, session = ... %>
-<% require("viewfunctions") %>
+<% require("htmlviewfunctions") %>
-<% displaycommandresults({"editchain", "deletechain", "createrule", "deleterule", "editrule", "createchain"}, session) %>
+<% htmlviewfunctions.displaycommandresults({"editchain", "deletechain", "createrule", "deleterule", "editrule", "createchain"}, session) %>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
diff --git a/iptables-model.lua b/iptables-model.lua
index d1443d3..162c357 100644
--- a/iptables-model.lua
+++ b/iptables-model.lua
@@ -2,9 +2,9 @@ module(..., package.seeall)
-- Load libraries
require("modelfunctions")
-require("fs")
-require("format")
-require("validator")
+fs = require("acf.fs")
+format = require("acf.format")
+validator = require("acf.validator")
-- Set variables
local packagename = "iptables"
@@ -562,6 +562,10 @@ function updaterulesfile(filedetails)
return modelfunctions.setfiledetails(filedetails, {rulesfile})
end
-function startstop_service(action)
- return modelfunctions.startstop_service(servicename, action, {"Start", "Stop", "Restart", "Save", "Reload", "Panic"})
+function get_startstop(clientdata)
+ return modelfunctions.get_startstop(servicename)
+end
+
+function startstop_service(startstop, action)
+ return modelfunctions.startstop_service(startstop, action)
end
diff --git a/iptables-startstop-html.lsp b/iptables-startstop-html.lsp
deleted file mode 100644
index 26cbe9a..0000000
--- a/iptables-startstop-html.lsp
+++ /dev/null
@@ -1,24 +0,0 @@
-<% local data, viewlibrary, page_info = ... %>
-
-<H1>Management</H1>
-
-<% if data.value.result then %>
-<H2>Previous action result</H2>
-<% if data.value.result.value ~= "" then %>
-<P CLASS='descr'><%= string.gsub(html.html_escape(data.value.result.value), "\n", "<BR>") %></P>
-<% end if data.value.result.errtxt then %>
-<P CLASS='error'><%= string.gsub(html.html_escape(data.value.result.errtxt), "\n", "<BR>") %></P>
-<% end end %>
-
-<DL>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>" method="POST">
-<DT>Load rules from rules file</DT>
-<DD>
-<input class="submit" type="submit" name="action" value="Reload">
-</DD>
-<DT>Save current rules to rules file</DT>
-<DD>
-<input class="submit" type="submit" name="action" value="Save">
-</DD>
-</form>
-</DL>