summaryrefslogtreecommitdiffhomepage
path: root/modules/niu/luasrc/model
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-11-12 17:45:08 +0000
committerSteven Barth <steven@midlink.org>2009-11-12 17:45:08 +0000
commit7da7ada00b6e8849e9a64bfe825b25d119879c74 (patch)
treee2c7b5646d1529121129dde47daa2c959ec976b9 /modules/niu/luasrc/model
parente8255eab66184ab843012e0523567261a58fea90 (diff)
NIU: More restructuring, Add: change password, hostname
Diffstat (limited to 'modules/niu/luasrc/model')
-rw-r--r--modules/niu/luasrc/model/cbi/niu/network/lan1.lua12
-rw-r--r--modules/niu/luasrc/model/cbi/niu/system/general.lua21
-rw-r--r--modules/niu/luasrc/model/cbi/niu/system/general1.lua28
3 files changed, 39 insertions, 22 deletions
diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua b/modules/niu/luasrc/model/cbi/niu/network/lan1.lua
index 19f8230b92..77b0fa76e8 100644
--- a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua
+++ b/modules/niu/luasrc/model/cbi/niu/network/lan1.lua
@@ -17,11 +17,11 @@ local nw = require "luci.model.network"
local has_ipv6 = nw:has_ipv6()
-m = Map("network", translate("m_n_lan"))
+m = Map("network", "Local Network")
nw.init(m.uci)
-s = m:section(NamedSection, "lan", "interface")
+s = m:section(NamedSection, "lan", "interface", "Network Settings")
s.addremove = false
s:tab("general", translate("General Settings"))
@@ -80,9 +80,9 @@ for _, d in ipairs(nw:get_interfaces()) do
end
-m2 = Map("dhcp", "DHCP")
+m2 = Map("dhcp")
-s = m2:section(TypedSection, "dhcp", "DHCP-Server")
+s = m2:section(TypedSection, "dhcp", "DHCP")
s.anonymous = true
s.addremove = false
s.dynamic = false
@@ -91,7 +91,7 @@ s:tab("general", translate("General Settings"))
s:depends("interface", "lan")
-enable = s:taboption("general", ListValue, "ignore", translate("enable"), "")
+enable = s:taboption("general", ListValue, "ignore", "Automatic address assignment for network devices", "")
enable:value(0, translate("enable"))
enable:value(1, translate("disable"))
@@ -99,7 +99,7 @@ enable:value(1, translate("disable"))
s:tab("expert", translate("Expert Settings"))
start = s:taboption("expert", Value, "start", translate("First leased address"))
limit = s:taboption("expert", Value, "limit", translate("Number of leased addresses"), "")
-time = s:taboption("expert", Value, "leasetime")
+time = s:taboption("expert", Value, "leasetime", "Lease Time")
return m, m2
diff --git a/modules/niu/luasrc/model/cbi/niu/system/general.lua b/modules/niu/luasrc/model/cbi/niu/system/general.lua
index df438e8b5a..046691c9c0 100644
--- a/modules/niu/luasrc/model/cbi/niu/system/general.lua
+++ b/modules/niu/luasrc/model/cbi/niu/system/general.lua
@@ -7,11 +7,28 @@ d.allow_cancel = true
d:add("general1", load("niu/system/general1"))
function d.on_cancel()
- cursor:revert("system")
+ cursor:revert("luci")
end
function d.on_done()
- cursor:commit("system")
+ local pw1 = cursor:get("luci", "main", "_pw1")
+ if pw1 and pw1 ~= "**********" then
+ cursor:delete("luci", "main", "_pw1")
+ require "luci.sys".user.setpasswd("root", pw1)
+ end
+
+ local hn = cursor:get("luci", "main", "_uniquename")
+ if hn then
+ cursor:foreach("system", "system", function(s)
+ cursor:set("system", s[".name"], "hostname", hn)
+ end)
+ cursor:commit("system")
+
+ require "nixio.fs".writefile("/proc/sys/kernel/hostname", hn)
+ cursor:delete("luci", "main", "_uniquename")
+ end
+
+ cursor:commit("luci")
end
return d \ No newline at end of file
diff --git a/modules/niu/luasrc/model/cbi/niu/system/general1.lua b/modules/niu/luasrc/model/cbi/niu/system/general1.lua
index 532583828e..83481888ce 100644
--- a/modules/niu/luasrc/model/cbi/niu/system/general1.lua
+++ b/modules/niu/luasrc/model/cbi/niu/system/general1.lua
@@ -17,22 +17,16 @@ local i18n = require "luci.i18n"
local util = require "luci.util"
local config = require "luci.config"
-m = Map("system", translate("System"))
+m = Map("luci", "Device Settings")
-s = m:section(TypedSection, "system", "")
-s.anonymous = true
-s.addremove = false
+c = m:section(NamedSection, "main", "core", translate("Local Settings"))
-hn = s:option(Value, "hostname", translate("Hostname"))
-
-
-
-m2 = Map("luci", translate("Web <abbr title=\"User Interface\">UI</abbr>"))
-
-
-c = m2:section(NamedSection, "main", "core")
+hn = c:option(Value, "_uniquename", translate("Unique Devicename"))
+function hn:cfgvalue(self)
+ return require "nixio.fs".readfile("/proc/sys/kernel/hostname")
+end
-l = c:option(ListValue, "lang", translate("Language"))
+l = c:option(ListValue, "lang", translate("System Language"))
l:value("auto")
local i18ndir = i18n.i18ndir .. "default."
@@ -42,4 +36,10 @@ for k, v in util.kspairs(config.languages) do
l:value(k, v)
end
end
-return m, m2
+
+pw1 = c:option(Value, "_pw1", translate("Administrator Password"))
+pw1.password = true
+pw1.default = "**********"
+
+
+return m