all: change most translate statements to new format, some need manual cleanup
[project/luci.git] / applications / luci-upnp / luasrc / model / cbi / upnp / upnpmini.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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 m = Map("upnpd", translate("Universal Plug & Play"), translate("UPNP allows clients in the local network to automatically configure the router."))
16
17 s = m:section(NamedSection, "config", "upnpd", "")
18 e = s:option(Flag, "enabled", translate("enable"))
19 e.rmempty = false
20
21 function e.write(self, section, value)
22         local cmd = (value == "1") and "enable" or "disable"
23         if value ~= "1" then
24                 os.execute("/etc/init.d/miniupnpd stop")
25         end
26         os.execute("/etc/init.d/miniupnpd " .. cmd)
27 end
28
29 function e.cfgvalue(self, section)
30         return (os.execute("/etc/init.d/miniupnpd enabled") == 0) and "1" or "0"
31 end
32
33 s:option(Value, "download", nil, "kByte/s").rmempty = true
34 s:option(Value, "upload", nil, "kByte/s").rmempty = true
35
36 return m