<!-- ++ BEGIN ++ Dynamic DNS ++ system_status.htm ++ -->
<script type="text/javascript">//<![CDATA[

	//start polling data every 30 second, this doesn't change so much
	XHR.poll(30, '<%=url([[admin]], [[services]], [[ddns]], [[status]])%>', null,
		function(x, data) {
			if (data) { 
				var tbl = document.getElementById('ddns_status_table');
				// security check
				if ( !(tbl) ) { return; }
				
				var rows = [];
		
				// DDNS Service disabled
				if (data[0].enabled == 0) {
					var ddns_legend = document.getElementById('ddns_status_legend');
					ddns_legend.style.display='none';
					rows.push([
							'<strong><font color="red"><%:DDNS Autostart disabled%></font>',
							'<a class="cbi-button cbi-button-action important" type="button" href="' + data[0].url_up + '"><%:enable here%></a></strong>'
							]);
				} else {
					for(var j = 1; j < data.length; j++ )
					{
						
						rows.push([
								'<strong>' + data[j].section + '</strong>', //configuration
								data[j].datenextstat ? '<em>'+data[j].datenextstat+'</em>' : '<em>'+data[j].datenext+'</em>',
								data[j].lookup ? data[j].lookup : '<em><%:config error%></em>',
								data[j].reg_ip ? data[j].reg_ip : '<em><%:No data%></em>',
								data[j].iface        // monitored interface
								]);
					}
				}
				
				cbi_update_table(tbl, rows, '<%:There is no service configured.%>'); 
			}
		}
	);
	
//]]></script>

<fieldset class="cbi-section" id="ddns_status_section">
	<legend><a href="<%=url([[admin]], [[services]], [[ddns]])%>"><%:Dynamic DNS%></a></legend>
	<div class="cbi-section-node">
		<div class="table" id="ddns_status_table">
			<div class="tr table-titles" id="ddns_status_legend">
				<div class="th"><%:Configuration%></div>
				<div class="th"><%:Next Update%></div>
				<div class="th"><%:Lookup Hostname%></div>
				<div class="th"><%:Registered IP%></div>
				<div class="th"><%:Network%></div>
			</div>
			<div class="tr">
				<div class="td"><em><br /><%:Collecting data...%></em></div>
			</div>
		</div>
	</div>
</fieldset>
<!-- ++ END ++ Dynamic DNS ++ system_status.htm ++ -->
