ap-timer.lua 1006 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. local uci = luci.model.uci.cursor()
  2. m = Map('ap-timer', translate('AP Timer'), translate(
  3. 'You can setup the AP Timer here'))
  4. m.pageaction = false
  5. m.template = "admin/expertmode"
  6. if not uci:get('ap-timer','settings') then
  7. uci:section('ap-timer','ap-timer','settings')
  8. uci:save('ap-timer')
  9. end
  10. s = m:section(NamedSection, 'settings', 'ap-timer', nil)
  11. s.addremove = false
  12. s.anonymous = true
  13. o = s:option(Flag, 'enabled', translate('Enabled'))
  14. o.rmempty = false
  15. o = s:option(ListValue, 'type', translate('Type'))
  16. o.default = 'day'
  17. o:value('day', translate('Daily'))
  18. if not uci:get('ap-timer','all') then
  19. uci:section('ap-timer','day','all')
  20. uci:save('ap-timer')
  21. end
  22. s = m:section(NamedSection, 'all', 'day', translate('Daily'))
  23. s.addremove = false
  24. s.anonymous = true
  25. o = s:option(DynamicList, 'on', translate('ON'))
  26. o.placeholder = '06:30'
  27. o.datatype = 'rangelength(5, 5)'
  28. o = s:option(DynamicList, 'off', translate('OFF'))
  29. o.placeholder = '23:00'
  30. o.datatype = 'rangelength(5, 5)'
  31. return m