2014-10-10 19:55:22 +00:00
|
|
|
<!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
2014-11-09 17:37:15 +00:00
|
|
|
// helper to move status data to the relevant
|
|
|
|
// screen objects
|
|
|
|
// called by XHR.poll and XHR.get
|
|
|
|
function _data2elements(x, data) {
|
|
|
|
var tbl = document.getElementById('ddns_status_table');
|
|
|
|
// security check
|
|
|
|
if ( !(tbl) ) { return; }
|
|
|
|
|
|
|
|
// clear all rows
|
2018-05-31 11:48:51 +00:00
|
|
|
while (tbl.firstElementChild !== tbl.lastElementChild)
|
|
|
|
tbl.removeChild(tbl.lastElementChild);
|
2014-11-09 17:37:15 +00:00
|
|
|
|
|
|
|
// variable for Modulo-Division use to set cbi-rowstyle-? (0 or 1)
|
2015-02-10 20:49:57 +00:00
|
|
|
var i = -1;
|
|
|
|
var j = 1;
|
2014-11-09 17:37:15 +00:00
|
|
|
|
|
|
|
// 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>' ;
|
2018-05-31 11:48:51 +00:00
|
|
|
tbl.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format(((j + i) % 2) + 1), [
|
|
|
|
E('<div class="td">', [ txt," - ", url ])
|
|
|
|
]));
|
2015-02-10 20:49:57 +00:00
|
|
|
i++ ;
|
2014-11-09 17:37:15 +00:00
|
|
|
}
|
|
|
|
|
2018-05-31 11:48:51 +00:00
|
|
|
var configuration;
|
|
|
|
var next_update;
|
|
|
|
var lookup;
|
|
|
|
var registered_ip;
|
|
|
|
var network;
|
|
|
|
|
2015-02-10 20:49:57 +00:00
|
|
|
for( j = 1; j < data.length; j++ )
|
2014-10-10 19:55:22 +00:00
|
|
|
{
|
2014-11-09 17:37:15 +00:00
|
|
|
// configuration
|
2018-05-31 11:48:51 +00:00
|
|
|
configuration = data[j].section;
|
2014-11-09 17:37:15 +00:00
|
|
|
|
|
|
|
// pid
|
2015-02-10 20:49:57 +00:00
|
|
|
// data[j].pid ignored here
|
2014-11-09 17:37:15 +00:00
|
|
|
|
|
|
|
// last update
|
2015-02-10 20:49:57 +00:00
|
|
|
// data[j].datelast ignored here
|
2014-11-09 17:37:15 +00:00
|
|
|
|
|
|
|
// next update
|
2015-02-10 20:49:57 +00:00
|
|
|
switch (data[j].datenext) {
|
2014-11-09 17:37:15 +00:00
|
|
|
case "_empty_":
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = '<em><%:Unknown error%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_stopped_":
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = '<em><%:Stopped%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_disabled_":
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = '<em><%:Disabled%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_noupdate_":
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = '<em><%:Update error%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_runonce_":
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = '<em><%:Run once%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_verify_":
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = '<em><%:Verify%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2018-05-31 11:48:51 +00:00
|
|
|
next_update = data[j].datenext;
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
2014-10-10 19:55:22 +00:00
|
|
|
}
|
|
|
|
|
2015-11-15 10:42:43 +00:00
|
|
|
// lookup
|
|
|
|
if (data[j].lookup == "_nolookup_")
|
2018-05-31 11:48:51 +00:00
|
|
|
lookup = '<em><%:config error%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
else
|
2018-05-31 11:48:51 +00:00
|
|
|
lookup = data[j].lookup;
|
2014-10-10 19:55:22 +00:00
|
|
|
|
2014-11-09 17:37:15 +00:00
|
|
|
// registered IP
|
2015-02-10 20:49:57 +00:00
|
|
|
switch (data[j].reg_ip) {
|
2015-11-15 10:42:43 +00:00
|
|
|
case "_nolookup_":
|
2018-05-31 11:48:51 +00:00
|
|
|
registered_ip = '<em><%:config error%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_nodata_":
|
2018-05-31 11:48:51 +00:00
|
|
|
registered_ip = '<em><%:No data%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
case "_noipv6_":
|
2018-05-31 11:48:51 +00:00
|
|
|
registered_ip = '<em><%:IPv6 not supported%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2018-05-31 11:48:51 +00:00
|
|
|
registered_ip = data[j].reg_ip;
|
2014-11-09 17:37:15 +00:00
|
|
|
break;
|
2014-10-10 19:55:22 +00:00
|
|
|
}
|
|
|
|
|
2015-01-18 18:22:54 +00:00
|
|
|
// monitored interface
|
2015-02-10 20:49:57 +00:00
|
|
|
if (data[j].iface == "_nonet_")
|
2018-05-31 11:48:51 +00:00
|
|
|
network = '<em><%:Config error%></em>';
|
2014-11-09 17:37:15 +00:00
|
|
|
else
|
2018-05-31 11:48:51 +00:00
|
|
|
network = data[j].iface;
|
|
|
|
|
|
|
|
tbl.appendChild(E('<div class="tr cbi-section-table-row cbi-rowstyle-%d">'.format(((j + i) % 2) + 1), [
|
|
|
|
E('<div class="td">', [ E('<strong>', configuration) ]),
|
|
|
|
E('<div class="td">', next_update),
|
|
|
|
E('<div class="td">', lookup),
|
|
|
|
E('<div class="td">', registered_ip),
|
|
|
|
E('<div class="td">', network)
|
|
|
|
]));
|
2014-11-09 17:37:15 +00:00
|
|
|
}
|
|
|
|
|
2018-05-31 11:48:51 +00:00
|
|
|
if (tbl.firstElementChild === tbl.lastElementChild || (data[0].enabled == 0 && tbl.childNodes.length == 2) ) {
|
2014-11-09 17:37:15 +00:00
|
|
|
var br = '<br />';
|
2018-05-31 11:48:51 +00:00
|
|
|
var msg = '<%:There is no service configured.%>';
|
|
|
|
if (tbl.firstElementChild !== tbl.lastElementChild)
|
2014-11-09 17:37:15 +00:00
|
|
|
br = '';
|
2018-05-31 11:48:51 +00:00
|
|
|
msg = br + msg;
|
|
|
|
tbl.appendChild(E('<div class="tr cbi-section-table-row">', [
|
|
|
|
E('<div class="td">', [ E('<em>', msg) ])
|
|
|
|
]));
|
2014-11-09 17:37:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// force to immediate show status (not waiting for XHR.poll)
|
2015-11-15 10:42:43 +00:00
|
|
|
XHR.get('<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
|
2014-11-09 17:37:15 +00:00
|
|
|
function(x, data) {
|
2015-02-10 20:49:57 +00:00
|
|
|
if (data) { _data2elements(x, data); }
|
2014-11-09 17:37:15 +00:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2015-11-15 10:42:43 +00:00
|
|
|
XHR.poll(15, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
|
2014-11-09 17:37:15 +00:00
|
|
|
function(x, data) {
|
2015-02-10 20:49:57 +00:00
|
|
|
if (data) { _data2elements(x, data); }
|
2014-10-10 19:55:22 +00:00
|
|
|
}
|
|
|
|
);
|
2015-02-10 20:49:57 +00:00
|
|
|
|
2014-10-10 19:55:22 +00:00
|
|
|
//]]></script>
|
|
|
|
|
|
|
|
<fieldset class="cbi-section" id="ddns_status_section">
|
2015-10-07 17:07:36 +00:00
|
|
|
<legend><a href="<%=url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%></a></legend>
|
2014-10-10 19:55:22 +00:00
|
|
|
|
2018-05-31 11:48:51 +00:00
|
|
|
<div class="table cbi-section-table" id="ddns_status_table">
|
|
|
|
<div class="tr cbi-section-table-titles">
|
|
|
|
<div class="th cbi-section-table-cell"><%:Configuration%></div>
|
|
|
|
<div class="th cbi-section-table-cell"><%:Next Update%></div>
|
|
|
|
<div class="th cbi-section-table-cell"><%:Lookup Hostname%></div>
|
|
|
|
<div class="th cbi-section-table-cell"><%:Registered IP%></div>
|
|
|
|
<div class="th cbi-section-table-cell"><%:Network%></div>
|
|
|
|
</div>
|
|
|
|
<div class="tr cbi-section-table-row">
|
|
|
|
<div class="td" colspan="5"><em><br /><%:Collecting data...%></em></div>
|
|
|
|
</div>
|
2014-10-10 19:55:22 +00:00
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
<!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->
|