diff options
author | Manuel Munz <freifunk@somakoma.de> | 2012-11-10 20:55:50 +0000 |
---|---|---|
committer | Manuel Munz <freifunk@somakoma.de> | 2012-11-10 20:55:50 +0000 |
commit | 7b7030629c4d55557b368a292d7f3e3d14b1923b (patch) | |
tree | e60dfd01f3e9dff541ab6ad14fda9c2f02aa9667 /applications | |
parent | 4e04e353fe91107d27046f93d63aa9aa92418ce8 (diff) |
Add some more datatype checks, patch by Eugene C., #499
Diffstat (limited to 'applications')
5 files changed, 37 insertions, 14 deletions
diff --git a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua index 42fb4a61d..e477a245e 100644 --- a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua +++ b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua @@ -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")) diff --git a/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua b/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua index ab7f73edb..5265359c6 100644 --- a/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua +++ b/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua @@ -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 diff --git a/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpcmini.lua b/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpcmini.lua index 9b5633762..2a6c41524 100644 --- a/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpcmini.lua +++ b/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpcmini.lua @@ -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 diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua index 98e9a2507..1af3bdbbd 100644 --- a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua +++ b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua @@ -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" diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua b/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua index 9ffefec4f..0c5766f34 100644 --- a/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua +++ b/applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua @@ -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" |