Added new application luci-ntpc to luci-full and luci-mini
authorSteven Barth <steven@midlink.org>
Thu, 17 Jul 2008 21:01:15 +0000 (21:01 +0000)
committerSteven Barth <steven@midlink.org>
Thu, 17 Jul 2008 21:01:15 +0000 (21:01 +0000)
applications/luci-ntpc/Makefile [new file with mode: 0644]
applications/luci-ntpc/luasrc/controller/ntpc.lua [new file with mode: 0644]
applications/luci-ntpc/luasrc/i18n/ntpc.de.lua [new file with mode: 0644]
applications/luci-ntpc/luasrc/i18n/ntpc.en.lua [new file with mode: 0644]
applications/luci-ntpc/luasrc/model/cbi/ntpc/ntpc.lua [new file with mode: 0644]
contrib/package/luci/Makefile
libs/web/root/etc/config/luci
modules/admin-mini/luasrc/controller/mini/system.lua

diff --git a/applications/luci-ntpc/Makefile b/applications/luci-ntpc/Makefile
new file mode 100644 (file)
index 0000000..81a96f6
--- /dev/null
@@ -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 (file)
index 0000000..2382f52
--- /dev/null
@@ -0,0 +1,32 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+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 (file)
index 0000000..4710414
--- /dev/null
@@ -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 (file)
index 0000000..1baf340
--- /dev/null
@@ -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 (file)
index 0000000..552c986
--- /dev/null
@@ -0,0 +1,26 @@
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+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
index 062e14c725f59759de75d3e5c99719f51b84f1d1..444c473f5c2c3c01c859010edfc278f38c173dbf 100644 (file)
@@ -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))
index aa35539019b0a36ce394d595da902a9dee12c3dd..f12cdf0ba007fff5660cb6788546d617fea81403 100644 (file)
@@ -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"
index e4541b45d36942349700cf5d06754c7c4838ff2e..9cc5b18f7f92d03bacc13d84a540bf5b0a9767cb 100644 (file)
@@ -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()