<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp" -->
<!--#include file="top.asp"-->
<!--#include file="inc/htmlconfig.asp"-->
<%
tid=request.QueryString("tid")

if tid=0 then
htmlpage="products"
elseif tid=10 then
htmlpage="case"
end if

pageumb="16"
%>
<div id="container">
<div class="top_but">
 <li class="left">&nbsp;</li>
 <li><a href="book_anclass.asp?tid=<%=tid%>"><img src="images/but_1.gif" alt="添加" ></a></li>
 <li><a href="book_anclass.asp?tid=<%=tid%>"><img src="images/but_11.gif" alt="管理"></a></li>
 <li><a href="?tid=<%=tid%>"><img src="images/but_10.gif" alt="生成页面" ></a></li>
 <li><img src="images/but_8.gif" alt="刷新" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" onClick="window.print() "/></li>
</div>
<div class="tableAll titlebgcolor">
 <li style="width:30px;">&nbsp;</li>
 <li style="width:700px;">生成静态页面</li>
</div>

<div class="html titlebgcolor" style="padding-left:35px;">
<%
call Htmlcall()
%>
</div>
</div>
<!--#include file="footer.asp"-->
<%
totalrec=Conn.Execute("select count(*) from com_books where type="&tid&"")(0)
totalpage=int(totalrec/pageumb)

If (totalpage * pageumb)<totalrec Then
totalpage=totalpage+1
End If
if totalpage<=1 then
call htmll(""&HTMLname1_cn&"",""&HTMLname2_cn&"",""&HTMLname3_cn&htmlpage&"_page1.html",""&htmlpage&".asp","Page=",1,"","","","")
if Const_webEn=1 then
call htmll(""&HTMLname1_en&"",""&HTMLname2_en&"",""&HTMLname3_en&htmlpage&"_page1.html",""&htmlpage&".asp","Page=",1,"","","","")
end if
if Const_webUtf=1 then
call htmll(""&HTMLname1_utf&"",""&HTMLname2_utf&"",""&HTMLname3_utf&htmlpage&"_page1.html",""&htmlpage&".asp","Page=",1,"","","","")
end if

else
for i=1 to totalpage
call htmll(""&HTMLname1_cn&"",""&HTMLname2_cn&"",""&HTMLname3_cn&htmlpage&"_page"&i&".html",""&htmlpage&".asp","Page=",i,"","","","")
if Const_webEn=1 then
call htmll(""&HTMLname1_en&"",""&HTMLname2_en&"",""&HTMLname3_en&htmlpage&"_page"&i&".html",""&htmlpage&".asp","Page=",i,"","","","")
end if
if Const_webUtf=1 then
call htmll(""&HTMLname1_utf&"",""&HTMLname2_utf&"",""&HTMLname3_utf&htmlpage&"_page"&i&".html",""&htmlpage&".asp","Page=",i,"","","","")
end if

next
end If

Set rs=Server.CreateObject("ADODB.Recordset")
sql="select * from com_class where type="&tid&" order by ID desc"
rs.open sql,conn,1,1
If rs.eof Then 
	Class_Num=0
Else 
	Class_Num=1
do while not rs.eof

if rs("cid")=0 then

		'sortpath=rs("sortpath")
		id=rs("id")
		totalrec=Conn.Execute("Select count(*) from com_books where cid="&ID&"")(0)
		'totalrec=Conn.Execute("Select count(*) from com_books where Instr(sortpath,'"&sortpath&"')>0")(0)
		totalpage=int(totalrec/pageumb)
		If (totalpage * pageumb)<totalrec Then
		totalpage=totalpage+1
		End If
		if totalpage<=1 then
		call htmll(""&HTMLname1_cn&"",""&HTMLname2_cn&"",""&HTMLname3_cn&htmlpage&"_"&id&"_page1.html",""&htmlpage&".asp","typeid=",id,"Page=",1,"","")
		if Const_webEn=1 then
		call htmll(""&HTMLname1_en&"",""&HTMLname2_en&"",""&HTMLname3_en&htmlpage&"_"&id&"_page1.html",""&htmlpage&".asp","typeid=",id,"Page=",1,"","")
		end if
		if Const_webUtf=1 then
		call htmll(""&HTMLname1_utf&"",""&HTMLname2_utf&"",""&HTMLname3_utf&htmlpage&"_"&id&"_page1.html",""&htmlpage&".asp","typeid=",id,"Page=",1,"","")
		end if
		
		else
		for i=1 to totalpage
		call htmll(""&HTMLname1_cn&"",""&HTMLname2_cn&"",""&HTMLname3_cn&htmlpage&"_"&id&"_page"&i&".html",""&htmlpage&".asp","typeid=",id,"Page=",i,"","")
		if Const_webEn=1 then
		call htmll(""&HTMLname1_en&"",""&HTMLname2_en&"",""&HTMLname3_en&htmlpage&"_"&id&"_page"&i&".html",""&htmlpage&".asp","typeid=",id,"Page=",i,"","")
		end if
		if Const_webUtf=1 then
		call htmll(""&HTMLname1_utf&"",""&HTMLname2_utf&"",""&HTMLname3_utf&htmlpage&"_"&id&"_page"&i&".html",""&htmlpage&".asp","typeid=",id,"Page=",i,"","")
		end if
		next
		End If

else

		'sortpath=rs("sortpath")
		nid=rs("id")
		id=rs("cid")
		totalrec=Conn.Execute("Select count(*) from com_books where nid="&nid&"")(0)
		'totalrec=Conn.Execute("Select count(*) from com_books where Instr(sortpath,'"&sortpath&"')>0")(0)
		totalpage=int(totalrec/pageumb)
		If (totalpage * pageumb)<totalrec Then
		totalpage=totalpage+1
		End If
		if totalpage<=1 then
		call htmll(""&HTMLname1_cn&"",""&HTMLname2_cn&"",""&HTMLname3_cn&htmlpage&"_"&id&"_"&nid&"_page1.html",""&htmlpage&".asp","typeid=",id,"nid=",nid,"Page=",1)
		if Const_webEn=1 then
		call htmll(""&HTMLname1_en&"",""&HTMLname2_en&"",""&HTMLname3_en&htmlpage&"_"&id&"_"&nid&"_page1.html",""&htmlpage&".asp","typeid=",id,"nid=",nid,"Page=",1)
		end if
		if Const_webUtf=1 then
		call htmll(""&HTMLname1_utf&"",""&HTMLname2_utf&"",""&HTMLname3_utf&htmlpage&"_"&id&"_"&nid&"_page1.html",""&htmlpage&".asp","typeid=",id,"nid=",nid,"Page=",1)
		end if
		
		else
		for i=1 to totalpage
		call htmll(""&HTMLname1_cn&"",""&HTMLname2_cn&"",""&HTMLname3_cn&htmlpage&"_"&id&"_"&nid&"_page"&i&".html",""&htmlpage&".asp","typeid=",id,"nid=",nid,"Page=",i)
		if Const_webEn=1 then
		call htmll(""&HTMLname1_en&"",""&HTMLname2_en&"",""&HTMLname3_en&htmlpage&"_"&id&"_"&nid&"_page"&i&".html",""&htmlpage&".asp","typeid=",id,"nid=",nid,"Page=",i)
		end if
		if Const_webUtf=1 then
		call htmll(""&HTMLname1_utf&"",""&HTMLname2_utf&"",""&HTMLname3_utf&htmlpage&"_"&id&"_"&nid&"_page"&i&".html",""&htmlpage&".asp","typeid=",id,"nid=",nid,"Page=",i)
		end if
		next
		End If
		
end if

Response.Write "<script>bar_img.width="&Fix((Class_Num/rs.recordcount)*200)&";"
Response.Write "bar_txt1.innerHTML=""成功生成"&Class_Num&"个分类的HTML静态页面。完成比例：" & formatnumber(Class_Num/rs.recordcount*100) & """;</script>"
Response.Flush
rs.movenext
Class_Num=Class_Num+1
Loop
End If
rs.close
set rs=nothing



conn.close
set conn=nothing
%>