ap-timer.lua 1004 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. local uci = luci.model.uci.cursor()
  2. if not uci:get('ap-timer','settings') then
  3. uci:section('ap-timer','ap-timer','settings')
  4. uci:save('ap-timer')
  5. end
  6. if not uci:get('ap-timer','all') then
  7. uci:section('ap-timer','day','all')
  8. uci:save('ap-timer')
  9. end
  10. m = Map('ap-timer', translate('AP Timer'), translate(
  11. 'You can setup the AP Timer here'))
  12. m.pageaction = false
  13. m.template = "cbi/simpleform"
  14. s = m:section(NamedSection, 'settings', 'ap-timer', nil)
  15. s.addremove = false
  16. s.anonymous = true
  17. o = s:option(Flag, 'enabled', translate('Enabled'))
  18. o.rmempty = false
  19. o = s:option(ListValue, 'type', translate('Type'))
  20. o.default = 'day'
  21. o:value('day', translate('Daily'))
  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