summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2011-02-19 14:54:16 +0000
committerManuel Munz <freifunk@somakoma.de>2011-02-19 14:54:16 +0000
commit1a87c7b347da6dfdec72df261140c5b46088fdc5 (patch)
tree5b5ec93fc0e1bedae266d4114990ace1b0b31122 /modules/freifunk
parentf9563981b85a91b8d5b338de0c7b6fc2a20da88c (diff)
modules/freifunk: Change default netmask to 255.255.0.0, change non-working dns, show error when user tries to edit profiles but there is no profile set yet
Diffstat (limited to 'modules/freifunk')
-rw-r--r--modules/freifunk/luasrc/controller/freifunk/freifunk.lua1
-rw-r--r--modules/freifunk/luasrc/model/cbi/freifunk/profile.lua65
-rw-r--r--modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua40
-rw-r--r--modules/freifunk/luasrc/view/freifunk/profile_error.htm11
-rw-r--r--modules/freifunk/root/etc/config/freifunk4
-rw-r--r--modules/freifunk/root/etc/config/profile_aachen3
-rw-r--r--modules/freifunk/root/etc/config/profile_bergischesland4
-rw-r--r--modules/freifunk/root/etc/config/profile_berlin4
-rw-r--r--modules/freifunk/root/etc/config/profile_duesseldorf3
-rw-r--r--modules/freifunk/root/etc/config/profile_hannover4
-rw-r--r--modules/freifunk/root/etc/config/profile_kiberpipa1
-rw-r--r--modules/freifunk/root/etc/config/profile_mainz4
-rw-r--r--modules/freifunk/root/etc/config/profile_marburg1
-rw-r--r--modules/freifunk/root/etc/config/profile_neuss3
-rw-r--r--modules/freifunk/root/etc/config/profile_openwireless_bern1
-rw-r--r--modules/freifunk/root/etc/config/profile_potsdam3
-rw-r--r--modules/freifunk/root/etc/config/profile_rosbach3
-rw-r--r--modules/freifunk/root/etc/config/profile_seefeld3
-rw-r--r--modules/freifunk/root/etc/config/profile_wlanljubljana1
19 files changed, 74 insertions, 85 deletions
diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua
index f3538a1f11..e8cd19b656 100644
--- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua
+++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua
@@ -98,6 +98,7 @@ function index()
entry({"freifunk", "map"}, template("freifunk-map/frame"), i18n("Map"), 50)
entry({"freifunk", "map", "content"}, template("freifunk-map/map"), nil, 51)
+ entry({"admin", "freifunk", "profile_error"}, template("freifunk/profile_error"))
end
local function fetch_olsrd()
diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua b/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua
index 54e32b685f..5e5cc21daf 100644
--- a/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua
+++ b/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua
@@ -11,45 +11,48 @@ You may obtain a copy of the License at
]]--
local uci = require "luci.model.uci".cursor()
-local community = "profile_" .. uci:get("freifunk", "community", "name")
---local community = "profile_augsburg"
+local community = uci:get("freifunk", "community", "name")
+if community == nil then
+ luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
+ return
+else
+ community = "profile_" .. community
+ m = Map(community, translate("Community settings"), translate("These are the settings of your local community."))
+ c = m:section(NamedSection, "profile", "community")
-m = Map(community, translate("Community settings"), translate("These are the settings of your local community."))
+ name = c:option(Value, "name", "Name")
+ name.rmempty = false
-c = m:section(NamedSection, "profile", "community")
+ homepage = c:option(Value, "homepage", translate("Homepage"))
-name = c:option(Value, "name", "Name")
-name.rmempty = false
-
-homepage = c:option(Value, "homepage", translate("Homepage"))
-
-cc = c:option(Value, "country", translate("Country code"))
-function cc.cfgvalue(self, section)
- return uci:get(community, "wifi_device", "country")
-end
-function cc.write(self, sec, value)
- if value then
- uci:set(community, "wifi_device", "country", value)
- uci:save(community)
+ cc = c:option(Value, "country", translate("Country code"))
+ function cc.cfgvalue(self, section)
+ return uci:get(community, "wifi_device", "country")
+ end
+ function cc.write(self, sec, value)
+ if value then
+ uci:set(community, "wifi_device", "country", value)
+ uci:save(community)
+ end
end
-end
-ssid = c:option(Value, "ssid", translate("ESSID"))
-ssid.rmempty = false
+ ssid = c:option(Value, "ssid", translate("ESSID"))
+ ssid.rmempty = false
-prefix = c:option(Value, "mesh_network", translate("Mesh prefix"))
-prefix.rmempty = false
+ prefix = c:option(Value, "mesh_network", translate("Mesh prefix"))
+ prefix.rmempty = false
-splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses"))
-splash_net.rmempty = false
+ splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses"))
+ splash_net.rmempty = false
-splash_prefix = c:option(Value, "splash_prefix", translate("Client network size"))
-splash_prefix.rmempty = false
+ splash_prefix = c:option(Value, "splash_prefix", translate("Client network size"))
+ splash_prefix.rmempty = false
-lat = c:option(Value, "latitude", translate("Latitude"))
-lat.rmempty = false
+ lat = c:option(Value, "latitude", translate("Latitude"))
+ lat.rmempty = false
-lon = c:option(Value, "longitude", translate("Longitude"))
-lon.rmempty = false
-return m
+ lon = c:option(Value, "longitude", translate("Longitude"))
+ lon.rmempty = false
+ return m
+end
diff --git a/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua b/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua
index d737132b0b..a0b8f34bc9 100644
--- a/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua
+++ b/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua
@@ -12,26 +12,30 @@ You may obtain a copy of the License at
local fs = require "nixio.fs"
local uci = require "luci.model.uci".cursor()
-local community = "/etc/config/profile_" .. uci:get("freifunk", "community", "name")
-
-f = SimpleForm("community", translate("Community profile"),
- translate("You can manually edit the selected community profile here."))
-
-t = f:field(TextValue, "cop")
-t.rmempty = true
-t.rows = 30
-function t.cfgvalue()
- return fs.readfile(community) or ""
-end
+local community = uci:get("freifunk", "community", "name")
+
+if community == nil then
+ luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
+ return
+else
+ community = "/etc/config/profile_" .. community
+ f = SimpleForm("community", translate("Community profile"), translate("You can manually edit the selected community profile here."))
+
+ t = f:field(TextValue, "cop")
+ t.rmempty = true
+ t.rows = 30
+ function t.cfgvalue()
+ return fs.readfile(community) or ""
+ end
-function f.handle(self, state, data)
- if state == FORM_VALID then
- if data.cop then
- fs.writefile(cop, data.rcs:gsub("\r\n", "\n"))
+ function f.handle(self, state, data)
+ if state == FORM_VALID then
+ if data.cop then
+ fs.writefile(cop, data.rcs:gsub("\r\n", "\n"))
+ end
end
+ return true
end
- return true
+ return f
end
-return f
-
diff --git a/modules/freifunk/luasrc/view/freifunk/profile_error.htm b/modules/freifunk/luasrc/view/freifunk/profile_error.htm
new file mode 100644
index 0000000000..984fa0acfc
--- /dev/null
+++ b/modules/freifunk/luasrc/view/freifunk/profile_error.htm
@@ -0,0 +1,11 @@
+<%+header%>
+
+<%
+local profileurl = luci.dispatcher.build_url(luci.dispatcher.context.path[1], "freifunk", "basics")
+%>
+
+<h2><%:Error%></h2>
+<%:You need to select a profile before you can edit it. To select a profile go to%> <a href='<%=profileurl%>'><%:Basic settings%></a>.
+<p/>
+
+<%+footer%>
diff --git a/modules/freifunk/root/etc/config/freifunk b/modules/freifunk/root/etc/config/freifunk
index b0009703f8..9aa3f27c34 100644
--- a/modules/freifunk/root/etc/config/freifunk
+++ b/modules/freifunk/root/etc/config/freifunk
@@ -70,8 +70,8 @@ config 'defaults' 'wifi_iface'
option 'sw_merge' '1'
config 'defaults' 'interface'
- option 'netmask' '255.0.0.0'
- option 'dns' '88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222'
+ option 'netmask' '255.255.0.0'
+ option 'dns' '8.8.8.8 212.204.49.83 141.1.1.1'
config 'defaults' 'alias'
option 'netmask' '255.255.255.0'
diff --git a/modules/freifunk/root/etc/config/profile_aachen b/modules/freifunk/root/etc/config/profile_aachen
index 99baa9e2f6..f78d9f95a3 100644
--- a/modules/freifunk/root/etc/config/profile_aachen
+++ b/modules/freifunk/root/etc/config/profile_aachen
@@ -7,6 +7,3 @@ config 'community' 'profile'
option 'mesh_network' '10.90.0.0/16'
option 'splash_network' '10.104.0.0/16'
option 'splash_prefix' '28'
-
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
diff --git a/modules/freifunk/root/etc/config/profile_bergischesland b/modules/freifunk/root/etc/config/profile_bergischesland
index 46ad71ceb2..0de4543039 100644
--- a/modules/freifunk/root/etc/config/profile_bergischesland
+++ b/modules/freifunk/root/etc/config/profile_bergischesland
@@ -13,7 +13,3 @@ config 'defaults' 'wifi_device'
config 'defaults' 'wifi_iface'
option 'bssid' '02:40:00:42:42:42'
-
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
-
diff --git a/modules/freifunk/root/etc/config/profile_berlin b/modules/freifunk/root/etc/config/profile_berlin
index a37a6cb230..c41144e48b 100644
--- a/modules/freifunk/root/etc/config/profile_berlin
+++ b/modules/freifunk/root/etc/config/profile_berlin
@@ -10,3 +10,7 @@ config 'community' 'profile'
config 'defaults' 'wifi_device'
option 'channel' '10'
+
+config 'defaults' 'interface'
+ option 'netmask' '255.0.0.0'
+
diff --git a/modules/freifunk/root/etc/config/profile_duesseldorf b/modules/freifunk/root/etc/config/profile_duesseldorf
index 64ebbac81d..73273957c6 100644
--- a/modules/freifunk/root/etc/config/profile_duesseldorf
+++ b/modules/freifunk/root/etc/config/profile_duesseldorf
@@ -8,9 +8,6 @@ config 'community' 'profile'
option 'latitude' '51.22347'
option 'longitude' '6.78449'
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
-
config 'defaults' 'wifi_device'
option 'channel' '3'
diff --git a/modules/freifunk/root/etc/config/profile_hannover b/modules/freifunk/root/etc/config/profile_hannover
index 99f2c46f1c..008b6c70e3 100644
--- a/modules/freifunk/root/etc/config/profile_hannover
+++ b/modules/freifunk/root/etc/config/profile_hannover
@@ -10,7 +10,3 @@ config 'community' 'profile'
config 'defaults' 'wifi_iface'
option 'bssid' 'CA:FF:EE:CA:FF:EE'
-
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
-
diff --git a/modules/freifunk/root/etc/config/profile_kiberpipa b/modules/freifunk/root/etc/config/profile_kiberpipa
index 628850a9f6..c2a96e47cc 100644
--- a/modules/freifunk/root/etc/config/profile_kiberpipa
+++ b/modules/freifunk/root/etc/config/profile_kiberpipa
@@ -13,4 +13,3 @@ config 'defaults' 'wifi_device'
config 'defaults' 'interface'
option 'dns' '10.14.0.1 208.67.222.220 208.67.220.222'
- option 'netmask' '255.255.0.0'
diff --git a/modules/freifunk/root/etc/config/profile_mainz b/modules/freifunk/root/etc/config/profile_mainz
index c6cd61df1e..2d086183e1 100644
--- a/modules/freifunk/root/etc/config/profile_mainz
+++ b/modules/freifunk/root/etc/config/profile_mainz
@@ -13,7 +13,3 @@ config 'defaults' 'wifi_iface'
config 'defaults' 'wifi_device'
option 'channel' '1'
-
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
-
diff --git a/modules/freifunk/root/etc/config/profile_marburg b/modules/freifunk/root/etc/config/profile_marburg
index 21ad644e22..18cff80e59 100644
--- a/modules/freifunk/root/etc/config/profile_marburg
+++ b/modules/freifunk/root/etc/config/profile_marburg
@@ -10,4 +10,3 @@ config 'community' 'profile'
config 'defaults' 'interface'
option 'dns' '8.8.8.8 212.204.49.83'
- option 'netmask' '255.255.0.0'
diff --git a/modules/freifunk/root/etc/config/profile_neuss b/modules/freifunk/root/etc/config/profile_neuss
index 5f97d879ad..8e30617305 100644
--- a/modules/freifunk/root/etc/config/profile_neuss
+++ b/modules/freifunk/root/etc/config/profile_neuss
@@ -11,8 +11,5 @@ config 'community' 'profile'
config 'defaults' 'wifi_device'
option 'channel' '11'
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
-
config 'defaults' 'wifi_iface'
option 'bssid' 'DE:AD:BE:EF:CA:FE'
diff --git a/modules/freifunk/root/etc/config/profile_openwireless_bern b/modules/freifunk/root/etc/config/profile_openwireless_bern
index b9f5cbd76e..810ad8f1cc 100644
--- a/modules/freifunk/root/etc/config/profile_openwireless_bern
+++ b/modules/freifunk/root/etc/config/profile_openwireless_bern
@@ -9,7 +9,6 @@ config 'community' 'profile'
option 'longitude' '8.769239'
config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
option 'dns' '208.67.222.222 208.67.220.220'
config 'defaults' 'wifi_device'
diff --git a/modules/freifunk/root/etc/config/profile_potsdam b/modules/freifunk/root/etc/config/profile_potsdam
index ff1d661ab1..a70a29ee54 100644
--- a/modules/freifunk/root/etc/config/profile_potsdam
+++ b/modules/freifunk/root/etc/config/profile_potsdam
@@ -8,8 +8,5 @@ config 'community' 'profile'
option 'latitude' '52.39349'
option 'longitude' '13.06489'
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
-
config 'defaults' 'wifi_device'
option 'channel' '13'
diff --git a/modules/freifunk/root/etc/config/profile_rosbach b/modules/freifunk/root/etc/config/profile_rosbach
index ec072811a2..4444f70998 100644
--- a/modules/freifunk/root/etc/config/profile_rosbach
+++ b/modules/freifunk/root/etc/config/profile_rosbach
@@ -13,6 +13,3 @@ config 'defaults' 'wifi_device'
config 'defaults' 'wifi_iface'
option 'bssid' 'D2:CA:FF:EE:BA:BE'
-
-config 'defaults' 'interface'
- option 'netmask' '255.255.0.0'
diff --git a/modules/freifunk/root/etc/config/profile_seefeld b/modules/freifunk/root/etc/config/profile_seefeld
index f88562d6f0..5d03f7d046 100644
--- a/modules/freifunk/root/etc/config/profile_seefeld
+++ b/modules/freifunk/root/etc/config/profile_seefeld
@@ -8,9 +8,6 @@ config 'community' 'profile'
option 'latitude' '48.03485'
option 'longitude' '11.21279'
-config 'defaults' 'interface'
- option 'netmask' '255.255.255.0'
-
config 'defaults' 'wifi_device'
option 'channel' '1'
option 'bssid' '02:CA:FF:EE:BA:BB'
diff --git a/modules/freifunk/root/etc/config/profile_wlanljubljana b/modules/freifunk/root/etc/config/profile_wlanljubljana
index 9d76eeb673..eeefbd22b6 100644
--- a/modules/freifunk/root/etc/config/profile_wlanljubljana
+++ b/modules/freifunk/root/etc/config/profile_wlanljubljana
@@ -13,4 +13,3 @@ config 'defaults' 'wifi_device'
config 'defaults' 'interface'
option 'dns' '10.254.0.1 10.254.0.2'
- option 'netmask' '255.255.0.0'