Changeset 6918

Show
Ignore:
Timestamp:
02/19/11 16:54:16 (2 years ago)
Author:
soma
Message:

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

Location:
luci/trunk/modules/freifunk
Files:
1 added
18 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/modules/freifunk/luasrc/controller/freifunk/freifunk.lua

    r6863 r6918  
    9999    entry({"freifunk", "map"}, template("freifunk-map/frame"), i18n("Map"), 50) 
    100100    entry({"freifunk", "map", "content"}, template("freifunk-map/map"), nil, 51) 
     101    entry({"admin", "freifunk", "profile_error"}, template("freifunk/profile_error")) 
    101102end 
    102103 
  • luci/trunk/modules/freifunk/luasrc/model/cbi/freifunk/profile.lua

    r6804 r6918  
    1212 
    1313local uci = require "luci.model.uci".cursor() 
    14 local community = "profile_" .. uci:get("freifunk", "community", "name") 
    15 --local community = "profile_augsburg" 
     14local community = uci:get("freifunk", "community", "name") 
    1615 
     16if community == nil then 
     17    luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error")) 
     18    return 
     19else 
     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") 
    1723 
    18 m = Map(community, translate("Community settings"), translate("These are the settings of your local community.")) 
     24    name = c:option(Value, "name", "Name") 
     25    name.rmempty = false 
    1926 
    20 c = m:section(NamedSection, "profile", "community") 
     27    homepage = c:option(Value, "homepage", translate("Homepage")) 
    2128 
    22 name = c:option(Value, "name", "Name") 
    23 name.rmempty = false 
     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 
    2439 
    25 homepage = c:option(Value, "homepage", translate("Homepage")) 
     40    ssid = c:option(Value, "ssid", translate("ESSID")) 
     41    ssid.rmempty = false 
    2642 
    27 cc = c:option(Value, "country", translate("Country code")) 
    28 function cc.cfgvalue(self, section) 
    29     return uci:get(community, "wifi_device", "country") 
     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 
    3058end 
    31 function cc.write(self, sec, value) 
    32     if value then 
    33         uci:set(community, "wifi_device", "country", value) 
    34         uci:save(community) 
    35     end 
    36 end 
    37  
    38 ssid = c:option(Value, "ssid", translate("ESSID")) 
    39 ssid.rmempty = false 
    40  
    41 prefix = c:option(Value, "mesh_network", translate("Mesh prefix")) 
    42 prefix.rmempty = false 
    43  
    44 splash_net = c:option(Value, "splash_network", translate("Network for client DHCP addresses")) 
    45 splash_net.rmempty = false 
    46  
    47 splash_prefix = c:option(Value, "splash_prefix", translate("Client network size")) 
    48 splash_prefix.rmempty = false 
    49  
    50 lat = c:option(Value, "latitude", translate("Latitude")) 
    51 lat.rmempty = false 
    52  
    53 lon = c:option(Value, "longitude", translate("Longitude")) 
    54 lon.rmempty = false 
    55 return m 
  • luci/trunk/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua

    r6804 r6918  
    1313local fs = require "nixio.fs" 
    1414local uci = require "luci.model.uci".cursor() 
    15 local community = "/etc/config/profile_" .. uci:get("freifunk", "community", "name") 
     15local community = uci:get("freifunk", "community", "name") 
    1616 
    17 f = SimpleForm("community", translate("Community profile"),  
    18     translate("You can manually edit the selected community profile here.")) 
     17if community == nil then 
     18        luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error")) 
     19        return 
     20else 
     21        community = "/etc/config/profile_" .. community 
     22    f = SimpleForm("community", translate("Community profile"), translate("You can manually edit the selected community profile here.")) 
    1923 
    20 t = f:field(TextValue, "cop") 
    21 t.rmempty = true 
    22 t.rows = 30 
    23 function t.cfgvalue() 
    24     return fs.readfile(community) or "" 
     24    t = f:field(TextValue, "cop") 
     25    t.rmempty = true 
     26    t.rows = 30 
     27    function t.cfgvalue() 
     28        return fs.readfile(community) or "" 
     29    end 
     30 
     31    function f.handle(self, state, data) 
     32        if state == FORM_VALID then 
     33            if data.cop then 
     34                fs.writefile(cop, data.rcs:gsub("\r\n", "\n")) 
     35            end 
     36        end 
     37        return true 
     38    end 
     39    return f 
    2540end 
    2641 
    27 function f.handle(self, state, data) 
    28     if state == FORM_VALID then 
    29         if data.cop then 
    30             fs.writefile(cop, data.rcs:gsub("\r\n", "\n")) 
    31         end 
    32     end 
    33     return true 
    34 end 
    35  
    36 return f 
    37  
  • luci/trunk/modules/freifunk/root/etc/config/freifunk

    r6890 r6918  
    7171 
    7272config 'defaults' 'interface' 
    73     option 'netmask' '255.0.0.0' 
    74     option 'dns' '88.198.178.18 141.54.1.1 212.204.49.83 208.67.220.220 208.67.222.222' 
     73    option 'netmask' '255.255.0.0' 
     74    option 'dns' '8.8.8.8 212.204.49.83 141.1.1.1' 
    7575 
    7676config 'defaults' 'alias' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_aachen

    r6916 r6918  
    88    option 'splash_network' '10.104.0.0/16' 
    99    option 'splash_prefix' '28' 
    10  
    11 config 'defaults' 'interface' 
    12     option 'netmask' '255.255.0.0' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_bergischesland

    r6860 r6918  
    1414config 'defaults' 'wifi_iface' 
    1515    option 'bssid' '02:40:00:42:42:42' 
    16  
    17 config 'defaults' 'interface' 
    18     option 'netmask' '255.255.0.0' 
    19  
  • luci/trunk/modules/freifunk/root/etc/config/profile_berlin

    r6791 r6918  
    1111config 'defaults' 'wifi_device' 
    1212    option 'channel' '10' 
     13 
     14config 'defaults' 'interface' 
     15        option 'netmask' '255.0.0.0' 
     16 
  • luci/trunk/modules/freifunk/root/etc/config/profile_duesseldorf

    r6791 r6918  
    99    option 'longitude' '6.78449' 
    1010 
    11 config 'defaults' 'interface' 
    12     option 'netmask' '255.255.0.0' 
    13  
    1411config 'defaults' 'wifi_device' 
    1512    option 'channel' '3' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_hannover

    r6791 r6918  
    1111config 'defaults' 'wifi_iface' 
    1212    option 'bssid' 'CA:FF:EE:CA:FF:EE' 
    13  
    14 config 'defaults' 'interface' 
    15     option 'netmask' '255.255.0.0' 
    16  
  • luci/trunk/modules/freifunk/root/etc/config/profile_kiberpipa

    r6791 r6918  
    1414config 'defaults' 'interface' 
    1515    option 'dns' '10.14.0.1 208.67.222.220 208.67.220.222' 
    16     option 'netmask' '255.255.0.0' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_mainz

    r6791 r6918  
    1414config 'defaults' 'wifi_device' 
    1515    option 'channel' '1' 
    16  
    17 config 'defaults' 'interface' 
    18     option 'netmask' '255.255.0.0' 
    19  
  • luci/trunk/modules/freifunk/root/etc/config/profile_marburg

    r6791 r6918  
    1111config 'defaults' 'interface' 
    1212    option 'dns' '8.8.8.8 212.204.49.83' 
    13         option 'netmask' '255.255.0.0' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_neuss

    r6791 r6918  
    1212    option 'channel' '11' 
    1313 
    14 config 'defaults' 'interface' 
    15     option 'netmask' '255.255.0.0' 
    16  
    1714config 'defaults' 'wifi_iface' 
    1815    option 'bssid' 'DE:AD:BE:EF:CA:FE' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_openwireless_bern

    r6791 r6918  
    1010 
    1111config 'defaults' 'interface' 
    12     option 'netmask' '255.255.0.0' 
    1312    option 'dns' '208.67.222.222 208.67.220.220' 
    1413 
  • luci/trunk/modules/freifunk/root/etc/config/profile_potsdam

    r6791 r6918  
    99    option 'longitude' '13.06489' 
    1010 
    11 config 'defaults' 'interface' 
    12     option 'netmask' '255.255.0.0' 
    13  
    1411config 'defaults' 'wifi_device' 
    1512    option 'channel' '13' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_rosbach

    r6791 r6918  
    1414config 'defaults' 'wifi_iface' 
    1515    option 'bssid' 'D2:CA:FF:EE:BA:BE' 
    16  
    17 config 'defaults' 'interface' 
    18         option 'netmask' '255.255.0.0' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_seefeld

    r6791 r6918  
    99    option 'longitude' '11.21279' 
    1010 
    11 config 'defaults' 'interface' 
    12     option 'netmask' '255.255.255.0' 
    13  
    1411config 'defaults' 'wifi_device' 
    1512    option 'channel' '1' 
  • luci/trunk/modules/freifunk/root/etc/config/profile_wlanljubljana

    r6791 r6918  
    1414config 'defaults' 'interface' 
    1515    option 'dns' '10.254.0.1 10.254.0.2' 
    16     option 'netmask' '255.255.0.0'