<script type="text/javascript">//<![CDATA[
XHR.poll(1, '<%=url([[admin]], [[nas]], [[gowebdav]], [[status]])%>', null,
	function(x, data) {
		var tb = document.getElementById('gowebdav_status');
		if (data && tb) {
			if (data.running) {
				var links = '<font color=green>GoWebDav <%:RUNNING%></font><input class="cbi-button mar-10" type="button" value="<%:Open Web Interface%>" onclick="openwebui();" />';
				tb.innerHTML = links;
			} else {
				tb.innerHTML = '<font color=red>GoWebDav <%:NOT RUNNING%></font>';
			}
		}
	}
);

function openwebui() {
	var url = window.location.hostname+":<%=luci.sys.exec("uci -q get gowebdav.config.listen_port"):gsub("^%s*(.-)%s*$", "%1")%>";
	window.open('http://'+url,'target','');
};
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
	<p id="gowebdav_status">
		<em><%:Collecting data...%></em>
	</p>
</fieldset>
