modules/freifunk: Change default netmask to 255.255.0.0, change non-working dns,...
[project/luci.git] / modules / freifunk / luasrc / model / cbi / freifunk / profile.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2011 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 community = uci:get("freifunk", "community", "name")
15
16 if community == nil then
17         luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
18         return
19 else
20         community = "profile_" .. community
21         m = Map(community, translate("Community settings"), translate("These are the settings of your local community."))
22         c = m:section(NamedSection, "profile", "community")
23
24         name = c:option(Value, "name", "Name")
25         name.rmempty = false
26
27         homepage = c:option(Value, "homepage", translate("Homepage"))
28
29         cc = c:option(Value, "country", translate("Country code"))
30         function cc.cfgvalue(self, section)
31                 return uci:get(community, "wifi_device", "country")
32         end
33         function cc.write(self, sec, value)
34                 if value then
35                         uci:set(community, "wifi_device", "country", value)
36                         uci:save(community)
37                 end
38         end
39
40         ssid = c:option(Value, "ssid", translate("ESSID"))
41         ssid.rmempty = false
42
43         prefix = c:option(Value, "mesh_network", translate("Mesh prefix"))
44         prefix.rmempty = false
45
46         splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses"))
47         splash_net.rmempty = false
48
49         splash_prefix = c:option(Value, "splash_prefix", translate("Client network size"))
50         splash_prefix.rmempty = false
51
52         lat = c:option(Value, "latitude", translate("Latitude"))
53         lat.rmempty = false
54
55         lon = c:option(Value, "longitude", translate("Longitude"))
56         lon.rmempty = false
57         return m
58 end