<% Option Explicit %>
<!--#include file="../../Inc/Function.asp" -->
<!--#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"),"P0406") then Call ReturnError()
	Dim Sql,RsLogObj,RsClassJSObj,RikerNum
	if Replace(Request.Form("KeyWords"),"'","")<>"" then
		Sql = "Select * from SysJs where FileName like '%"&Replace(Request.Form("KeyWords"),"'","")&"%' order by FileType asc,AddTime desc"
	else
		Sql = "Select * from SysJs order by FileType asc,AddTime desc"
	end if
	Set RsClassJSObj = Server.CreateObject("ADODB.RecordSet")
	RsClassJSObj.Open Sql,Conn,3,3
	RikerNum = RsClassJSObj.RecordCount
%>
<html>
<head>
<title>生成全部JS</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<link href="../../CSS/css.css" rel="stylesheet">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0" oncontextmenu="SelectSingleLog();showMenu(MouseRightMenu);return false;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="6%" height="25" class="ButtonList"><div align="center">选择</div></td>
    <td width="19%" height="25" class="ButtonList"><div align="center">中文名称</div></td>
    <td width="18%" height="25" class="ButtonList"><div align="center">英文名称</div></td>
    <td width="14%" height="25" class="ButtonList"><div align="center">文件类型</div></td>
    <td width="12%" height="25" class="ButtonList"><div align="center">新闻类型</div></td>
    <td width="14%" height="25" class="ButtonList"><div align="center">所属栏目</div></td>
    <td width="17%" height="25" class="ButtonList"><div align="center">更新时间</div></td>
  </tr>
  <%
  if  RsClassJSObj.Bof And RsClassJSObj.Eof then
		page_size = 20
  %>
  <tr valign="middle"> 
    <td height="25" colspan="7" align="center"><font color="red">暂时没有记录</font></td>
  </tr>
  <% else %>
  <%
if not  RsClassJSObj.Bof And not RsClassJSObj.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
	RsClassJSObj.PageSize=page_size
	page_total=RsClassJSObj.PageCount
	if (cint(page_no)>page_total) then page_no=page_total
	RsClassJSObj.AbsolutePage=page_no
	record_all=RsClassJSObj.RecordCount
	Dim i
  	for i=1 to RsClassJSObj.PageSize
    	if RsClassJSObj.eof then exit for
			If RsClassJSObj("FileType")=1 then
				TempTypeStr = "栏目自定义"
			ElseIf RsClassJSObj("FileType")=2 then
				TempTypeStr = "系统自定义"
			Else
				TempTypeStr = "系统自带"
			End If
			Select Case RsClassJSObj("NewsType")
				Case "RecNews" TempNewsType = "推荐新闻"
				Case "NewNews" TempNewsType = "最新新闻"
				Case "MarqueeNews" TempNewsType = "滚动新闻"
				Case "SBSNews" TempNewsType = "并排新闻"
				Case "PicNews" TempNewsType = "图片新闻"
				Case "HotNews" TempNewsType = "热点新闻"
				Case "WordNews" TempNewsType = "文字新闻"
				Case "TitleNews" TempNewsType = "标题新闻"
				Case "ProclaimNews" TempNewsType = "公告新闻"
				Case "FilterNews" TempNewsType = "幻灯片新闻"
			End Select
			Set TempRsObj = Conn.Execute("Select ClassCName from NewsClass where ClassID='"&RsClassJSObj("ClassID")&"'")
				If Not TempRsObj.eof then
					TempClassName = TempRsObj("ClassCName")
				Else
					TempClassName = "--"
				End If
%>
  <tr class="TempletItem">
    <td height="22"><div align="center"><input name="SelectFlag" type="checkbox" id="SelectFlag" onClick="ClickFlag();" value="<%=RsClassJSObj("ID")%>">
    </div></td>
    <td height="22"><div align="left">&nbsp;&nbsp;&nbsp;<%=RsClassJSObj("FileCName")%></div></td>
    <td height="22"><div align="left">&nbsp;&nbsp;&nbsp;<%=RsClassJSObj("FileName")%></div></td>
    <td height="22"><div align="left">&nbsp;&nbsp;&nbsp;<%=TempTypeStr%></div></td>
    <td height="22"><div align="left">&nbsp;&nbsp;&nbsp;<%=TempNewsType%></div></td>
    <td height="22"><div align="left">&nbsp;&nbsp;&nbsp;<%=TempClassName%></div></td>
    <td height="22"><div align="left"><%=RsClassJSObj("AddTime")%></div></td>
  </tr>
<%
		RsClassJSObj.MoveNext
	Next
end if
%>
<%if page_total>1 then%>
  <tr class="TempletItem"> 
    <td colspan="7">&nbsp;</td>
  </tr>
  <tr><td colspan="7" 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=?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=?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=?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=?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 &"&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;"
	else
		response.Write "&nbsp;<a href=?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=?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>
<%end if%>
<!-- 鼠标右键菜单 -->
<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
  <div class="MouseRightItem" id="SelectAll" ExeFunction="SelectA();">全选</div>
  <div class="MouseRightItem" id="UnDoAll" ExeFunction="SelectB();">取消选择</div>
  <hr id="HR4">
  <div class="MouseRightItem" id="Del" ExeFunction="DelSelected();">生成</div>
  <div class="MouseRightItem" id="DelPage" ExeFunction="DelThisPage();">生成本页</div>
  <div class="MouseRightItem" id="DelTable" ExeFunction="DelAll();">生成全部</div>
  <hr id="HR6">
  <div class="MouseRightItem" id="UpPage" ExeFunction="PriPage();">上一页</div>
  <div class="MouseRightItem" id="DownPage" ExeFunction="NextPage();">下一页</div>
  <hr id="HR3">
  <div class="MouseRightItem" id="Refresh" ExeFunction="window.location.reload();">刷新</div>
</div>
</body>
</html>
<script language="JavaScript">
var AllSelect=false;
var NoneSelect=true;
var RikerNumScr = '<% = RikerNum %>';
var CurrPageIndex='<% = page_no %>';
var TotalPageNum='<% = page_total %>';
Del.className='MenuItemDisable';
FlipPage();
function FlipPage()
{
	if (CurrPageIndex=='1')
	{
		UpPage.className='MenuItemDisable';
	}
	if (CurrPageIndex==TotalPageNum)
	{
		DownPage.className='MenuItemDisable';
	}
	SetMenu();
}
function SetMenu()
{
	if (AllSelect==true)
	{
		UnDoAll.className='MouseRightItem';
		SelectAll.className='MenuItemDisable';
	}
	else
	{
		if (NoneSelect==true)
		{
			SelectAll.className='MouseRightItem';
			UnDoAll.className='MenuItemDisable';
		}
		else
		{
			SelectAll.className='MouseRightItem';
			UnDoAll.className='MouseRightItem';
		}
	}
}
function SelectA()
{
	for (var i=0;i<=document.all.SelectFlag.length-1;i++)
	{
		document.all.SelectFlag(i).checked=true;
	}
	if (RikerNumScr==1) document.all.SelectFlag.checked=true;
	else document.all.SelectFlag(0).onclick();
	AllSelect=true;
	NoneSelect=false;
	SetMenu();
}
function SelectB()
{
	for (var i=0;i<=document.all.SelectFlag.length-1;i++)
	{
		document.all.SelectFlag(i).checked=false;
	}
	if (RikerNumScr==1) document.all.SelectFlag.checked=false;
	else document.all.SelectFlag(0).onclick();
	AllSelect=false;
	NoneSelect=true;
	SetMenu();
}
function DelSelected()
{
	var FileID='';
	FileID=GetFlagValue();
	//OpenWindow('SaveJsFile.asp?FileID='+FileID,300,300,window);
	window.open('SaveJsFile.asp?FileID='+FileID,null,'height=110,width=300,top=300,left=380')
	window.location.reload();
	//ChangePage(CurrPageIndex);
}
function ClickFlag()
{
	var TempStr=GetFlagValue();
	if (TempStr=='') Del.className='MenuItemDisable';
	else Del.className='MouseRightItem';
	AllSelect=false;
	NoneSelect=false;
	SetMenu();
}
function GetFlagValue()
{
	var TempStr='';
		for (var i=0;i<=document.all.SelectFlag.length-1;i++)
		{
			if (document.all.SelectFlag(i).checked==true)
			{
				if (TempStr=='') TempStr=document.all.SelectFlag(i).value;
				else  TempStr=TempStr+'*'+document.all.SelectFlag(i).value;
			}
		}
	return TempStr
}
function SelectSingleLog()
{
	var el=event.srcElement;
	if (RikerNumScr<=0)
	{
	 SelectAll.className = 'MenuItemDisable';
	 DelPage.className = 'MenuItemDisable';
	 DelTable.className = 'MenuItemDisable';
	 UpPage.className = 'MenuItemDisable';
	 }
	if (el.name=='SelectFlag')
	{
		el.checked=true;
		el.onclick();
		AllSelect=false;
		NoneSelect=false;
		SetMenu();	
	}
}
function ChangePage(PageNum)
{
	var page_size;
	page_size = <% = page_size %>;
	window.location.href='?page_no='+PageNum+'&page_size='+page_size;
}
function PriPage()
{
	var PageNum='<% = cint(page_no) - 1 %>';
	ChangePage(PageNum);
}
function NextPage()
{
	var PageNum='<% = cint(page_no) + 1 %>';
	ChangePage(PageNum);
}
function DelThisPage()
{
	var FileID='';
	FileID=GetPageValue();
	//OpenWindow('SaveJsFile.asp?FileID='+FileID,300,300,window);
	window.open('SaveJsFile.asp?FileID='+FileID,null,'height=110,width=300,top=300,left=380')
	window.location.reload();
	//ChangePage(CurrPageIndex);
}
function DelAll()
{
	var FileID='';
	FileID=GetAllValue();
	//OpenWindow('SaveJsFile.asp',300,300,window);
	window.open('SaveJsFile.asp',null,'height=110,width=300,top=300,left=380')
	window.location.reload();
	//ChangePage(CurrPageIndex);
}
function GetPageValue()
{
	var TempStr='';
		for (var i=0;i<=document.all.SelectFlag.length-1;i++)
		{
			if (TempStr=='') TempStr=document.all.SelectFlag(i).value;
			else  TempStr=TempStr+'*'+document.all.SelectFlag(i).value;
		}
	return TempStr
}
function GetAllValue()
{
	var TempStr='';
		for (var i=0;i<=document.all.SelectFlag.length-1;i++)
		{
			if (TempStr=='') TempStr=document.all.SelectFlag(i).value;
			else  TempStr=TempStr+'*'+document.all.SelectFlag(i).value;
		}
	return TempStr
}
</script>
<%
	Set Conn = Nothing
RsClassJSObj.Close
Set RsClassJSObj = Nothing
%>