Show
Ignore:
Timestamp:
02/19/11 15: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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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