luci-app-accesscontrol: set time to hh:mm:ss time format

This commit is contained in:
coolsnowwolf 2018-11-30 22:43:55 +08:00
parent 8adb90b287
commit 81251aef39
4 changed files with 12 additions and 10 deletions

View File

@ -11,7 +11,7 @@ LUCI_DEPENDS:=
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-accesscontrol
PKG_VERSION:=1
PKG_RELEASE:=3
PKG_RELEASE:=5
include $(TOPDIR)/feeds/luci/luci.mk

View File

@ -23,5 +23,5 @@ function index()
-- end
entry({"admin", "services", "access_control"}, cbi("access_control"), _("Internet Access Schedule Control"), 10).dependent = true
entry({"admin", "services", "access_control"}, cbi("access_control"), _("Internet Access Schedule Control"), 30).dependent = true
end

View File

@ -44,7 +44,7 @@ s = mr:section(TypedSection, "rule", translate("Client Rules"))
s.defaults.dest = "wan"
s.defaults.target = "REJECT"
s.defaults.proto = "0"
s.defaults.extra = "--kerneltz"
-- s_rule.defaults.extra = "--kerneltz"
-- only AC-related rules
s.filter = function(self, section)
@ -92,14 +92,15 @@ s = mr:section(TypedSection, "rule", translate("Client Rules"))
end)
function validate_time(self, value, section)
local hh, mm
hh,mm = string.match (value, "^(%d?%d):(%d%d)$")
local hh, mm, ss
hh, mm, ss = string.match (value, "^(%d?%d):(%d%d):(%d%d)$")
hh = tonumber (hh)
mm = tonumber (mm)
if hh and mm and hh <= 23 and mm <= 59 then
ss = tonumber (ss)
if hh and mm and hh <= 23 and mm <= 59 and ss <= 59 then
return value
else
return nil, "Time value must be HH:MM or empty"
return nil, "Time value must be HH:MM:SS or empty"
end
end
o = s:option(Value, "start_time", translate("Start time"))
@ -111,8 +112,8 @@ s = mr:section(TypedSection, "rule", translate("Client Rules"))
o.validate = validate_time
o.size = 5
local Days = {'mon','tue','wed','thu','fri','sat','sun'}
local Days1 = translate('MTWTFSS')
local Days = {'Mon','Tue','Wed','Thu','Fri','Sat','Sun'}
local Days1 = translate("MTWTFSS")
function make_day (nday)
local day = Days[nday]

View File

@ -22,5 +22,6 @@ msgstr "开始时间"
msgid "End time"
msgstr "结束时间"
msgid ""MTWTFSS"
msgstr "一二三四五六日"