Add some more datatype checks, patch by Eugene C., #499
This commit is contained in:
parent
4e04e353fe
commit
7b7030629c
6 changed files with 39 additions and 14 deletions
|
@ -112,14 +112,19 @@ else
|
|||
end
|
||||
|
||||
|
||||
s:option(Value, "check_interval",
|
||||
translate("Check for changed IP every")).default = 10
|
||||
ci = s:option(Value, "check_interval", translate("Check for changed IP every"))
|
||||
ci.datatype = "and(uinteger,min(1))"
|
||||
ci.default = 10
|
||||
|
||||
unit = s:option(ListValue, "check_unit", translate("Check-time unit"))
|
||||
unit.default = "minutes"
|
||||
unit:value("minutes", translate("min"))
|
||||
unit:value("hours", translate("h"))
|
||||
|
||||
s:option(Value, "force_interval", translate("Force update every")).default = 72
|
||||
fi = s:option(Value, "force_interval", translate("Force update every"))
|
||||
fi.datatype = "and(uinteger,min(1))"
|
||||
fi.default = 72
|
||||
|
||||
unit = s:option(ListValue, "force_unit", translate("Force-time unit"))
|
||||
unit.default = "hours"
|
||||
unit:value("minutes", translate("min"))
|
||||
|
|
|
@ -20,14 +20,21 @@ s.addremove = false
|
|||
|
||||
s:option(DummyValue, "_time", translate("Current system time")).value = os.date("%c")
|
||||
|
||||
s:option(Value, "interval", translate("Update interval (in seconds)")).rmempty = true
|
||||
s:option(Value, "count", translate("Count of time measurements"), translate("empty = infinite")).rmempty = true
|
||||
interval = s:option(Value, "interval", translate("Update interval (in seconds)"))
|
||||
interval.datatype = "and(uinteger,min(1))"
|
||||
interval.rmempty = true
|
||||
|
||||
count = s:option(Value, "count", translate("Count of time measurements"), translate("empty = infinite"))
|
||||
count.datatype = "and(uinteger,min(1))"
|
||||
count.rmempty = true
|
||||
|
||||
s2 = m:section(TypedSection, "ntpdrift", translate("Clock Adjustment"))
|
||||
s2.anonymous = true
|
||||
s2.addremove = false
|
||||
s2:option(Value, "freq", translate("Offset frequency")).rmempty = true
|
||||
|
||||
freq = s2:option(Value, "freq", translate("Offset frequency"))
|
||||
freq.datatype = "integer"
|
||||
freq.rmempty = true
|
||||
|
||||
s3 = m:section(TypedSection, "ntpserver", translate("Time Servers"))
|
||||
s3.anonymous = true
|
||||
|
@ -35,6 +42,8 @@ s3.addremove = true
|
|||
s3.template = "cbi/tblsection"
|
||||
|
||||
s3:option(Value, "hostname", translate("Hostname"))
|
||||
s3:option(Value, "port", translate("Port")).rmempty = true
|
||||
port = s3:option(Value, "port", translate("Port"))
|
||||
port.datatype = "port"
|
||||
port.rmempty = true
|
||||
|
||||
return m
|
||||
|
|
|
@ -21,8 +21,9 @@ s.addremove = false
|
|||
|
||||
s:option(DummyValue, "_time", translate("Current system time")).value = os.date("%c")
|
||||
|
||||
s:option(Value, "interval", translate("Update interval (in seconds)")).rmempty = true
|
||||
|
||||
interval = s:option(Value, "interval", translate("Update interval (in seconds)"))
|
||||
interval.datatype = "and(uinteger,min(1))"
|
||||
interval.rmempty = true
|
||||
|
||||
s3 = m:section(TypedSection, "ntpserver", translate("Time Server"))
|
||||
s3.anonymous = true
|
||||
|
@ -30,6 +31,8 @@ s3.addremove = true
|
|||
s3.template = "cbi/tblsection"
|
||||
|
||||
s3:option(Value, "hostname", translate("Hostname"))
|
||||
s3:option(Value, "port", translate("Port")).rmempty = true
|
||||
port = s3:option(Value, "port", translate("Port"))
|
||||
port.datatype = "port"
|
||||
port.rmempty = true
|
||||
|
||||
return m
|
||||
|
|
|
@ -35,9 +35,11 @@ s:option(Flag, "overhead", translate("Calculate overhead"))
|
|||
|
||||
s:option(Flag, "halfduplex", translate("Half-duplex"))
|
||||
|
||||
s:option(Value, "download", translate("Download speed (kbit/s)"))
|
||||
dl = s:option(Value, "download", translate("Download speed (kbit/s)"))
|
||||
dl.datatype = "and(uinteger,min(1))"
|
||||
|
||||
s:option(Value, "upload", translate("Upload speed (kbit/s)"))
|
||||
ul = s:option(Value, "upload", translate("Upload speed (kbit/s)"))
|
||||
ul.datatype = "and(uinteger,min(1))"
|
||||
|
||||
s = m:section(TypedSection, "classify", translate("Classification Rules"))
|
||||
s.template = "cbi/tblsection"
|
||||
|
|
|
@ -21,8 +21,12 @@ m = Map("qos")
|
|||
s = m:section(NamedSection, "wan", "interface", translate("Internet Connection"))
|
||||
|
||||
s:option(Flag, "enabled", translate("Quality of Service"))
|
||||
s:option(Value, "download", translate("Downlink"), "kbit/s")
|
||||
s:option(Value, "upload", translate("Uplink"), "kbit/s")
|
||||
|
||||
dl = s:option(Value, "download", translate("Downlink"), "kbit/s")
|
||||
dl.datatype = "and(uinteger,min(1))"
|
||||
|
||||
ul = s:option(Value, "upload", translate("Uplink"), "kbit/s")
|
||||
ul.datatype = "and(uinteger,min(1))"
|
||||
|
||||
s = m:section(TypedSection, "classify")
|
||||
s.template = "cbi/tblsection"
|
||||
|
|
|
@ -202,10 +202,12 @@ m.uci:foreach("network", "switch",
|
|||
|
||||
|
||||
local vid = s:option(Value, has_vlan4k or "vlan", "VLAN ID", "<div id='portstatus-%s'></div>" % switch_name)
|
||||
local mx_vid = has_vlan4k and 4094 or (num_vlans - 1)
|
||||
|
||||
vid.rmempty = false
|
||||
vid.forcewrite = true
|
||||
vid.vlan_used = { }
|
||||
vid.datatype = "and(uinteger,range("..min_vid..","..mx_vid.."))"
|
||||
|
||||
-- Validate user provided VLAN ID, make sure its within the bounds
|
||||
-- allowed by the switch.
|
||||
|
|
Loading…
Reference in a new issue