<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.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"),"P0501") then Call ReturnError1()
Dim Types,RsFileObj,RsFileSql
Types = Request("Types")
if Replace(Request.Form("KeyWords"),"'","")<>"" then
	If Types = "Class" then
		RsFileSql = "Select * from SysJs where FileCName like '%"&Replace(Request.Form("KeyWords"),"'","")&"%' and FileType=1 order by AddTime desc"
	Elseif Types = "System" then
		RsFileSql = "Select * from SysJs where FileCName like '%"&Replace(Request.Form("KeyWords"),"'","")&"%' and FileType<>1 order by FileType asc,AddTime desc"
	End IF
else
	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
end if
Set RsFileObj = Server.CreateObject("Adodb.RecordSet")
	RsFileObj.Open RsFileSql,Conn,1,1
%>
<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();" oncontextmenu="SelectJS();showMenu(MouseRightMenu);return false;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="23%" height="20" class="ButtonList"><div align="center">中文名称</div></td>
    <td width="19%" class="ButtonList"><div align="center">英文名称</div></td>
    <td width="18%" class="ButtonList"><div align="center">文件类型</div></td>
    <td width="20%" class="ButtonList"><div align="center">所属栏目</div></td>
    <td width="20%" class="ButtonList"><div align="center">更新时间</div></td>
  </tr>
<%
If RsFileObj.eof then
%>
  <tr> 
    <td height="23" colspan="5"> 
      <div align="center"><font color=red>暂时没有记录</font></div></td>
  </tr>
<%
else

if not  RsFileObj.Bof And not RsFileObj.Eof  then 
	Dim page_size,page_no,page_total,record_all,TempTypeStr,TempNewsType,TempRsObj,TempClassName,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
end if
%>
  <tr class="TempletItem"> 
    <td colspan="5">&nbsp;</td>
  </tr>
  <%if page_total>1 then%>
  <tr><td colspan="5" valign="bottom">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                
                  <td width="62%" height="25"><table width="99%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                      </tr>
                   </table> </td>
                <td 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=?Types="&Types&"&page_no=1&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img></a>&nbsp;"
		response.Write "&nbsp;<a href=?Types="&Types&"&page_no="&cstr(cint(Page_No)-1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/prePage.gif border=0 alt=上一页></img></a>&nbsp;"
		response.Write "&nbsp;<a href=?Types="&Types&"&page_no="&cstr(cint(Page_No)+1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
		response.Write "&nbsp;<a href=?Types="&Types&"&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=?Types="&Types&"&page_no="&cstr(cint(Page_No)+1)&"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/nextPage.gif border=0 alt=下一页></img></a>&nbsp;"
		response.Write "&nbsp;<a href=?Types="&Types&"&page_no="& Page_Total &"&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/endpage.gif border=0 alt=尾页></img></a>&nbsp;"
	else
		response.Write "&nbsp;<a href=?Types="&Types&"&page_no=1&page_size="& page_size &"&Keywords="&Request("Keywords")&"><img src=../images/First1.gif border=0 alt=首页></img>&nbsp;"
		response.Write "&nbsp;<a href=?Types="&Types&"&page_no="&cstr(cint(Page_No)-1)&"&page_size="& page_size &"&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
%>
			<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>
		</div></td>
	  </tr>
	</table></td>
</tr>
</table>
  </td></tr>
  <% end if %>
</table>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="Add" ExeFunction="OpenWindow('Tip.asp?FileName=SysJsAdd.asp&Types='+Type+'&Titles=新建JS',500,360,window);">新建</div> 
  <div class="MouseRightItem" id="Edit" ExeFunction="OpenWindow('Tip.asp?FileName=SysJsModify.asp&Types='+Type+'&Titles=修改JS&FileID='+FileID,500,360,window);">修改</div>
  <div class="MouseRightItem" id="Del" ExeFunction="OpenWindow('Tip.asp?FileName=SysJsDell.asp&Titles=删除JS&FileID='+FileID,220,105,window);">删除</div>
  <hr id="nouse1">
  <div class="MouseRightItem" id="Code" ExeFunction="OpenWindow('Tip.asp?FileName=Code.asp&Titles=系统JS代码调用&FileID='+FileID,260,105,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 %>';
Edit.className='MenuItemDisable';
Del.className='MenuItemDisable';
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';
		if (FileType==0) Del.className='MenuItemDisable';
		else Del.className='MouseRightItem';
		Edit.className='MouseRightItem';
		Code.className='MouseRightItem';
		for (i=0;i<TRObj.children.length;i++) TRObj.children(i).style.color='white';
	}
	else
	{
		FileID='';
		Edit.className='MenuItemDisable';
		Del.className='MenuItemDisable';
		Code.className='MenuItemDisable';
	}
}
function ChangePage(PageNum)
{
	var page_size;
	page_size = <% = page_size %>
	window.location.href='?Types='+Type+'&page_no='+PageNum+'&page_size='+page_size;
}
</script>
<%
RsFileObj.Close
Set RsFileObj = Nothing
Set Conn = Nothing
%>