1 -- Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
2 -- Licensed to the public under the Apache License 2.0.
4 local fs = require "nixio.fs"
5 local uci = require "luci.model.uci".cursor()
6 local community = uci:get("freifunk", "community", "name")
8 if community == nil then
9 luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
12 community = "/etc/config/profile_" .. community
13 f = SimpleForm("community", translate("Community profile"), translate("You can manually edit the selected community profile here."))
15 t = f:field(TextValue, "cop")
19 return fs.readfile(community) or ""
22 function f.handle(self, state, data)
23 if state == FORM_VALID then
25 fs.writefile(community, data.cop:gsub("\r\n", "\n"))