<%+cbi/valueheader%>

<script type="text/javascript">//<![CDATA[
	function act_download_rule(btn,filename)
	{
		btn.disabled = true;
		btn.value    = '<%:Downloading Rule...%> ';
		XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","download_rule")%>',
			{
				filename: filename
			},
			function(x,status)
			{
				if ( x && x.status == 200 ) {
					if(status.rule_download_status=="0")
					{
						btn.value = '<%:Downloading Fail%>';
					}
					else if (status.rule_download_status=="1")
					{
						btn.value = '<%:Downloading Successful%>';
					}
					else if (status.rule_download_status=="2")
					{
						btn.value = '<%:Rule No Change%>';
					}
				}
				else {
					btn.value = '<%:Downloading Timeout%>';
				}
			}
		);
		btn.disabled = false;
		return false;
	}
//]]></script>


<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Click to Update%>" onclick="return act_download_rule(this,'<%=self:cfgvalue(section)%>')" />

<%+cbi/valuefooter%>
