<% Option Explicit %>
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P109") then Call ReturnError1()
Dim Types,RsFileObj,RsFileSql
Types = Request("Types")
If Types = "Class" then
	RsFileSql = "Select * from SysJs where FileType=1 order by AddTime desc"
Elseif Types = "System" then
	RsFileSql = "Select * from SysJs where FileType<>1 order by FileType asc,AddTime desc"
End IF
Set RsFileObj = Server.CreateObject("Adodb.RecordSet")
	RsFileObj.Open RsFileSql,Conn,3,3

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>模板列表</title> 
</head>
<link href="../../CSS/css.css" rel="stylesheet">
<script language="JavaScript" src="../JS/PublicJS.js"></script>
<body topmargin="0" leftmargin="0" onClick="SelectJS();" onselectstart="//return false;" oncontextmenu="SelectJS();showMenu(MouseRightMenu);return false;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td valign="top">
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <td height="20" class="ButtonList"><div align="center">中文名称</div></td>
    <td class="ButtonList"><div align="center">英文名称</div></td>
    <td class="ButtonList"><div align="center">文件类型</div></td>
    <td class="ButtonList"><div align="center">所属栏目</div></td>
    <td class="ButtonList"><div align="center">更新时间</div></td>
  </tr>

<%
If RsFileObj.eof then
			page_size = 20
%>
  <tr> 
    <td height="23" colspan="5"> 
      <div align="center"><font color=red>暂时没有记录</font></div></td>
  </tr>
<%
else
Dim page_size,page_no,page_total,record_all,PageNums
page_size=Request.QueryString("page_size")
if page_size<=0 or page_size="" then page_size=20
If isnumeric(Request.Form("PageNums")) then
	if Request.Form("PageNums")<>0 then
		page_size = Cint(Request.Form("PageNums"))
	end if
End if
page_no=request.querystring("page_no")
if page_no<=1 or page_no="" then page_no=1
If Request.QueryString("page_no")="" then
	page_no=1
end if
RsFileObj.PageSize=page_size
page_total=RsFileObj.PageCount
if (cint(page_no)>page_total) then page_no=page_total
RsFileObj.AbsolutePage=page_no
record_all=RsFileObj.RecordCount
 Dim i
for i=1 to RsFileObj.PageSize
 if RsFileObj.eof then exit for	
	Dim FileTypeStr,ClassName,ClassNameObj
	If RsFileObj("FileType") = 1 then
		FileTypeStr = "栏目JS"
	elseif RsFileObj("FileType") = 2 then
		FileTypeStr = "系统JS"
	else
		FileTypeStr = "系统自带"
	end if
	Set ClassNameObj = Conn.Execute("Select ClassCName from NewsClass where ClassID='"&RsFileObj("ClassID")&"'")
		If Not ClassNameObj.eof then
			ClassName = ClassNameObj("ClassCName")
		Else
			ClassName = "--"
		End If
%>
  <tr style="background:white;cursor:default;" FileID="<%=RsFileObj("ID")%>" FileType="<%=RsFileObj("FileType")%>"> 
    <td height="23"> 
      <div align="center"><% = RsFileObj("FileCName") %></div></td>
    <td height="23"> 
      <div align="center"><% = RsFileObj("FileName") %></div></td>
    <td height="23"> 
      <div align="center"><% = FileTypeStr %>
      </div></td>
    <td height="23"> 
      <div align="center"><% = ClassName %></div></td>
    <td height="23"> 
      <div align="center"><% = RsFileObj("AddTime") %></div></td>
  </tr>
<%
RsFileObj.MoveNext
Next
end if 
RsFileObj.Close
Set RsFileObj = Nothing
%>
</table>
</tr>
<%if page_total>1 then%>
<tr> 
<td valign="middle" height="10">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr height="1">
                  <td width="42%" height="18"><table width="99%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                      </tr>
                   </table> </td>
                
                <td width="51%" height="25" valign="middle"> <div align="right">
                    <% =  "NO.<b>"& page_no &"</b>,&nbsp;&nbsp;" %>
                    <% = "Totel:<b>"& page_total &"</b>,&nbsp;RecordCounts:<b>" & record_all &"</b>&nbsp;&nbsp;&nbsp;"%>
                    <%
						if Page_Total=1 then
								response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
								response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
								response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img>&nbsp;"
								response.Write "&nbsp;<img src=../images/endPage.gif border=0 alt=尾页></img>&nbsp;"
						else
							if cint(Page_No)<>1 and cint(Page_No)<>Page_Total then
								response.Write "&nbsp;<a href=?page_no=1&page_size="& page_size &"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
								response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)-1)&"&page_size="&page_size&"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
								response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)+1)&"&page_size="&page_size&"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
								response.Write "&nbsp;<a href=?page_no="& Page_Total &"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/endPage.gif border=0 alt=尾页></img></a>&nbsp;"
							elseif cint(Page_No)=1 then
								response.Write "&nbsp;<img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
								response.Write "&nbsp;<img src=../images/prePage.gif border=0 alt=上一页></img>&nbsp;"
								response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)+1)&"&page_size="& page_size &"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
								response.Write "&nbsp;<a href=?page_no="& Page_Total &"&page_size="& page_size &"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/endpage.gif border=0 alt=尾页></img></a>&nbsp;"
							else
								response.Write "&nbsp;<a href=?page_no=1&page_size="& page_size &"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
								response.Write "&nbsp;<a href=?page_no="&cstr(cint(Page_No)-1)&"&page_size="& page_size &"&Types="+types+"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
								response.Write "&nbsp;<img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
								response.Write "&nbsp;<img src=../images/endpage.gif border=0 alt=尾页></img>&nbsp;"
							end if
						end if
						%>
                </div></td>
                <td width="7%" valign="middle"><select onChange="ChangePage(this.value);" style="width:50;" name="select">
                  <% for i=1 to Page_Total %>
                  <option <% if cint(Page_No) = i then Response.Write("selected")%> value="<% = i %>">
                  <% = i %>
                  </option>
                  <% next %>
                </select></td>
              </tr>
	</table></td>
	</tr>
	<% end if%>
	</table>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
		  <div class="MouseRightItem" id="Code" ExeFunction="OpenWindow('FrameCode.asp?FileName=UseCode.asp&JSName=FileName&JSTable=SysJS&JsID='+FileID,360,140,window);">调用代码</div>
  <hr id="nouse3">
  <div class="MouseRightItem" id="reFresh" ExeFunction="location.reload();">刷新</div> 
   <hr id="HR6">
  <div class="MouseRightItem" id="Pros" ExeFunction="javascript:window.prompt('本页面路径属性' , '<%=Request.ServerVariables("SCRIPT_NAME")%>');">路径属性</div>
</div>

</body>
</html>
<%
Set Conn = Nothing
%>
<script>
var Type = '<% = Types %>';
Code.className='MenuItemDisable';
function SelectJS()
{
	var i=0,j=0;
	var EventObj=event.srcElement;
	var TRObj;
	switch (EventObj.tagName.toLowerCase())
	{
		case 'div':
			TRObj=EventObj.parentElement.parentElement;
			break;
		case 'td':
			TRObj=EventObj.parentElement;
			break;
		case 'tr':
			TRObj=EventObj;
			break;
		default:
			return;
	}
	for (j=0;j<document.all.length;j++)
	{
		if (document.all(j).style.backgroundColor=='highlight')
		{
			document.all(j).style.backgroundColor='';
			for (i=0;i<document.all(j).children.length;i++) document.all(j).children(i).style.color='black';
		}
	}
	if (TRObj.FileID!=null) {FileID=TRObj.FileID;FileType=TRObj.FileType;}
	else FileID='';
	if (FileID!='')
	{
		TRObj.style.backgroundColor='highlight';
		Code.className='MouseRightItem';
		for (i=0;i<TRObj.children.length;i++) TRObj.children(i).style.color='white';
	}
	else
	{
		FileID='';
		Code.className='MenuItemDisable';
	}
}
function ChangePage(PageNum)
	{
		var page_size;
		page_size=<% = page_size %>;
		window.location.href='?page_no='+PageNum+'&Types='+Type+'&page_size='+page_size;
		
	}
</script>