1aa61617813ee847ae5a9a0dff5ad53b4930db6a
[project/luci.git] / applications / luci-upnp / luasrc / model / cbi / upnp / upnp.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008-2010 Jo-Philipp Wich <xm@subsignal.org>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 m = Map("upnpd", translate("Universal Plug & Play"),
17         translate("UPnP allows clients in the local network to automatically configure the router."))
18
19 m:section(SimpleSection).template  = "upnp_status"
20
21 s = m:section(NamedSection, "config", "upnpd", "")
22 s.addremove = false
23
24 e = s:option(Flag, "enabled", translate("Enable UPnP Service"))
25 e.rmempty  = false
26 e.enabled  = "1"
27 e.disabled = "0"
28
29 function e.write(self, section, value)
30         if value == "1" then
31                 luci.sys.call("/etc/init.d/miniupnpd enable")
32                 luci.sys.call("/etc/init.d/miniupnpd start")
33         else
34                 luci.sys.call("/etc/init.d/miniupnpd stop")
35                 luci.sys.call("/etc/init.d/miniupnpd disable")
36         end
37
38         Value.write(self, section, value)
39 end
40
41 s:option(Flag, "secure_mode", translate("Enable secure mode")).rmempty = true
42 s:option(Flag, "log_output", translate("Log output")).rmempty = true
43 s:option(Value, "download", translate("Downlink"), "kByte/s").rmempty = true
44 s:option(Value, "upload", translate("Uplink"), "kByte/s").rmempty = true
45
46 return m