NIU: More restructuring, Add: change password, hostname
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / system / general1.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local fs = require "nixio.fs"
16 local i18n = require "luci.i18n"
17 local util = require "luci.util"
18 local config = require "luci.config"
19
20 m = Map("luci", "Device Settings")
21
22 c = m:section(NamedSection, "main", "core", translate("Local Settings"))
23
24 hn = c:option(Value, "_uniquename", translate("Unique Devicename"))
25 function hn:cfgvalue(self)
26         return require "nixio.fs".readfile("/proc/sys/kernel/hostname")
27 end
28
29 l = c:option(ListValue, "lang", translate("System Language"))
30 l:value("auto")
31
32 local i18ndir = i18n.i18ndir .. "default."
33 for k, v in util.kspairs(config.languages) do
34         local file = i18ndir .. k:gsub("_", "-")
35         if k:sub(1, 1) ~= "." and fs.access(file .. ".lmo") then
36                 l:value(k, v)
37         end
38 end
39
40 pw1 = c:option(Value, "_pw1", translate("Administrator Password"))
41 pw1.password = true
42 pw1.default = "**********"
43
44
45 return m