1c88579b3751cd95b217aebbcc8c7a13809c11e5
[project/luci.git] / applications / luci-ddns / luasrc / model / cbi / ddns / ddns.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("ddns", translate("ddns"), translate("ddns_desc"))
16
17 s = m:section(TypedSection, "service", "")
18 s.addremove = true
19
20 s:option(Flag, "enabled", translate("enable"))
21
22 svc = s:option(ListValue, "service_name", translate("service"))
23 svc.rmempty = true
24 svc:value("")
25 svc:value("dyndns.org")
26 svc:value("changeip.com")
27 svc:value("zoneedit.com")
28 svc:value("no-ip.com")
29 svc:value("freedns.afraid.org")
30
31 s:option(Value, "domain", translate("hostname")).rmempty = true
32 s:option(Value, "username", translate("username")).rmempty = true
33 s:option(Value, "password", translate("password")).rmempty = true
34
35 src = s:option(ListValue, "ip_source")
36 src:value("network", translate("network"))
37 src:value("interface", translate("interface"))
38 src:value("web", "URL")
39
40 iface = s:option(ListValue, "ip_network", translate("network"))
41 iface:depends("ip_source", "network")
42 iface.rmempty = true
43 luci.model.uci.foreach("network", "interface",
44         function (section)
45                 if section[".name"] ~= "loopback" then
46                         iface:value(section[".name"])
47                 end
48         end)
49
50 iface = s:option(ListValue, "ip_interface", translate("interface"))
51 iface:depends("ip_source", "interface")
52 iface.rmempty = true
53 for k, v in pairs(luci.sys.net.devices()) do
54         iface:value(v)
55 end
56
57 web = s:option(Value, "ip_url", "URL")
58 web:depends("ip_source", "web")
59 web.rmempty = true
60
61 s:option(Value, "update_url").optional = true
62
63 s:option(Value, "check_interval").default = 10
64 unit = s:option(ListValue, "check_unit")
65 unit.default = "minutes"
66 unit:value("minutes", "min")
67 unit:value("hours", "h")
68
69 s:option(Value, "force_interval").default = 72
70 unit = s:option(ListValue, "force_unit")
71 unit.default = "hours"
72 unit:value("minutes", "min")
73 unit:value("hours", "h")
74
75
76 return m