remove .i18n annotations from controller files
[project/luci.git] / modules / freifunk / luasrc / model / cbi / freifunk / profile.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2011-2012 Manuel Munz <freifunk at somakoma dot de>
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         httc://www.apache.org/licenses/LICENSE-2.0
11 ]]--
12
13 local uci = require "luci.model.uci".cursor()
14 local ipkg = require "luci.model.ipkg"
15 local community = uci:get("freifunk", "community", "name")
16
17 if community == nil then
18         luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
19         return
20 else
21         community = "profile_" .. community
22         m = Map(community, translate("Community settings"), translate("These are the settings of your local community."))
23         c = m:section(NamedSection, "profile", "community")
24
25         local name = c:option(Value, "name", "Name")
26         name.rmempty = false
27
28         local homepage = c:option(Value, "homepage", translate("Homepage"))
29
30         local cc = c:option(Value, "country", translate("Country code"))
31         function cc.cfgvalue(self, section)
32                 return uci:get(community, "wifi_device", "country")
33         end
34         function cc.write(self, sec, value)
35                 if value then
36                         uci:set(community, "wifi_device", "country", value)
37                         uci:save(community)
38                 end
39         end
40
41         local ssid = c:option(Value, "ssid", translate("ESSID"))
42         ssid.rmempty = false
43
44         local prefix = c:option(Value, "mesh_network", translate("Mesh prefix"))
45         prefix.datatype = "ip4addr"
46         prefix.rmempty = false
47
48         local splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses"))
49         splash_net.datatype = "ip4addr"
50         splash_net.rmempty = false
51
52         local splash_prefix = c:option(Value, "splash_prefix", translate("Client network size"))
53         splash_prefix.datatype = "range(0,32)"
54         splash_prefix.rmempty = false
55
56         local ipv6 = c:option(Flag, "ipv6", translate("Enable IPv6"))
57         ipv6.rmempty = true
58
59         local ipv6_config = c:option(ListValue, "ipv6_config", translate("IPv6 Config"))
60         ipv6_config:depends("ipv6", 1)
61         ipv6_config:value("static")
62         if ipkg.installed ("auto-ipv6-ib") then
63                 ipv6_config:value("auto-ipv6-random")
64                 ipv6_config:value("auto-ipv6-fromv4")
65         end
66         ipv6_config.rmempty = true
67
68         local ipv6_prefix = c:option(Value, "ipv6_prefix", translate("IPv6 Prefix"), translate("IPv6 network in CIDR notation."))
69         ipv6_prefix:depends("ipv6", 1)
70         ipv6_prefix.datatype = "ip6addr"
71         ipv6_prefix.rmempty = true
72
73         local lat = c:option(Value, "latitude", translate("Latitude"))
74         lat.datatype = "range(-180, 180)"
75         lat.rmempty = false
76
77         local lon = c:option(Value, "longitude", translate("Longitude"))
78         lon.rmempty = false
79         return m
80 end