<% function mm_create_list(mm_create_tsid) %>
<%
Dim rsnews__mmid
rsnews__mmid = "0"
If (mm_create_tsid <> "") Then
  rsnews__mmid = mm_create_tsid
End If

%>
<%
Dim rsnews
Dim rsnews_numRows

Set rsnews = Server.CreateObject("ADODB.Recordset")
rsnews.ActiveConnection = MM_conn_news_STRING
rsnews.Source = "SELECT *  FROM (t_news inner join t_type on t_news.n_tid = t_type.t_id) inner join t_type_son on t_news.n_tsid = t_type_son.ts_id  WHERE n_check = 1 and n_tsid = " + Replace(rsnews__mmid, "'", "''") + "  ORDER BY n_date DESC"
rsnews.CursorType = 0
rsnews.CursorLocation = 2
rsnews.LockType = 1
rsnews.Open()

rsnews_numRows = 0
%>
<%
Dim rst_nav_all
Dim rst_nav_all_numRows

Set rst_nav_all = Server.CreateObject("ADODB.Recordset")
rst_nav_all.ActiveConnection = MM_conn_news_STRING
rst_nav_all.Source = "SELECT *  FROM t_type_son inner join t_type on t_type_son.ts_pid=t_type.t_id  ORDER BY t_id ,ts_id"
rst_nav_all.CursorType = 0
rst_nav_all.CursorLocation = 2
rst_nav_all.LockType = 1
rst_nav_all.Open()

rst_nav_all_numRows = 0
%>
<%
Dim rsts_create_detail__MMColParam
rsts_create_detail__MMColParam = "0"
If (mm_create_tsid <> "") Then
  rsts_create_detail__MMColParam = mm_create_tsid
End If
%>
<%
Dim rsts_create_detail
Dim rsts_create_detail_numRows

Set rsts_create_detail = Server.CreateObject("ADODB.Recordset")
rsts_create_detail.ActiveConnection = MM_conn_news_STRING
rsts_create_detail.Source = "SELECT *  FROM t_type_son inner join t_type on t_type_son.ts_pid=t_type.t_id  WHERE ts_id = " + Replace(rsts_create_detail__MMColParam, "'", "''") + ""
rsts_create_detail.CursorType = 0
rsts_create_detail.CursorLocation = 2
rsts_create_detail.LockType = 1
rsts_create_detail.Open()

rsts_create_detail_numRows = 0
%>
<%
dim mm_ctid_relation
mm_ctid_relation=(rsts_create_detail.Fields.Item("ts_pid").Value)
%>
<%
Dim rsts_nav_all__MMColParam
rsts_nav_all__MMColParam = "0"
If (mm_ctid_relation <> "") Then
  rsts_nav_all__MMColParam = mm_ctid_relation
End If
%>
<%
Dim rsts_nav_all
Dim rsts_nav_all_numRows

Set rsts_nav_all = Server.CreateObject("ADODB.Recordset")
rsts_nav_all.ActiveConnection = MM_conn_news_STRING
rsts_nav_all.Source = "SELECT *  FROM t_type_son  WHERE ts_pid = " + Replace(rsts_nav_all__MMColParam, "'", "''") + ""
rsts_nav_all.CursorType = 0
rsts_nav_all.CursorLocation = 2
rsts_nav_all.LockType = 1
rsts_nav_all.Open()

rsts_nav_all_numRows = 0
%>
<%
Dim rsnews_commend__MMColParam
rsnews_commend__MMColParam = "1"
If (mm_create_tsid <> "") Then
  rsnews_commend__MMColParam = mm_create_tsid
End If
%>
<%
Dim rsnews_commend
Dim rsnews_commend_numRows

Set rsnews_commend = Server.CreateObject("ADODB.Recordset")
rsnews_commend.ActiveConnection = MM_conn_news_STRING
rsnews_commend.Source = "SELECT *  FROM t_news  WHERE n_commend = 1 and n_check=1 and n_tsid = " + Replace(rsnews_commend__MMColParam, "'", "''") + ""
rsnews_commend.CursorType = 0
rsnews_commend.CursorLocation = 2
rsnews_commend.LockType = 1
rsnews_commend.Open()

rsnews_commend_numRows = 0
%>
<%
Dim rsnews_stype
Dim rsnews_stype_numRows

Set rsnews_stype = Server.CreateObject("ADODB.Recordset")
rsnews_stype.ActiveConnection = MM_conn_news_STRING
rsnews_stype.Source = "SELECT * FROM t_stype"
rsnews_stype.CursorType = 0
rsnews_stype.CursorLocation = 2
rsnews_stype.LockType = 1
rsnews_stype.Open()

rsnews_stype_numRows = 0
%>
<%
Dim rsnews_hit__mmnhtsid
rsnews_hit__mmnhtsid = "0"
If (mm_create_tsid <> "") Then
  rsnews_hit__mmnhtsid = mm_create_tsid
End If
%>
<%
Dim rsnews_hit
Dim rsnews_hit_numRows

Set rsnews_hit = Server.CreateObject("ADODB.Recordset")
rsnews_hit.ActiveConnection = MM_conn_news_STRING
rsnews_hit.Source = "SELECT *  FROM t_news  WHERE n_check=1 and n_tsid = " + Replace(rsnews_hit__mmnhtsid, "'", "''") + "  ORDER BY n_hit DESC"
rsnews_hit.CursorType = 0
rsnews_hit.CursorLocation = 2
rsnews_hit.LockType = 1
rsnews_hit.Open()

rsnews_hit_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsnews_numRows = rsnews_numRows + Repeat1__numRows
%>
<%
Dim Repeat_nav__numRows
Dim Repeat_nav__index

Repeat_nav__numRows = -1
Repeat_nav__index = 0
rst_nav_all_numRows = rst_nav_all_numRows + Repeat_nav__numRows
%>
<%
'  *** Recordset Stats, Move To Record, and Go To Record: declare stats variables

Dim rsnews_total
Dim rsnews_first
Dim rsnews_last

' set the record count
rsnews_total = rsnews.RecordCount

' set the number of rows displayed on this page
If (rsnews_numRows < 0) Then
  rsnews_numRows = rsnews_total
Elseif (rsnews_numRows = 0) Then
  rsnews_numRows = 1
End If

' set the first and last displayed record
rsnews_first = 1
rsnews_last  = rsnews_first + rsnews_numRows - 1

' if we have the correct record count, check the other stats
If (rsnews_total <> -1) Then
  If (rsnews_first > rsnews_total) Then
    rsnews_first = rsnews_total
  End If
  If (rsnews_last > rsnews_total) Then
    rsnews_last = rsnews_total
  End If
  If (rsnews_numRows > rsnews_total) Then
    rsnews_numRows = rsnews_total
  End If
End If
%>

<%
' *** Recordset Stats: if we don't know the record count, manually count them

If (rsnews_total = -1) Then

  ' count the total records by iterating through the recordset
  rsnews_total=0
  While (Not rsnews.EOF)
    rsnews_total = rsnews_total + 1
    rsnews.MoveNext
  Wend

  ' reset the cursor to the beginning
  If (rsnews.CursorType > 0) Then
    rsnews.MoveFirst
  Else
    rsnews.Requery
  End If

  ' set the number of rows displayed on this page
  If (rsnews_numRows < 0 Or rsnews_numRows > rsnews_total) Then
    rsnews_numRows = rsnews_total
  End If

  ' set the first and last displayed record
  rsnews_first = 1
  rsnews_last = rsnews_first + rsnews_numRows - 1

  If (rsnews_first > rsnews_total) Then
    rsnews_first = rsnews_total
  End If
  If (rsnews_last > rsnews_total) Then
    rsnews_last = rsnews_total
  End If

End If
%>

<%
'Response.Buffer = False
dim yyrp
dim yyrpdata
dim mm_line
dim mm_file
dim mm_page
dim mm_temp
dim mm_page_list
dim mm_page_count
dim mm_template_path
dim mm_tspath
dim mm_path
dim mm_line_commend
mm_page = 1
mm_temp = 0
mm_page_list=""
mm_page_count=1
mm_template_path = server.mappath("templates/type_template/list_template.htm")
mm_tspath =(rsts_create_detail.Fields.Item("t_dir").Value)&"/"&(rsts_create_detail.Fields.Item("ts_dir").Value)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not(fso.FileExists(mm_template_path))  then
'response.Write (not(fso.FileExists(mm_tspath)))
'response.Write (mm_tspath)
%>
<script language=javascript>
alert( "生成失败,模板文件不存在！"  );
location.href = "javascript:history.back()"
</script>
<%
else
set fso_line = fso.opentextfile(mm_template_path,1,True)
yyrp = fso_line.readall
'response.Write yyrp
end if
%>
<%
' 生成大类导航菜单
dim mm_nav1
dim mm_raa
mm_nav1 = "| <a href="&chr(34)&"../../"&yns_list_default_page_path&chr(34)&" class="&chr(34)&yns_list_nav1_class&chr(34)&">首页</a> | "
mm_raa = 0
%>
<%
While ((Repeat_nav__numRows <> 0) AND (NOT rst_nav_all.EOF))
%>
<% if (rst_nav_all.Fields.Item("t_id").Value) <> mm_raa then %>
<%mm_nav1=mm_nav1&" <a href="&chr(34)&"../../"&(rst_nav_all.Fields.Item("t_dir").Value)&"/"&(rst_nav_all.Fields.Item("ts_dir").Value)&"/list_1.htm"&chr(34)&" class="&chr(34)&yns_list_nav1_class&chr(34)&">"&(rst_nav_all.Fields.Item("t_name").Value)&"</a> "&" | "%>
<% end if %>
<% mm_raa = (rst_nav_all.Fields.Item("t_id").Value)  %>
<%
  Repeat_nav__index=Repeat_nav__index+1
  Repeat_nav__numRows=Repeat_nav__numRows-1
  rst_nav_all.MoveNext()
Wend
%>
<%
'生成小类导航菜单
dim mm_nav2
mm_nav2 = "| "
do while not rsts_nav_all.eof
mm_nav2=mm_nav2&" <a href="&chr(34)&"../"&(rsts_nav_all.Fields.Item("ts_dir").Value)&"/list_1.htm"&chr(34)&" class="&chr(34)&yns_list_nav2_class&chr(34)&">"&(rsts_nav_all.Fields.Item("ts_name").Value)&"</a> "&" | "
rsts_nav_all.movenext
loop
%>
<%
'生成推荐新闻
if rsnews_commend.eof and rsnews_commend.bof then
mm_line_commend = "●  该小类还没有推荐新闻"
else
dim rc
rc = 0
do while not rsnews_commend.eof
rc= rc + 1
if rc < 10 then
mm_line_commend = mm_line_commend&"●  <a href="&chr(34)&(rsnews_commend.Fields.Item("n_fpath").Value)&"/"&(rsnews_commend.Fields.Item("n_fname").Value)&chr(34)&" target="&chr(34)&"_blank"&chr(34)&">"&(rsnews_commend.Fields.Item("n_title").Value)&"</a><br>"
end if
rsnews_commend.movenext
loop
end if
%>
<%
dim mm_line_hit
'生成点击排行
if rsnews_hit.eof and rsnews_hit.bof then
mm_line_hit = "●  没有新闻"
else
dim nhn
nhn = 0
do while not rsnews_hit.eof
nhn = nhn + 1
if nhn < 10 then
mm_line_hit = mm_line_hit&"●  <a href="&chr(34)&(rsnews_hit.Fields.Item("n_fpath").Value)&"/"&(rsnews_hit.Fields.Item("n_fname").Value)&chr(34)&" target="&chr(34)&"_blank"&chr(34)&">"&(rsnews_hit.Fields.Item("n_title").Value)&"</a><br>"
end if
rsnews_hit.movenext
loop
end if
%>
<%
dim mm_line_stype
'生成专题
if rsnews_stype.eof and rsnews_stype.bof then
mm_line_stype = " 没有专题"
else
do while not rsnews_stype.eof
mm_line_stype= mm_line_stype&"●  <a href="&chr(34)&"../../stype/list_stype_"&(rsnews_stype.Fields.Item("s_id").Value)&"1.htm"&chr(34)&">"&(rsnews_stype.Fields.Item("s_name").Value)&"</a><br>"
rsnews_stype.movenext
loop
end if
%>
<% If Not rsnews.EOF Or Not rsnews.BOF Then %>
<%
'生成页码
 if rsnews_total mod yns_list_repeat = 0 then
 mm_page_count= rsnews_total/yns_list_repeat
 else
 mm_page_count= int(rsnews_total/yns_list_repeat)+1
 end if
 for i = 1 to mm_page_count
 mm_page_list =mm_page_list&vbcrlf&" <a href="&chr(34)&"list_"&i&".htm"&chr(34)&">"&i&"</a> "
 next
%>
 <% While ((Repeat1__numRows <> 0) AND (NOT rsnews.EOF)) %>
  <% mm_line = mm_line&vbcrlf&"  <tr>"& vbcrlf &"    <td  height="&chr(34)&"22"&chr(34)&" class="&chr(34)&"pad-left"&chr(34)&"><a href=" &chr(34)&(rsnews.Fields.Item("n_fpath").Value)&"/"&(rsnews.Fields.Item("n_fname").Value)&chr(34)&" target="&chr(34)&"_blank"&chr(34)&">" &(rsnews.Fields.Item("n_title").Value) & "</a>   <font class=copyriht color=#999999>"&(rsnews.Fields.Item("n_fpath").Value)&"</font><br></td>"& vbcrlf &"  </tr>"%>
  <%
   if mm_temp <> mm_page then
   mm_file =  "list_"& mm_page &".htm"
   response.Write ("<li class=lh>"&mm_tspath&"/"&mm_file&" <font color=red>被创建</font></li>")
   mm_path = server.MapPath(mm_tspath&"/"&mm_file)
   set fso_index=fso.createtextfile(mm_path,True)
   end  if
   %>
  <%
  mm_temp = mm_page
  if (Repeat1__index+1) mod yns_list_repeat = 0 then
  yyrpdata = replace(yyrp,"t_page_list",mm_page_list)
  yyrpdata = replace(yyrpdata,"t_line",mm_line)
  yyrpdata = replace(yyrpdata,"t_nav1",mm_nav1)
  yyrpdata = replace(yyrpdata,"t_nav2",mm_nav2)
  yyrpdata = replace(yyrpdata,"t_commend",mm_line_commend)
  yyrpdata = replace(yyrpdata,"t_hit",mm_line_hit)
  yyrpdata = replace(yyrpdata,"t_stype",mm_line_stype)
  'response.Write yyrpdata
  fso_index.write yyrpdata
  mm_line = ""
  fso_index.close
  set fso_index = nothing
  mm_page = mm_page + 1
  end if

  %>
<%
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsnews.MoveNext()
Wend
%>
<%
if rsnews.eof then
  yyrpdata = replace(yyrp,"t_page_list",mm_page_list)
  yyrpdata = replace(yyrpdata,"t_line",mm_line)
  yyrpdata = replace(yyrpdata,"t_nav1",mm_nav1)
  yyrpdata = replace(yyrpdata,"t_nav2",mm_nav2)
  yyrpdata = replace(yyrpdata,"t_commend",mm_line_commend)
  yyrpdata = replace(yyrpdata,"t_hit",mm_line_hit)
  yyrpdata = replace(yyrpdata,"t_stype",mm_line_stype)
  'response.Write yyrpdata
  if mm_line <> "" then
  fso_index.write yyrpdata
  mm_line = ""
  fso_index.close
  set fso_index = nothing
  end if
end if
%>
<%
else
mm_page_list = "1"
mm_line = vbcrlf&"  <tr>"& vbcrlf &"    <td class=pad-left height=22>没有新闻</td>"& vbcrlf &"  </tr>"
mm_path = server.MapPath(mm_tspath&"/list_1.htm")
response.Write "<li>"&mm_tspath&"/list_1.htm 被创建</li>"
set fso_index=fso.createtextfile(mm_path,True)
  yyrpdata = replace(yyrp,"t_page_list",mm_page_list)
  yyrpdata = replace(yyrpdata,"t_line",mm_line)
  yyrpdata = replace(yyrpdata,"t_nav1",mm_nav1)
  yyrpdata = replace(yyrpdata,"t_nav2",mm_nav2)
  yyrpdata = replace(yyrpdata,"t_commend",mm_line_commend)
  yyrpdata = replace(yyrpdata,"t_hit",mm_line_hit)
  yyrpdata = replace(yyrpdata,"t_stype",mm_line_stype)
  fso_index.write yyrpdata
  mm_line = ""
  fso_index.close
  set fso_index = nothing
%>
<% End If ' end Not rsnews.EOF Or NOT rsnews.BOF %>
<%
set fso_line = nothing
set fso = nothing
%>
<%
rst_nav_all.Close()
Set rst_nav_all = Nothing
%>
<%
rsts_create_detail.Close()
Set rsts_create_detail = Nothing
%>
<%
rsts_nav_all.Close()
Set rsts_nav_all = Nothing
%>
<%
rsnews_commend.Close()
Set rsnews_commend = Nothing
%>
<%
rsnews_stype.Close()
Set rsnews_stype = Nothing
%>
<%
rsnews_hit.Close()
Set rsnews_hit = Nothing
%>
<%
rsnews.Close()
Set rsnews = Nothing
%>
<% end function %>