From fce0b845018c80410fc315a8046588709ac2861e Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Thu, 17 Jul 2008 21:01:15 +0000 Subject: [PATCH] Added new application luci-ntpc to luci-full and luci-mini --- applications/luci-ntpc/Makefile | 2 ++ .../luci-ntpc/luasrc/controller/ntpc.lua | 32 +++++++++++++++++++ .../luci-ntpc/luasrc/i18n/ntpc.de.lua | 5 +++ .../luci-ntpc/luasrc/i18n/ntpc.en.lua | 5 +++ .../luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua | 26 +++++++++++++++ contrib/package/luci/Makefile | 16 ++++++++++ libs/web/root/etc/config/luci | 1 + .../luasrc/controller/mini/system.lua | 4 +-- 8 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 applications/luci-ntpc/Makefile create mode 100644 applications/luci-ntpc/luasrc/controller/ntpc.lua create mode 100644 applications/luci-ntpc/luasrc/i18n/ntpc.de.lua create mode 100644 applications/luci-ntpc/luasrc/i18n/ntpc.en.lua create mode 100644 applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua diff --git a/applications/luci-ntpc/Makefile b/applications/luci-ntpc/Makefile new file mode 100644 index 0000000000..81a96f6a83 --- /dev/null +++ b/applications/luci-ntpc/Makefile @@ -0,0 +1,2 @@ +include ../../build/config.mk +include ../../build/module.mk \ No newline at end of file diff --git a/applications/luci-ntpc/luasrc/controller/ntpc.lua b/applications/luci-ntpc/luasrc/controller/ntpc.lua new file mode 100644 index 0000000000..2382f5297f --- /dev/null +++ b/applications/luci-ntpc/luasrc/controller/ntpc.lua @@ -0,0 +1,32 @@ +--[[ +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$ +]]-- +module("luci.controller.ntpc", package.seeall) + +function index() + require("luci.i18n") + luci.i18n.loadc("ntpc") + if not luci.fs.isfile("/etc/config/ntpclient") then + return + end + + local page = entry({"admin", "system", "ntpc"}, cbi("ntpc/ntpc"), luci.i18n.translate("ntpc"), 50) + page.i18n = "ntpc" + page.dependent = true + + + local page = entry({"mini", "system", "ntpc"}, cbi("ntpc/ntpc"), luci.i18n.translate("ntpc"), 50) + page.i18n = "ntpc" + page.dependent = true +end \ No newline at end of file diff --git a/applications/luci-ntpc/luasrc/i18n/ntpc.de.lua b/applications/luci-ntpc/luasrc/i18n/ntpc.de.lua new file mode 100644 index 0000000000..4710414adb --- /dev/null +++ b/applications/luci-ntpc/luasrc/i18n/ntpc.de.lua @@ -0,0 +1,5 @@ +ntpc = "Zeitsynchronisation" +ntpc_desc = "Synchronisiert die Systemzeit über Internetzeitserver" +ntpc_timeserver = "Zeitserver" +ntpc_count = "Anzahl der Zeitmessungen" +ntpc_count_desc = "0 = unendlich" \ No newline at end of file diff --git a/applications/luci-ntpc/luasrc/i18n/ntpc.en.lua b/applications/luci-ntpc/luasrc/i18n/ntpc.en.lua new file mode 100644 index 0000000000..1baf3405d4 --- /dev/null +++ b/applications/luci-ntpc/luasrc/i18n/ntpc.en.lua @@ -0,0 +1,5 @@ +ntpc = "Time Synchronisation" +ntpc_desc = "Synchronizes the system time using internet time servers" +ntpc_timeserver = "Time Server" +ntpc_count = "Count of Time Measurements" +ntpc_count_desc = "0 = infinite" \ No newline at end of file diff --git a/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua b/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua new file mode 100644 index 0000000000..552c9861af --- /dev/null +++ b/applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua @@ -0,0 +1,26 @@ +--[[ +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$ +]]-- +m = Map("ntpclient", translate("ntpc"), translate("ntpc_desc")) + +s = m:section(TypedSection, "ntpclient", translate("ntpc_timeserver")) +s.anonymous = true +s.addremove = true +s.template = "cbi/tblsection" + +s:option(Value, "hostname", translate("hostname")) +s:option(Value, "port", translate("port")).rmempty = true +s:option(Value, "count", translate("ntpc_count"), translate("ntpc_count_desc")) + +return m \ No newline at end of file diff --git a/contrib/package/luci/Makefile b/contrib/package/luci/Makefile index 062e14c725..444c473f5c 100644 --- a/contrib/package/luci/Makefile +++ b/contrib/package/luci/Makefile @@ -411,6 +411,7 @@ define Package/luci-app-statistics/install $(call Package/luci/install/template,$(1),applications/luci-statistics) endef + define Package/luci-app-upnp $(call Package/luci/webtemplate) DEPENDS+=+luci-mod-admin-core +miniupnpd @@ -422,6 +423,17 @@ define Package/luci-app-upnp/install endef +define Package/luci-app-ntpc + $(call Package/luci/webtemplate) + DEPENDS+=+luci-mod-admin-core +ntpclient + TITLE:=NTP time synchronisation client configuration +endef + +define Package/luci-app-ntpc/install + $(call Package/luci/install/template,$(1),applications/luci-ntpc) +endef + + ### Server Gateway Interfaces ### define Package/luci-sgi-cgi @@ -579,6 +591,9 @@ endif ifneq ($(CONFIG_PACKAGE_luci-app-upnp),) PKG_SELECTED_MODULES+=applications/luci-upnp endif +ifneq ($(CONFIG_PACKAGE_luci-app-ntpc),) + PKG_SELECTED_MODULES+=applications/luci-ntpc +endif ifneq ($(CONFIG_PACKAGE_luci-sgi-cgi),) PKG_SELECTED_MODULES+=libs/sgi-cgi @@ -644,6 +659,7 @@ $(eval $(call BuildPackage,luci-app-qos)) $(eval $(call BuildPackage,luci-app-splash)) $(eval $(call BuildPackage,luci-app-statistics)) $(eval $(call BuildPackage,luci-app-upnp)) +$(eval $(call BuildPackage,luci-app-ntpc)) $(eval $(call BuildPackage,luci-sgi-cgi)) $(eval $(call BuildPackage,luci-sgi-luci)) diff --git a/libs/web/root/etc/config/luci b/libs/web/root/etc/config/luci index aa35539019..f12cdf0ba0 100644 --- a/libs/web/root/etc/config/luci +++ b/libs/web/root/etc/config/luci @@ -32,6 +32,7 @@ config event uci_oncommit option luci_splash "/etc/init.d/luci_splash restart" option freifunk "/etc/init.d/luci_freifunk restart" option upnpd "/etc/init.d/miniupnpd enabled && /etc/init.d/miniupnpd restart || /etc/init.d/miniupnpd stop" + option ntpclient "/etc/init.d/ntpclient restart" config internal languages option de "Deutsch" diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index e4541b45d3..9cc5b18f7f 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -21,8 +21,8 @@ function index() entry({"mini", "system"}, call("action_reboot"), i18n("system")) entry({"mini", "system", "passwd"}, call("action_passwd"), i18n("a_s_changepw"), 10) - entry({"mini", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 20) - entry({"mini", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 30) + entry({"mini", "system", "upgrade"}, call("action_upgrade"), i18n("a_s_flash"), 90) + entry({"mini", "system", "reboot"}, call("action_reboot"), i18n("reboot"), 100) end function action_reboot() -- 2.30.2