luci-app-ddns: fix next_update error
[project/luci.git] / applications / luci-app-mwan3 / luasrc / model / cbi / mwan / member.lua
1 -- Copyright 2014 Aedan Renner <chipdankly@gmail.com>
2 -- Copyright 2018 Florian Eckert <fe@dev.tdt.de>
3 -- Licensed to the public under the GNU General Public License v2.
4
5 local dsp = require "luci.dispatcher"
6
7 local m, s, o
8
9 m = Map("mwan3", translate("MWAN - Members"))
10
11 s = m:section(TypedSection, "member", nil,
12 translate("Members are profiles attaching a metric and weight to an MWAN interface<br />" ..
13 "Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" ..
14 "Members may not share the same name as configured interfaces, policies or rules"))
15 s.addremove = true
16 s.dynamic = false
17 s.sectionhead = translate("Member")
18 s.sortable = true
19 s.template = "cbi/tblsection"
20 s.extedit = dsp.build_url("admin", "network", "mwan", "member", "%s")
21 function s.create(self, section)
22 TypedSection.create(self, section)
23 m.uci:save("mwan3")
24 luci.http.redirect(dsp.build_url("admin", "network", "mwan", "member", section))
25 end
26
27 o = s:option(DummyValue, "interface", translate("Interface"))
28 o.rawhtml = true
29 function o.cfgvalue(self, s)
30 return self.map:get(s, "interface") or "&#8212;"
31 end
32
33 o = s:option(DummyValue, "metric", translate("Metric"))
34 o.rawhtml = true
35 function o.cfgvalue(self, s)
36 return self.map:get(s, "metric") or "1"
37 end
38
39 o = s:option(DummyValue, "weight", translate("Weight"))
40 o.rawhtml = true
41 function o.cfgvalue(self, s)
42 return self.map:get(s, "weight") or "1"
43 end
44
45 return m