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")
16 luci.i18n.loadc("freifunk")
18 if community == nil then
19 luci.http.redirect(luci.dispatcher.build_url("admin", "freifunk", "profile_error"))
22 community = "/etc/config/profile_" .. community
23 f = SimpleForm("community", translate("Community profile"), translate("You can manually edit the selected community profile here."))
25 t = f:field(TextValue, "cop")
29 return fs.readfile(community) or ""
32 function f.handle(self, state, data)
33 if state == FORM_VALID then
35 fs.writefile(cop, data.rcs:gsub("\r\n", "\n"))