From 8b0f83264a5d33078eaca1f15de226cc7f984f59 Mon Sep 17 00:00:00 2001 From: Christian Schoenebeck Date: Tue, 10 Feb 2015 21:49:57 +0100 Subject: luci-app-ddns: update to version 2.2.0-1 - implement new option bind_interface - fixes problems when updating status displays (i.e. showing Software update needed) - new links to OpenWrt wiki - new screen to set global settings - implements global option use_curl Signed-off-by: Christian Schoenebeck --- .../luasrc/view/ddns/global_value.htm | 34 +++++++++++++ .../luasrc/view/ddns/overview_status.htm | 12 ++--- .../luasrc/view/ddns/system_status.htm | 59 ++++++++-------------- 3 files changed, 61 insertions(+), 44 deletions(-) create mode 100644 applications/luci-app-ddns/luasrc/view/ddns/global_value.htm (limited to 'applications/luci-app-ddns/luasrc/view/ddns') diff --git a/applications/luci-app-ddns/luasrc/view/ddns/global_value.htm b/applications/luci-app-ddns/luasrc/view/ddns/global_value.htm new file mode 100644 index 0000000000..159cb60147 --- /dev/null +++ b/applications/luci-app-ddns/luasrc/view/ddns/global_value.htm @@ -0,0 +1,34 @@ + + +<%+cbi/valueheader%> + + + +/> +
+
+ <%:help%><%=self.description%> +
+ <%:Current setting%>: <%=self.date_string%> +
+ + + diff --git a/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm b/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm index 6cca0e75d9..ea8e4a1e31 100644 --- a/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm +++ b/applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm @@ -146,8 +146,7 @@ } else { // should have data because status changed // so update screen - if (data) - _data2elements(data); + if (data) { _data2elements(data); } } // make me invisible obj.parentNode.style.display = "none"; @@ -155,20 +154,19 @@ ); } - var ddns_ov_XHR = new XHR(); // force to immediate show status on page load (not waiting for XHR.poll) - ddns_ov_XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, function(x, data) { - _data2elements(data); + if (data) { _data2elements(data); } } ); // define only ONE XHR.poll in a page because if one is running it blocks the other one // optimum is to define on Map or Section Level from here you can reach all elements // we need update every 15 seconds only - ddns_ov_XHR.poll(15, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, + XHR.poll(15, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, function(x, data) { - _data2elements(data); + if (data) { _data2elements(data); } } ); diff --git a/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm b/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm index 7c60726e24..4ca0abb0e5 100644 --- a/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm +++ b/applications/luci-app-ddns/luasrc/view/ddns/system_status.htm @@ -14,53 +14,38 @@ tbl.deleteRow(1); // variable for Modulo-Division use to set cbi-rowstyle-? (0 or 1) - var x = -1; - var i = 1; - - // no data => no ddns-scripts Version 2 installed - if ( !data ) { - var txt = '
<%:Old version of ddns-scripts installed%>' ; - var url = '' ; - url += '"><%:install update here%>' ; - var tr = tbl.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) % 2) + 1); - var td = tr.insertCell(-1); - td.colSpan = 2 ; - td.innerHTML = txt + " - " + url - tr.insertCell(-1).colSpan = 3 ; - return; - } + var i = -1; + var j = 1; // DDNS Service disabled if (data[0].enabled == 0) { var txt = '<%:DDNS Autostart disabled%>' ; var url = '<%:enable here%>' ; var tr = tbl.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) % 2) + 1); + tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((j + i) % 2) + 1); var td = tr.insertCell(-1); td.colSpan = 2 ; td.innerHTML = txt + " - " + url tr.insertCell(-1).colSpan = 3 ; - x++ ; + i++ ; } - for( i = 1; i < data.length; i++ ) + for( j = 1; j < data.length; j++ ) { var tr = tbl.insertRow(-1); - tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) % 2) + 1) ; + tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((j + i) % 2) + 1) ; // configuration - tr.insertCell(-1).innerHTML = '' + data[i].section + '' ; + tr.insertCell(-1).innerHTML = '' + data[j].section + '' ; // pid - // data[i].pid ignored here + // data[j].pid ignored here // last update - // data[i].datelast ignored here + // data[j].datelast ignored here // next update - switch (data[i].datenext) { + switch (data[j].datenext) { case "_empty_": tr.insertCell(-1).innerHTML = '<%:Unknown error%>' ; break; @@ -80,18 +65,18 @@ tr.insertCell(-1).innerHTML = '<%:Verify%>'; break; default: - tr.insertCell(-1).innerHTML = data[i].datenext ; + tr.insertCell(-1).innerHTML = data[j].datenext ; break; } // domain - if (data[i].domain == "_nodomain_") + if (data[j].domain == "_nodomain_") tr.insertCell(-1).innerHTML = '<%:config error%>'; else - tr.insertCell(-1).innerHTML = data[i].domain; + tr.insertCell(-1).innerHTML = data[j].domain; // registered IP - switch (data[i].reg_ip) { + switch (data[j].reg_ip) { case "_nodomain_": tr.insertCell(-1).innerHTML = '<%:Config error%>'; break; @@ -102,15 +87,15 @@ tr.insertCell(-1).innerHTML = '<%:IPv6 not supported%>'; break; default: - tr.insertCell(-1).innerHTML = data[i].reg_ip; + tr.insertCell(-1).innerHTML = data[j].reg_ip; break; } // monitored interface - if (data[i].iface == "_nonet_") + if (data[j].iface == "_nonet_") tr.insertCell(-1).innerHTML = '<%:Config error%>'; else - tr.insertCell(-1).innerHTML = data[i].iface; + tr.insertCell(-1).innerHTML = data[j].iface; } if (tbl.rows.length == 1 || (data[0].enabled == 0 && tbl.rows.length == 2) ) { @@ -125,19 +110,19 @@ } } - var ddns_status_XHR = new XHR(); // force to immediate show status (not waiting for XHR.poll) - ddns_status_XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, + XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, function(x, data) { - _data2elements(x, data); + if (data) { _data2elements(x, data); } } ); - ddns_status_XHR.poll(10, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, + XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null, function(x, data) { - _data2elements(x, data); + if (data) { _data2elements(x, data); } } ); + //]]>
-- cgit v1.2.3