luci-0.10: Merge rr7915

This commit is contained in:
Manuel Munz 2011-11-10 12:58:10 +00:00
parent d2732442a0
commit a048a52f84

View file

@ -154,13 +154,16 @@ end
--
if has_ntpd then
s = m:section(TypedSection, "timeserver", translate("Time Synchronization"))
s.anonymous = true
s.addremove = false
function m.on_parse()
-- timeserver setup was requested, create section and reload page
if m:formvalue("cbid.system._timeserver._enable") then
m.uci:section("system", "timeserver", "ntp")
m.uci:save("system")
luci.http.redirect(luci.dispatcher.build_url("admin/system", arg[1]))
return
end
local has_section = false
m.uci:foreach("system", "timeserver",
function(s)
has_section = true
@ -168,9 +171,21 @@ if has_ntpd then
end)
if not has_section then
m.uci:section("system", "timeserver", "ntp")
end
end
s = m:section(TypedSection, "timeserver", translate("Time Synchronization"))
s.anonymous = true
s.cfgsections = function() return { "_timeserver" } end
x = s:option(Button, "_enable")
x.title = translate("Time Synchronization is not configured yet.")
x.inputtitle = translate("Setup Time Synchronization")
x.inputstyle = "apply"
else
s = m:section(TypedSection, "timeserver", translate("Time Synchronization"))
s.anonymous = true
s.addremove = false
o = s:option(Flag, "enable", translate("Enable builtin NTP server"))
o.rmempty = false
@ -197,7 +212,8 @@ if has_ntpd then
-- retain server list even if disabled
function o.remove() end
end
end
return m