summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns/luasrc/view
diff options
context:
space:
mode:
authorChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-02-10 21:49:57 +0100
committerChristian Schoenebeck <christian.schoenebeck@gmail.com>2015-02-10 21:49:57 +0100
commit8b0f83264a5d33078eaca1f15de226cc7f984f59 (patch)
treeed4dd88b5599c23c01988a549e27704f1a7930fa /applications/luci-app-ddns/luasrc/view
parent86c627224091bb4ea6df961470464f5ed1748d07 (diff)
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 <christian.schoenebeck@gmail.com>
Diffstat (limited to 'applications/luci-app-ddns/luasrc/view')
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/global_value.htm34
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/overview_status.htm12
-rw-r--r--applications/luci-app-ddns/luasrc/view/ddns/system_status.htm59
3 files changed, 61 insertions, 44 deletions
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 @@
+
+<!-- ++ BEGIN ++ Dynamic DNS ++ global_value.htm ++ -->
+<%+cbi/valueheader%>
+<script type="text/javascript">//<![CDATA[
+ // event handler on changed date
+ function onkeyup_date(value) {
+ var obj = document.getElementById("cbid.ddns.global.date_format.help");
+ if ( !obj ) { return; } // security check
+
+ if ( value == "" || value.length == 0 ) { value = "%F %R"; }
+ var now = new Date();
+ var txt = now.toLocaleFormat(value);
+ // handle newline(%n) and tab(%t) needs to be converted to HTML
+ txt = txt.replace(new RegExp('\r?\n','g'), '<br />');
+ txt = txt.replace(new RegExp('\t','g'), '&nbsp;&nbsp;&nbsp;&nbsp;');
+ obj.innerHTML = "<%:Current setting%>: <strong>" + txt + "<\/strong>";
+ }
+//]]></script>
+
+<input type="text" class="cbi-input-text" onchange="cbi_d_update(this.id)" onkeyup="onkeyup_date(this.value)"
+ <%=
+ attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) ..
+ ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder")
+ %>
+/>
+<br />
+<div class="cbi-value-description">
+ <span class="cbi-value-helpicon"><img src="<%=resource%>/cbi/help.gif" alt="<%:help%>" /><%=self.description%></span>
+ <br />
+ <span id="<%=cbid%>.help" class="cbi-value-helpicon"><%:Current setting%>: <strong><%=self.date_string%></strong></span>
+</div> <!-- div class="cbi-value-description" -->
+</div> <!-- div class="cbi-value-field" -->
+</div> <!-- div class="cbi-value cbi-value-last" -->
+<!-- ++ END ++ Dynamic DNS ++ global_value.htm ++ -->
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 = '<br /><strong><font color="red"><%:Old version of ddns-scripts installed%></font>' ;
- var url = '<a href="' ;
- url += '<%=luci.dispatcher.build_url("admin", "system", "packages")%>' ;
- url += '"><%:install update here%></a></strong>' ;
- 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 = '<strong><font color="red"><%:DDNS Autostart disabled%></font>' ;
var url = '<a href="' + data[0].url_up + '"><%:enable here%></a></strong>' ;
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 = '<strong>' + data[i].section + '</strong>' ;
+ tr.insertCell(-1).innerHTML = '<strong>' + data[j].section + '</strong>' ;
// 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 = '<em><%:Unknown error%></em>' ;
break;
@@ -80,18 +65,18 @@
tr.insertCell(-1).innerHTML = '<em><%:Verify%></em>';
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 = '<em><%:config error%></em>';
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 = '<em><%:Config error%></em>';
break;
@@ -102,15 +87,15 @@
tr.insertCell(-1).innerHTML = '<em><%:IPv6 not supported%></em>';
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 = '<em><%:Config error%></em>';
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); }
}
);
+
//]]></script>
<fieldset class="cbi-section" id="ddns_status_section">