X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-ddns%2Fluasrc%2Fmodel%2Fcbi%2Fddns%2Fhints.lua;h=dfbc7468cd976b0ee9fbc635dbb71bb7372775b4;hp=d0d323c03ee1da98e9dee5caf235e18c1d18aa2c;hb=ee9fdba61744111d8f5d7f7d616992ac7135ac09;hpb=92bfcbbc3463cbb7f384d688cb5f1c7e4bed326c;ds=sidebyside
diff --git a/applications/luci-ddns/luasrc/model/cbi/ddns/hints.lua b/applications/luci-ddns/luasrc/model/cbi/ddns/hints.lua
index d0d323c03..dfbc7468c 100644
--- a/applications/luci-ddns/luasrc/model/cbi/ddns/hints.lua
+++ b/applications/luci-ddns/luasrc/model/cbi/ddns/hints.lua
@@ -12,56 +12,74 @@ You may obtain a copy of the License at
$Id$
]]--
-require "luci.sys"
-require "luci.dispatcher"
-require "luci.tools.ddns"
+local CTRL = require "luci.controller.ddns" -- this application's controller
+local DISP = require "luci.dispatcher"
+local SYS = require "luci.sys"
+local DDNS = require "luci.tools.ddns" -- ddns multiused functions
--- check supported options
+-- check supported options -- ##################################################
-- saved to local vars here because doing multiple os calls slow down the system
-has_ssl = luci.tools.ddns.check_ssl() -- HTTPS support
-has_proxy = luci.tools.ddns.check_proxy() -- Proxy support
-has_dnstcp = luci.tools.ddns.check_bind_host() -- DNS TCP support
+has_ssl = DDNS.check_ssl() -- HTTPS support
+has_proxy = DDNS.check_proxy() -- Proxy support
+has_dnstcp = DDNS.check_bind_host() -- DNS TCP support
+need_update = CTRL.update_needed() -- correct ddns-scripts version
-- html constants
+font_red = [[]]
+font_off = [[]]
bold_on = [[]]
bold_off = [[]]
--- cbi-map definition
+-- cbi-map definition -- #######################################################
m = Map("ddns")
-m.title = [[]] ..
- translate("Dynamic DNS") .. [[]]
+-- first need to close from cbi map template our closed by template
+m.title = [[]] ..
+ translate("Dynamic DNS")
m.description = translate("Dynamic DNS allows that your router can be reached with " ..
"a fixed hostname while having a dynamically changing " ..
"IP address.")
-m.redirect = luci.dispatcher.build_url("admin", "services", "ddns")
+m.redirect = DISP.build_url("admin", "services", "ddns")
--- SimpleSection definition
+-- SimpleSection definition -- #################################################
-- show Hints to optimize installation and script usage
-s = m:section( SimpleSection,
- translate("Hints"),
+s = m:section( SimpleSection,
+ translate("Hints"),
translate("Below a list of configuration tips for your system to run Dynamic DNS updates without limitations") )
+
+-- ddns_scripts needs to be updated for full functionality
+if need_update then
+ local dv = s:option(DummyValue, "_update_needed")
+ dv.titleref = DISP.build_url("admin", "system", "packages")
+ dv.rawhtml = true
+ dv.title = font_red .. bold_on ..
+ translate("Software update required") .. bold_off .. font_off
+ dv.value = translate("The currently installed 'ddns-scripts' package did not support all available settings.") ..
+ "
" ..
+ translate("Please update to the current version!")
+end
+
-- DDNS Service disabled
-if not luci.sys.init.enabled("ddns") then
+if not SYS.init.enabled("ddns") then
local dv = s:option(DummyValue, "_not_enabled")
- dv.titleref = luci.dispatcher.build_url("admin", "system", "startup")
+ dv.titleref = DISP.build_url("admin", "system", "startup")
dv.rawhtml = true
- dv.title = bold_on ..
+ dv.title = bold_on ..
translate("DDNS Autostart disabled") .. bold_off
- dv.value = translate("Currently DDNS updates are not started at boot or on interface events." .. "
" ..
+ dv.value = translate("Currently DDNS updates are not started at boot or on interface events." .. "
" ..
"This is the default if you run DDNS scripts by yourself (i.e. via cron with force_interval set to '0')" )
end
-- No IPv6 support
-if not luci.tools.ddns.check_ipv6() then
+if not DDNS.check_ipv6() then
local dv = s:option(DummyValue, "_no_ipv6")
dv.titleref = 'http://www.openwrt.org" target="_blank'
dv.rawhtml = true
- dv.title = bold_on ..
+ dv.title = bold_on ..
translate("IPv6 not supported") .. bold_off
- dv.value = translate("IPv6 is currently not (fully) supported by this system" .. "
" ..
+ dv.value = translate("IPv6 is currently not (fully) supported by this system" .. "
" ..
"Please follow the instructions on OpenWrt's homepage to enable IPv6 support" .. "
" ..
"or update your system to the latest OpenWrt Release")
end
@@ -69,13 +87,13 @@ end
-- No HTTPS support
if not has_ssl then
local dv = s:option(DummyValue, "_no_https")
- dv.titleref = luci.dispatcher.build_url("admin", "system", "packages")
+ dv.titleref = DISP.build_url("admin", "system", "packages")
dv.rawhtml = true
- dv.title = bold_on ..
+ dv.title = bold_on ..
translate("HTTPS not supported") .. bold_off
- dv.value = translate("Neither GNU Wget with SSL nor cURL installed to support updates via HTTPS protocol.") ..
- "
- " ..
- translate("You should install GNU Wget with SSL (prefered) or cURL package.") ..
+ dv.value = translate("Neither GNU Wget with SSL nor cURL installed to support updates via HTTPS protocol.") ..
+ "
- " ..
+ translate("You should install GNU Wget with SSL (prefered) or cURL package.") ..
"
- " ..
translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
end
@@ -83,13 +101,13 @@ end
-- cURL without proxy support
if has_ssl and not has_proxy then
local dv = s:option(DummyValue, "_no_proxy")
- dv.titleref = luci.dispatcher.build_url("admin", "system", "packages")
+ dv.titleref = DISP.build_url("admin", "system", "packages")
dv.rawhtml = true
- dv.title = bold_on ..
+ dv.title = bold_on ..
translate("cURL without Proxy Support") .. bold_off
- dv.value = translate("cURL is installed, but libcurl was compiled without proxy support.") ..
- "
- " ..
- translate("You should install GNU Wget with SSL or replace libcurl.") ..
+ dv.value = translate("cURL is installed, but libcurl was compiled without proxy support.") ..
+ "
- " ..
+ translate("You should install GNU Wget with SSL or replace libcurl.") ..
"
- " ..
translate("In some versions cURL/libcurl in OpenWrt is compiled without proxy support.")
end
@@ -97,12 +115,12 @@ end
-- "Force IP Version not supported"
if not (has_ssl and has_dnstcp) then
local dv = s:option(DummyValue, "_no_force_ip")
- dv.titleref = luci.dispatcher.build_url("admin", "system", "packages")
+ dv.titleref = DISP.build_url("admin", "system", "packages")
dv.rawhtml = true
- dv.title = bold_on ..
+ dv.title = bold_on ..
translate("Force IP Version not supported") .. bold_off
local value = translate("BusyBox's nslookup and Wget do not support to specify " ..
- "the IP version to use for communication with DDNS Provider.")
+ "the IP version to use for communication with DDNS Provider.")
if not has_ssl then
value = value .. "
- " ..
translate("You should install GNU Wget with SSL (prefered) or cURL package.")
@@ -117,11 +135,11 @@ end
-- "DNS requests via TCP not supported"
if not has_dnstcp then
local dv = s:option(DummyValue, "_no_dnstcp")
- dv.titleref = luci.dispatcher.build_url("admin", "system", "packages")
+ dv.titleref = DISP.build_url("admin", "system", "packages")
dv.rawhtml = true
- dv.title = bold_on ..
+ dv.title = bold_on ..
translate("DNS requests via TCP not supported") .. bold_off
- dv.value = translate("BusyBox's nslookup does not support to specify to use TCP instead of default UDP when requesting DNS server") ..
+ dv.value = translate("BusyBox's nslookup does not support to specify to use TCP instead of default UDP when requesting DNS server") ..
"
- " ..
translate("You should install BIND host package for DNS requests.")
end