From: Jo-Philipp Wich Date: Wed, 26 Oct 2011 23:43:04 +0000 (+0000) Subject: modules/admin-full: unify style of headings accross system menus, remove orphaned... X-Git-Tag: 0.11.0~1467 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=0bc7760cdb8918e1c61ce0c8232de09738346f52 modules/admin-full: unify style of headings accross system menus, remove orphaned template --- diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/backupfiles.lua b/modules/admin-full/luasrc/model/cbi/admin_system/backupfiles.lua index 22258a937..a063ec0aa 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_system/backupfiles.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_system/backupfiles.lua @@ -21,7 +21,7 @@ elseif luci.http.formvalue("cbid.luci.1._edit") then return end -m = SimpleForm("luci", "%s - %s - %s" %{ translate("System"), translate("Flash operations"), translate("Backup file list") }) +m = SimpleForm("luci", translate("Backup file list")) m:append(Template("admin_system/backupfiles")) if luci.http.formvalue("display") ~= "list" then diff --git a/modules/admin-full/luasrc/model/cbi/admin_system/system.lua b/modules/admin-full/luasrc/model/cbi/admin_system/system.lua index ed7701222..1f488dac2 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_system/system.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_system/system.lua @@ -19,16 +19,12 @@ require("luci.tools.webadmin") require("luci.fs") require("luci.config") -m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone.")) -m:chain("luci") +local m, s, o +local has_ntpd = luci.fs.access("/usr/sbin/ntpd") -local has_rdate = false -m.uci:foreach("system", "rdate", - function() - has_rdate = true - return false - end) +m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone.")) +m:chain("luci") s = m:section(TypedSection, "system", translate("System Properties")) @@ -44,27 +40,27 @@ s:tab("language", translate("Language and Style")) -- System Properties -- -clock = s:taboption("general", DummyValue, "_systime", translate("Local Time")) -clock.template = "admin_system/clock_status" +o = s:taboption("general", DummyValue, "_systime", translate("Local Time")) +o.template = "admin_system/clock_status" -hn = s:taboption("general", Value, "hostname", translate("Hostname")) -hn.datatype = "hostname" +o = s:taboption("general", Value, "hostname", translate("Hostname")) +o.datatype = "hostname" -function hn.write(self, section, value) +function o.write(self, section, value) Value.write(self, section, value) luci.sys.hostname(value) end -tz = s:taboption("general", ListValue, "zonename", translate("Timezone")) -tz:value("UTC") +o = s:taboption("general", ListValue, "zonename", translate("Timezone")) +o:value("UTC") for i, zone in ipairs(luci.sys.zoneinfo.TZ) do - tz:value(zone[1]) + o:value(zone[1]) end -function tz.write(self, section, value) +function o.write(self, section, value) local function lookup_zone(title) for _, zone in ipairs(luci.sys.zoneinfo.TZ) do if zone[1] == title then return zone[2] end @@ -155,31 +151,40 @@ end -- --- Rdate +-- NTP -- -if has_rdate then - m2 = Map("timeserver", translate("Time Server (rdate)")) - s = m2:section(TypedSection, "timeserver") +if has_ntpd then + s = m:section(TypedSection, "timeserver", translate("Time Synchronization")) s.anonymous = true - s.addremove = true - s.template = "cbi/tblsection" - - h = s:option(Value, "hostname", translate("Name")) - h.rmempty = true - h.datatype = host - i = s:option(ListValue, "interface", translate("Interface")) - i.rmempty = true - i:value("", translate("Default")) - m2.uci:foreach("network", "interface", - function (section) - local ifc = section[".name"] - if ifc ~= "loopback" then - i:value(ifc) - end + s.addremove = false + + o = s:option(Flag, "enable", translate("Enable builtin NTP server")) + o.rmempty = false + + function o.cfgvalue(self) + return luci.sys.init.enabled("sysntpd") + and self.enabled or self.disabled + end + + function o.write(self, section, value) + if value == self.enabled then + luci.sys.init.enable("sysntpd") + luci.sys.call("env -i /etc/init.d/sysntpd start >/dev/null") + else + luci.sys.call("env -i /etc/init.d/sysntpd stop >/dev/null") + luci.sys.init.disable("sysntpd") end - ) + end + + + o = s:option(DynamicList, "server", translate("NTP server candidates")) + o.datatype = "host" + o:depends("enable", "1") + + -- retain server list even if disabled + function o.remove() end end -return m, m2 +return m diff --git a/modules/admin-full/luasrc/view/admin_system/backup.htm b/modules/admin-full/luasrc/view/admin_system/backup.htm deleted file mode 100644 index 47b513bd2..000000000 --- a/modules/admin-full/luasrc/view/admin_system/backup.htm +++ /dev/null @@ -1,40 +0,0 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%> -<%+header%> -

<%:System%>

-

<%:Backup / Restore%>

-

<%:Here you can backup and restore your router configuration and - if possible - reset the router to the default settings.%>

-
-
- -
- -
- -
-
<%:Backup Archive%>:
-
- -
-
- -
-
-<%+footer%> diff --git a/modules/admin-full/luasrc/view/admin_system/flashops.htm b/modules/admin-full/luasrc/view/admin_system/flashops.htm index 628ede772..0ba22a5e0 100644 --- a/modules/admin-full/luasrc/view/admin_system/flashops.htm +++ b/modules/admin-full/luasrc/view/admin_system/flashops.htm @@ -15,7 +15,7 @@ $Id$ <%+header%> -

<%:System%> - <%:Flash operations%>

+

<%:Flash operations%>

  • <%:Actions%>
  • diff --git a/modules/admin-full/luasrc/view/admin_system/packages.htm b/modules/admin-full/luasrc/view/admin_system/packages.htm index aff582e7f..73a35bec9 100644 --- a/modules/admin-full/luasrc/view/admin_system/packages.htm +++ b/modules/admin-full/luasrc/view/admin_system/packages.htm @@ -48,8 +48,10 @@ else end -%> + <%+header%> -

    <%:System%> - <%:Software%>

    + +

    <%:Software%>

    diff --git a/modules/admin-full/luasrc/view/admin_system/upgrade.htm b/modules/admin-full/luasrc/view/admin_system/upgrade.htm index 950eba8e7..69fde9a68 100644 --- a/modules/admin-full/luasrc/view/admin_system/upgrade.htm +++ b/modules/admin-full/luasrc/view/admin_system/upgrade.htm @@ -15,7 +15,7 @@ $Id$ <%+header%> -

    <%:System%> - <%:Flash Firmware%> - <%:Verify%>

    +

    <%:Flash Firmware%> - <%:Verify%>

    <%_ The flash image was uploaded. Below is the checksum and file size listed, @@ -55,13 +55,13 @@ $Id$

    + + +
    " />
    -
    - -
    <%+footer%>