	<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<!--#include file="Ex_Cls/Ex_RefreshCls.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css"> 
<script src="inc/main.js"></script>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<%

Dim Action,ExComm,ExRefresh
Set ExComm=new Ex_CommonCls
Set ExRefresh=new Ex_Refreshcls
ExComm.IsAdLogin 
ExComm.IsIpAllow
ExComm.GetConfigCache("*")
Action=Request.QueryString("action")
Select Case Action
	Case "config"
		Config
	Case "createview"
		Createview
End Select 
sub Config
%>
<script>
function checkconfig()
{
	if (isNumber(g("htmlviewpernum").value)==false) return msg("日志每次生成多少条必须为数字","htmlviewpernum");
}
</script>
<form name="form1" method="post" action="?action=createview&flag=0" onSubmit="return checkconfig()">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="border tablebg">
    <tr>
      <th colspan="2" class="topbg">日志静态发布</th>
    </tr>
    <tr>
      <td width="38%" class="tdbg"><div align="center">每次生成日志篇数</div></td>
      <td width="62%" class="tdbg"><input name="htmlviewpernum" type="text" id="htmlviewpernum" value="<%=Application(Sn&"HtmlViewPerNum")%>">
      &nbsp;&nbsp;&nbsp;
      <input type="submit" name="Submit" value="生成"></td></tr>
    <tr style="display:none">
      <td colspan="2" class="tdbg"><div align="center"></div></td>
    </tr>
    <tr>
      <td colspan="2" class="tdbg"><div align="center"></div></td>
    </tr>
  </table>
</form>
<%
End Sub  
Sub ShowProcess(Title,ProMsg,ProStatus,Total,CurNum)
	Dim Html,Width,PerCent,Interval
	'On Error Resume Next 
	InterVal=5000
	If CurNum="" And CInt(CurNum)<>0 And CInt(Total)<>0 Then 
		PerCent=Clng(CurNum-1)/Clng(Total)
	Else 
		PerCent=CLng(CurNum)/CLng(Total)
	End If 
	Width=650*PerCent
	If ProStatus<>"ed" Then 
		Html=Html&"<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""border tablebg"">"
		Html=Html&"<tr>"
		Html=Html&"<th class=""topbg"">"&Title&"</th>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"">&nbsp;</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"" style=""text-align:center;"">"&ProMsg&"</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td width=""63%"" class=""tdbg"" style=""text-align:center;""><div style=""background:#7C9AE6;width:650px;text-align:left;"">"
		Html=Html&"<img src=""images/admin/bar.gif"" width="""&Width&""" height=""20"">"
		Html=Html&"</div></td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"" style=""text-align:center;"">"&InterVal/1000&"秒钟后将自动进行下一次生成.</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"" style=""text-align:center;""><font color=red>如果出现生成页数反复,可能是你的空间被限制了内存.如果出现Service Unavailable 可能是空间被限制了Cpu占用率.请到<a href=""http://bbs.ex123.net"" target=""_blank"">论坛</a>查看解决方法.</font></td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td width=""63%"" class=""tdbg""><div align=""center"">"
		Html=Html&"<input type=""button"" value=""停止"" onclick=""window.location='?action=config';"">"
		Html=Html&"</div></td>"
		Html=Html&"</tr>"
		Html=Html&"</table>"
		Html=Html&"<script>var t;t=setInterval(""document.location='?action=createview'"","&InterVal&");</script>"
	ElseIf Err.Number<>0 Then 
		Html=Html&"<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""border tablebg"">"
		Html=Html&"<tr>"
		Html=Html&"<th class=""topbg"">"&Title&"</th>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"">&nbsp;</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"" style=""text-align:center;"">静态生成错误:可能是空间内存受限制或者数据导致.Vip用户可以联系客服协助解决.</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td width=""63%"" class=""tdbg""><div align=""center"">"
		Html=Html&"<img src=""images/admin/bar.gif"" width=""650"" height=""20"">"
		Html=Html&"</div></td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td width=""63%"" class=""tdbg""><div align=""center"">"
		Html=Html&"<input type=""button"" value=""返回"" onclick=""window.location='?action=config';"">"
		Html=Html&"</div></td>"
		Html=Html&"</tr>"
		Html=Html&"</table>"
	Else
		Html=Html&"<table width=""98%"" border=""0"" align=""center"" cellpadding=""2"" cellspacing=""1"" class=""border tablebg"">"
		Html=Html&"<tr>"
		Html=Html&"<th class=""topbg"">"&Title&"</th>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"">&nbsp;</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td class=""tdbg"" style=""text-align:center;"">生成完毕</td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td width=""63%"" class=""tdbg""><div align=""center"">"
		Html=Html&"<img src=""images/admin/bar.gif"" width=""650"" height=""20"">"
		Html=Html&"</div></td>"
		Html=Html&"</tr>"
		Html=Html&"<tr>"
		Html=Html&"<td width=""63%"" class=""tdbg""><div align=""center"">"
		Html=Html&"<input type=""button"" value=""返回"" onclick=""window.location='?action=config';"">"
		Html=Html&"</div></td>"
		Html=Html&"</tr>"
		Html=Html&"</table>"
	End If 
	Response.write Html
End Sub 
Sub CreateView
	Dim ProMsg,Id,Rs,Page,PageTotal
	If Request.QueryString("flag")="0" Then 
		Conn.Execute "update Ex_Config set HtmlViewPerNum="&Request.Form("HtmlViewPerNum")
		Application.Lock
		Application(Sn&"HtmlViewPerNum")=Request.Form("HtmlViewPerNum")
		Application.UnLock
	End If 
	ExRefresh.CreateView ""
	PageTotal=Request.Cookies(md5(Sn))("PageTotal")
	Page=Request.Cookies(md5(Sn))("Page")
	ProMsg="本次生成共需要生成<font color=red>"&PageTotal&"</font>页,每次生成<font color=red>"&Application(sn&"HtmlViewPerNum")&"</font>页,目前生成了<font color=red>"&Page&"</font>页"
	If CInt(Page)>=CInt(PageTotal) Then 
		ShowProcess "日志静态生成进度",ProMsg,"ed",PageTotal,Page
		Response.Cookies(md5(Sn))("Page")=""
		Response.Cookies(md5(Sn))("PageTotal")=""
	Else 
		ShowProcess "日志静态生成进度",ProMsg,"",PageTotal,Page
	End If
End Sub 
%>
</body>
</html>
