modules/admin-full: Improved system configuration page
[project/luci.git] / modules / admin-mini / luasrc / model / cbi / mini / system.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 require("luci.http.protocol.date")
15
16 m = Map("system", translate("system"), translate("a_s_desc"))
17
18 s = m:section(TypedSection, "system", "")
19 s.anonymous = true
20
21 s:option(Value, "hostname", translate("hostname"))
22
23 tz = s:option(ListValue, "timezone", translate("timezone"))
24 for k, offset in luci.util.vspairs(luci.http.protocol.date.TZ) do
25         local zone = k:upper()  
26         local osgn = (offset > 0 and "+" or "")
27         local ohrs = math.floor(offset / 3600)
28         local omin = (offset % 3600) / 60
29         
30         local ptz = zone .. osgn .. (ohrs ~= 0 and ohrs or "") .. (omin ~= 0 and ":" .. omin or "")
31         local dtz = string.format("%+03d:%02d ", ohrs, omin) .. zone
32         
33         tz:value(ptz, dtz)
34 end
35
36 return m