- Timestamp:
- 02/19/11 15:54:16 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
luci/trunk/modules/freifunk/luasrc/model/cbi/freifunk/profile_expert.lua
r6804 r6918 13 13 local fs = require "nixio.fs" 14 14 local uci = require "luci.model.uci".cursor() 15 local community = "/etc/config/profile_" ..uci:get("freifunk", "community", "name")15 local community = uci:get("freifunk", "community", "name") 16 16 17 f = SimpleForm("community", translate("Community profile"), 18 translate("You can manually edit the selected community profile here.")) 17 if community == nil then 18 luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error")) 19 return 20 else 21 community = "/etc/config/profile_" .. community 22 f = SimpleForm("community", translate("Community profile"), translate("You can manually edit the selected community profile here.")) 19 23 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 25 40 end 26 41 27 function f.handle(self, state, data)28 if state == FORM_VALID then29 if data.cop then30 fs.writefile(cop, data.rcs:gsub("\r\n", "\n"))31 end32 end33 return true34 end35 36 return f37
