From 7b7030629c4d55557b368a292d7f3e3d14b1923b Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Sat, 10 Nov 2012 20:55:50 +0000 Subject: Add some more datatype checks, patch by Eugene C., #499 --- applications/luci-qos/luasrc/model/cbi/qos/qos.lua | 6 ++++-- applications/luci-qos/luasrc/model/cbi/qos/qosmini.lua | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'applications/luci-qos/luasrc/model') diff --git a/applications/luci-qos/luasrc/model/cbi/qos/qos.lua b/applications/luci-qos/luasrc/model/cbi/qos/qos.lua index 98e9a25070..1af3bdbbd3 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 9ffefec4f1..0c5766f342 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" -- cgit v1.2.3