summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-mini
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-10-31 09:35:11 +0000
committerSteven Barth <steven@midlink.org>2008-10-31 09:35:11 +0000
commit8c4492db5fac28d1c143931316e4ccb7f877e6ec (patch)
tree39f27af314d0c04dcfa3699203d35163d673652e /modules/admin-mini
parent676966f78bbe4aa42f819b991586dca0bac8c554 (diff)
Removed UCI Save/Apply cache from Essentials
Made CBI controllers configurable
Diffstat (limited to 'modules/admin-mini')
-rw-r--r--modules/admin-mini/luasrc/controller/mini/index.lua3
-rw-r--r--modules/admin-mini/luasrc/controller/mini/network.lua6
-rw-r--r--modules/admin-mini/luasrc/controller/mini/system.lua2
-rw-r--r--modules/admin-mini/luasrc/controller/mini/uci.lua88
-rw-r--r--modules/admin-mini/luasrc/view/mini/uci_apply.htm39
-rw-r--r--modules/admin-mini/luasrc/view/mini/uci_changes.htm39
-rw-r--r--modules/admin-mini/luasrc/view/mini/uci_revert.htm29
7 files changed, 5 insertions, 201 deletions
diff --git a/modules/admin-mini/luasrc/controller/mini/index.lua b/modules/admin-mini/luasrc/controller/mini/index.lua
index 4813b838ef..b538310aa0 100644
--- a/modules/admin-mini/luasrc/controller/mini/index.lua
+++ b/modules/admin-mini/luasrc/controller/mini/index.lua
@@ -31,12 +31,11 @@ function index()
page.i18n = "admin-core"
page.sysauth = "root"
page.sysauth_authenticator = "htmlauth"
- page.ucidata = true
page.index = true
entry({"mini", "index"}, alias("mini", "index", "index"), i18n("overview"), 10).index = true
entry({"mini", "index", "index"}, form("mini/index"), i18n("general"), 1).ignoreindex = true
- entry({"mini", "index", "luci"}, cbi("mini/luci"), i18n("settings"), 10)
+ entry({"mini", "index", "luci"}, cbi("mini/luci", {autoapply=true}), i18n("settings"), 10)
entry({"mini", "index", "logout"}, call("action_logout"), i18n("logout"))
end
diff --git a/modules/admin-mini/luasrc/controller/mini/network.lua b/modules/admin-mini/luasrc/controller/mini/network.lua
index 56ffc30f2c..ab933ccac3 100644
--- a/modules/admin-mini/luasrc/controller/mini/network.lua
+++ b/modules/admin-mini/luasrc/controller/mini/network.lua
@@ -20,7 +20,7 @@ function index()
local i18n = luci.i18n.translate
entry({"mini", "network"}, alias("mini", "network", "index"), i18n("network"), 20).index = true
- entry({"mini", "network", "index"}, cbi("mini/network"), i18n("general"), 1)
- entry({"mini", "network", "wifi"}, cbi("mini/wifi"), i18n("wifi"), 10).i18n="wifi"
- entry({"mini", "network", "dhcp"}, cbi("mini/dhcp"), "DHCP", 20)
+ entry({"mini", "network", "index"}, cbi("mini/network", {autoapply=true}), i18n("general"), 1)
+ entry({"mini", "network", "wifi"}, cbi("mini/wifi", {autoapply=true}), i18n("wifi"), 10).i18n="wifi"
+ entry({"mini", "network", "dhcp"}, cbi("mini/dhcp", {autoapply=true}), "DHCP", 20)
end \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua
index 9d0ef0c639..936d2634ac 100644
--- a/modules/admin-mini/luasrc/controller/mini/system.lua
+++ b/modules/admin-mini/luasrc/controller/mini/system.lua
@@ -20,7 +20,7 @@ function index()
local i18n = luci.i18n.translate
entry({"mini", "system"}, alias("mini", "system", "index"), i18n("system"), 40).index = true
- entry({"mini", "system", "index"}, cbi("mini/system"), i18n("general"), 1)
+ entry({"mini", "system", "index"}, cbi("mini/system", {autoapply=true}), i18n("general"), 1)
entry({"mini", "system", "passwd"}, form("mini/passwd"), i18n("a_s_changepw"), 10)
entry({"mini", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 80)
entry({"mini", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 90)
diff --git a/modules/admin-mini/luasrc/controller/mini/uci.lua b/modules/admin-mini/luasrc/controller/mini/uci.lua
deleted file mode 100644
index 4687c839d9..0000000000
--- a/modules/admin-mini/luasrc/controller/mini/uci.lua
+++ /dev/null
@@ -1,88 +0,0 @@
---[[
-LuCI - Lua Configuration Interface
-
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-]]--
-module("luci.controller.mini.uci", package.seeall)
-
-function index()
- local i18n = luci.i18n.translate
- local redir = luci.http.formvalue("redir", true) or
- luci.dispatcher.build_url(unpack(luci.dispatcher.context.request))
-
- entry({"mini", "uci"}, nil, i18n("config"))
- entry({"mini", "uci", "changes"}, call("action_changes"), i18n("changes"), 30).query = {redir=redir}
- entry({"mini", "uci", "revert"}, call("action_revert"), i18n("revert"), 20).query = {redir=redir}
- entry({"mini", "uci", "saveapply"}, call("action_apply"), i18n("saveapply"), 10).query = {redir=redir}
-end
-
-function convert_changes(changes)
- local util = require "luci.util"
-
- local ret
- for r, tbl in pairs(changes) do
- for s, os in pairs(tbl) do
- for o, v in pairs(os) do
- ret = (ret and ret.."\n" or "") .. "%s%s.%s%s%s" % {
- v == "" and "-" or "",
- r,
- s,
- o ~= ".type" and "."..o or "",
- v ~= "" and "="..util.pcdata(v) or ""
- }
- end
- end
- end
- return ret
-end
-
-function action_changes()
- local changes = convert_changes(luci.model.uci.cursor():changes())
- luci.template.render("mini/uci_changes", {changes=changes})
-end
-
-function action_apply()
- local path = luci.dispatcher.context.path
- local uci = luci.model.uci.cursor()
- local changes = uci:changes()
- local reload = {}
-
- -- Collect files to be applied and commit changes
- for r, tbl in pairs(changes) do
- table.insert(reload, r)
- uci:load(r)
- uci:commit(r)
- uci:unload(r)
- end
-
- local function _reload()
- local cmd = uci:apply(reload, true)
- return io.popen(cmd)
- end
-
- luci.template.render("mini/uci_apply", {changes=convert_changes(changes), reload=_reload})
-end
-
-
-function action_revert()
- local uci = luci.model.uci.cursor()
- local changes = uci:changes()
-
- -- Collect files to be reverted
- for r, tbl in pairs(changes) do
- uci:load(r)
- uci:revert(r)
- uci:unload(r)
- end
-
- luci.template.render("mini/uci_revert", {changes=convert_changes(changes)})
-end
diff --git a/modules/admin-mini/luasrc/view/mini/uci_apply.htm b/modules/admin-mini/luasrc/view/mini/uci_apply.htm
deleted file mode 100644
index a908b6a8b5..0000000000
--- a/modules/admin-mini/luasrc/view/mini/uci_apply.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-<%+header%>
-<div>
-<a href="<%=luci.http.formvalue("redir")%>">&lt;&lt; <%:back%></a>
-<br />
-<br />
-</div>
-<h2><a id="content" name="content"><%:config%></a></h2>
-<p><%:uci_applied%>:</p>
-<code><%=(changes or "-")%>
-
-<%
-local fp = reload()
-local line = fp:read()
-while line do
- write(line.."\n")
- line = fp:read()
-end
-fp:close()
-%></code>
-<div>
-<a href="<%=luci.http.formvalue("redir")%>">&lt;&lt; <%:back%></a>
-<br />
-<br />
-</div>
-<%+footer%> \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/view/mini/uci_changes.htm b/modules/admin-mini/luasrc/view/mini/uci_changes.htm
deleted file mode 100644
index 89df99daba..0000000000
--- a/modules/admin-mini/luasrc/view/mini/uci_changes.htm
+++ /dev/null
@@ -1,39 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-<%+header%>
-<div>
-<a href="<%=luci.http.formvalue("redir")%>">&lt;&lt; <%:back%></a>
-<br />
-<br />
-</div>
-<h2><a id="content" name="content"><%:config%></a></h2>
-<h3><%:changes%></h3>
-<code><%=changes%></code>
-<br /><br />
-<form class="inline" method="get" action="<%=controller%>/admin/uci/apply">
- <input type="submit" value="<%:apply%>" />
-</form>
-<form class="inline" method="get" action="<%=controller%>/admin/uci/saveapply">
- <input type="submit" value="<%:saveapply%>" />
-</form>
-<form class="inline" method="get" action="<%=controller%>/admin/uci/revert">
- <input type="submit" value="<%:revert%>" />
-</form>
-
-<div>
-<br />
-<a href="<%=luci.http.formvalue("redir")%>">&lt;&lt; <%:back%></a>
-</div>
-<%+footer%> \ No newline at end of file
diff --git a/modules/admin-mini/luasrc/view/mini/uci_revert.htm b/modules/admin-mini/luasrc/view/mini/uci_revert.htm
deleted file mode 100644
index e8515dc41c..0000000000
--- a/modules/admin-mini/luasrc/view/mini/uci_revert.htm
+++ /dev/null
@@ -1,29 +0,0 @@
-<%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
--%>
-<%+header%>
-<div>
-<a href="<%=luci.http.formvalue("redir")%>">&lt;&lt; <%:back%></a>
-<br />
-<br />
-</div>
-<h2><a id="content" name="content"><%:config%></a></h2>
-<p><%:uci_reverted%>:</p>
-<code><%=(changes or "-")%></code>
-<div>
-<a href="<%=luci.http.formvalue("redir")%>">&lt;&lt; <%:back%></a>
-<br />
-<br />
-</div>
-<%+footer%> \ No newline at end of file