123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
- <script type="text/javascript">//<![CDATA[
- // 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
- while (tbl.rows.length > 1)
- tbl.deleteRow(1);
- // variable for Modulo-Division use to set cbi-rowstyle-? (0 or 1)
- 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-' + (((j + i) % 2) + 1);
- var td = tr.insertCell(-1);
- td.colSpan = 2 ;
- td.innerHTML = txt + " - " + url
- tr.insertCell(-1).colSpan = 3 ;
- i++ ;
- }
- for( j = 1; j < data.length; j++ )
- {
- var tr = tbl.insertRow(-1);
- tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((j + i) % 2) + 1) ;
- // configuration
- tr.insertCell(-1).innerHTML = '<strong>' + data[j].section + '</strong>' ;
- // pid
- // data[j].pid ignored here
- // last update
- // data[j].datelast ignored here
- // next update
- switch (data[j].datenext) {
- case "_empty_":
- tr.insertCell(-1).innerHTML = '<em><%:Unknown error%></em>' ;
- break;
- case "_stopped_":
- tr.insertCell(-1).innerHTML = '<em><%:Stopped%></em>' ;
- break;
- case "_disabled_":
- tr.insertCell(-1).innerHTML = '<em><%:Disabled%></em>' ;
- break;
- case "_noupdate_":
- tr.insertCell(-1).innerHTML = '<em><%:Update error%></em>' ;
- break;
- case "_runonce_":
- tr.insertCell(-1).innerHTML = '<em><%:Run once%></em>' ;
- break;
- case "_verify_":
- tr.insertCell(-1).innerHTML = '<em><%:Verify%></em>';
- break;
- default:
- tr.insertCell(-1).innerHTML = data[j].datenext ;
- break;
- }
- // domain
- if (data[j].domain == "_nodomain_")
- tr.insertCell(-1).innerHTML = '<em><%:config error%></em>';
- else
- tr.insertCell(-1).innerHTML = data[j].domain;
- // registered IP
- switch (data[j].reg_ip) {
- case "_nodomain_":
- tr.insertCell(-1).innerHTML = '<em><%:Config error%></em>';
- break;
- case "_nodata_":
- tr.insertCell(-1).innerHTML = '<em><%:No data%></em>';
- break;
- case "_noipv6_":
- tr.insertCell(-1).innerHTML = '<em><%:IPv6 not supported%></em>';
- break;
- default:
- tr.insertCell(-1).innerHTML = data[j].reg_ip;
- break;
- }
- // monitored interface
- if (data[j].iface == "_nonet_")
- tr.insertCell(-1).innerHTML = '<em><%:Config error%></em>';
- else
- tr.insertCell(-1).innerHTML = data[j].iface;
- }
- if (tbl.rows.length == 1 || (data[0].enabled == 0 && tbl.rows.length == 2) ) {
- var br = '<br />';
- if (tbl.rows.length > 1)
- br = '';
- var tr = tbl.insertRow(-1);
- tr.className = "cbi-section-table-row";
- var td = tr.insertCell(-1);
- td.colSpan = 5;
- td.innerHTML = '<em>' + br + '<%:There is no service configured.%></em>' ;
- }
- }
- // force to immediate show status (not waiting for XHR.poll)
- XHR.get('<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
- function(x, data) {
- if (data) { _data2elements(x, data); }
- }
- );
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "ddns", "status")%>', null,
- function(x, data) {
- if (data) { _data2elements(x, data); }
- }
- );
- //]]></script>
- <fieldset class="cbi-section" id="ddns_status_section">
- <legend><a href="<%=luci.dispatcher.build_url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%></a></legend>
- <table class="cbi-section-table" id="ddns_status_table">
- <tr class="cbi-section-table-titles">
- <th class="cbi-section-table-cell"><%:Configuration%></th>
- <th class="cbi-section-table-cell"><%:Next Update%></th>
- <th class="cbi-section-table-cell"><%:Hostname/Domain%></th>
- <th class="cbi-section-table-cell"><%:Registered IP%></th>
- <th class="cbi-section-table-cell"><%:Network%></th>
- </tr>
- <tr class="cbi-section-table-row">
- <td colspan="5"><em><br /><%:Collecting data...%></em></td>
- </tr>
- </table>
- </fieldset>
- <!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->
|