<%
	local uci = require 'luci.model.uci'.cursor()
	ssl = uci:get_first('alist', 'alist', 'ssl')
	if ssl == '1' then
		protocol="https://"
	else
		protocol="http://"
	end
%>

<script type="text/javascript">//<![CDATA[
	XHR.poll(5, '<%=url("admin/nas/alist/alist_status")%>', null,
		function(x, st)
		{
			var tb = document.getElementById('alist_status');
			if (st && tb)
			{
				if (st.running)
				{
					tb.innerHTML = '<em style=\"color:green\"><b>Alist <%:RUNNING%></b></em>' + "<input class=\"cbi-button cbi-button-reload mar-10\" type=\"button\" value=\" <%:Open Web Interface%> \" onclick=\"window.open('<%=protocol%>" + window.location.hostname + ":" + st.port + "/')\"/>";
				}
				else
				{
					tb.innerHTML = '<em style=\"color:red\"><b>Alist <%:NOT RUNNING%></b></em>';
				}
			}
		}
	);
//]]></script>

<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
	<p id="alist_status">
		<em><b><%:Collecting data...%></b></em>
	</p>
</fieldset>
