summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/controller/admin
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-03-26 20:55:14 +0000
committerSteven Barth <steven@midlink.org>2008-03-26 20:55:14 +0000
commit68d142e79287e9b5e9f980f37b546070a38fc478 (patch)
tree8d165ffd6e50795b7f140efb0e7ed7f103d2e47d /src/ffluci/controller/admin
parent5f9910566de7165f4bb0ee62bc3ace53c708a94e (diff)
* CBI update
* Added some configuration pages * Introduced contact site * Introduced luci UCI config file
Diffstat (limited to 'src/ffluci/controller/admin')
-rw-r--r--src/ffluci/controller/admin/index.lua9
-rw-r--r--src/ffluci/controller/admin/network.lua10
-rw-r--r--src/ffluci/controller/admin/uci.lua57
3 files changed, 76 insertions, 0 deletions
diff --git a/src/ffluci/controller/admin/index.lua b/src/ffluci/controller/admin/index.lua
new file mode 100644
index 0000000000..3ee564f640
--- /dev/null
+++ b/src/ffluci/controller/admin/index.lua
@@ -0,0 +1,9 @@
+module(..., package.seeall)
+
+menu = {
+ descr = "Übersicht",
+ order = 10,
+ entries = {
+ {action = "contact", descr = "Kontakt"}
+ }
+} \ No newline at end of file
diff --git a/src/ffluci/controller/admin/network.lua b/src/ffluci/controller/admin/network.lua
new file mode 100644
index 0000000000..f76dce5555
--- /dev/null
+++ b/src/ffluci/controller/admin/network.lua
@@ -0,0 +1,10 @@
+module(..., package.seeall)
+
+menu = {
+ descr = "Netzwerk",
+ order = 20,
+ entries = {
+ {action = "vlan", descr = "VLAN"},
+ {action = "ifaces", descr = "Schnittstellen"}
+ }
+} \ No newline at end of file
diff --git a/src/ffluci/controller/admin/uci.lua b/src/ffluci/controller/admin/uci.lua
new file mode 100644
index 0000000000..db70eb6a63
--- /dev/null
+++ b/src/ffluci/controller/admin/uci.lua
@@ -0,0 +1,57 @@
+module("ffluci.controller.admin.uci", package.seeall)
+
+-- This function has a higher priority than the admin_uci/apply template
+function action_apply()
+ local changes = ffluci.model.uci.changes()
+ local output = ""
+
+ if changes then
+ local apply = {}
+
+ -- Collect files to be applied
+ for i, line in ipairs(ffluci.util.split(changes)) do
+ local r = line:match("^[^.]+")
+ if r then
+ apply[r] = true
+ end
+ end
+
+ -- Commit changes
+ ffluci.model.uci.commit()
+
+ -- Search for post-commit commands
+ if ffluci.config.uci_oncommit then
+ for k, v in pairs(apply) do
+ local cmd = ffluci.config.uci_oncommit[k]
+ if cmd then
+ output = output .. ffluci.util.exec(cmd)
+ end
+ end
+ end
+ end
+
+ ffluci.template.render("admin_uci/apply", {changes=changes, output=output})
+end
+
+
+function action_revert()
+ local changes = ffluci.model.uci.changes()
+ if changes then
+ local revert = {}
+
+ -- Collect files to be reverted
+ for i, line in ipairs(ffluci.util.split(changes)) do
+ local r = line:match("^[^.]+")
+ if r then
+ revert[r] = true
+ end
+ end
+
+ -- Revert them
+ for k, v in pairs(revert) do
+ ffluci.model.uci.revert(k)
+ end
+ end
+
+ ffluci.template.render("admin_uci/revert", {changes=changes})
+end \ No newline at end of file