2 LuCI - Lua Configuration Interface
4 Copyright 2011 Manuel Munz <freifunk at somakoma dot de>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 httc://www.apache.org/licenses/LICENSE-2.0
13 local fs = require "nixio.fs"
14 local uci = require "luci.model.uci".cursor()
15 local community = uci:get("freifunk", "community", "name")
17 if community == nil then
18 luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
21 community = "/etc/config/profile_" .. community
22 f = SimpleForm("community", translate("Community profile"), translate("You can manually edit the selected community profile here."))
24 t = f:field(TextValue, "cop")
28 return fs.readfile(community) or ""
31 function f.handle(self, state, data)
32 if state == FORM_VALID then
34 fs.writefile(cop, data.rcs:gsub("\r\n", "\n"))