2 <!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
3 <script type=
"text/javascript">//<![CDATA[
4 // helper to move status data to the relevant
6 // called by XHR.poll and XHR.get
7 function _data2elements(x, data) {
8 var tbl = document.getElementById('ddns_status_table');
10 if ( !(tbl) ) { return; }
13 while (tbl.rows.length
> 1)
16 // variable for Modulo-Division use to set cbi-rowstyle-? (
0 or
1)
20 // no data =
> no ddns-scripts Version
2 installed
22 var txt = '
<br /><strong><font color=
"red"><%:Old version of ddns-scripts installed%
></font>' ;
23 var url = '
<a href=
"' ;
24 url += '<%=luci.dispatcher.build_url("admin
", "system
", "packages
")%>' ;
25 url += '"><%:install update here%
></a></strong>' ;
26 var tr = tbl.insertRow(-
1);
27 tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) %
2) +
1);
28 var td = tr.insertCell(-
1);
30 td.innerHTML = txt +
" - " + url
31 tr.insertCell(-
1).colSpan =
3 ;
35 // DDNS Service disabled
36 if (data[
0].enabled ==
0) {
37 var txt = '
<strong><font color=
"red"><%:DDNS Autostart disabled%
></font>' ;
38 var url = '
<a href=
"' + data[0].url_up + '"><%:enable here%
></a></strong>' ;
39 var tr = tbl.insertRow(-
1);
40 tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) %
2) +
1);
41 var td = tr.insertCell(-
1);
43 td.innerHTML = txt +
" - " + url
44 tr.insertCell(-
1).colSpan =
3 ;
48 for( i =
1; i < data.length; i++ )
50 var tr = tbl.insertRow(-
1);
51 tr.className = 'cbi-section-table-row cbi-rowstyle-' + (((i + x) %
2) +
1) ;
54 tr.insertCell(-
1).innerHTML = '
<strong>' + data[i].section + '
</strong>' ;
57 // data[i].pid ignored here
60 // data[i].datelast ignored here
63 switch (data[i].datenext) {
65 tr.insertCell(-
1).innerHTML = '
<em><%:Unknown error%
></em>' ;
68 tr.insertCell(-
1).innerHTML = '
<em><%:Stopped%
></em>' ;
71 tr.insertCell(-
1).innerHTML = '
<em><%:Disabled%
></em>' ;
74 tr.insertCell(-
1).innerHTML = '
<em><%:Update error%
></em>' ;
77 tr.insertCell(-
1).innerHTML = '
<em><%:Run once%
></em>' ;
80 tr.insertCell(-
1).innerHTML = '
<em><%:Verify%
></em>';
83 tr.insertCell(-
1).innerHTML = data[i].datenext ;
88 if (data[i].domain ==
"_nodomain_")
89 tr.insertCell(-
1).innerHTML = '
<em><%:config error%
></em>';
91 tr.insertCell(-
1).innerHTML = data[i].domain;
94 switch (data[i].reg_ip) {
96 tr.insertCell(-
1).innerHTML = '
<em><%:Config error%
></em>';
99 tr.insertCell(-
1).innerHTML = '
<em><%:No data%
></em>';
102 tr.insertCell(-
1).innerHTML = '
<em><%:IPv6 not supported%
></em>';
105 tr.insertCell(-
1).innerHTML = data[i].reg_ip;
109 // monitored interfacce
110 if (data[i].iface ==
"_nonet_")
111 tr.insertCell(-
1).innerHTML = '
<em><%:Config error%
></em>';
113 tr.insertCell(-
1).innerHTML = data[i].iface;
116 if (tbl.rows.length ==
1 || (data[
0].enabled ==
0 && tbl.rows.length ==
2) ) {
118 if (tbl.rows.length
> 1)
120 var tr = tbl.insertRow(-
1);
121 tr.className =
"cbi-section-table-row";
122 var td = tr.insertCell(-
1);
124 td.innerHTML = '
<em>' + br + '<%:There is no service configured.%
></em>' ;
128 // force to immediate show status (not waiting for XHR.poll)
129 XHR.get('<%=luci.dispatcher.build_url(
"admin",
"services",
"ddns",
"status")%
>', null,
131 _data2elements(x, data);
135 XHR.poll(
10, '<%=luci.dispatcher.build_url(
"admin",
"services",
"ddns",
"status")%
>', null,
137 _data2elements(x, data);
142 <fieldset class=
"cbi-section" id=
"ddns_status_section">
143 <legend><a href=
"<%=luci.dispatcher.build_url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%
></a></legend>
145 <table class=
"cbi-section-table" id=
"ddns_status_table">
146 <tr class=
"cbi-section-table-titles">
147 <th class=
"cbi-section-table-cell"><%:Configuration%
></th>
148 <th class=
"cbi-section-table-cell"><%:Next Update%
></th>
149 <th class=
"cbi-section-table-cell"><%:Hostname/Domain%
></th>
150 <th class=
"cbi-section-table-cell"><%:Registered IP%
></th>
151 <th class=
"cbi-section-table-cell"><%:Network%
></th>
153 <tr class=
"cbi-section-table-row">
154 <td colspan=
"5"><em><br /><%:Collecting data...%
></em></td>
158 <!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->