<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2004.12
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071,66252421
'技术支持:所有程序使用问题，请提问到bbs.foosun.net我们将及时回答您
'程序开发：风讯开发组 & 风讯插件开发组
'论坛支持：风讯在线论坛(http://bbs.foosun.net)
'官方网站：www.Foosun.net  演示站点：test.cooin.com    
'网站建设专区：www.cooin.com
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'==============================================================================
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"),"P0502") then Call ReturnError1()
		Dim TempType,RsJSObj,JsSql,JSType,FileNum,TempNumStr,TempObj,MannerStr,JsEName,JSFlag
			 JsSql = "select * from FreeJS order by Type asc,ID asc"
			 JSFlag = "自由JS列表"
		Set RsJSObj = Server.CreateObject("ADODB.Recordset")
		RsJSObj.open JsSql,conn,1,1
		%>
		<html>
		<head>
		<link href="../../CSS/css.css" rel="stylesheet" type="text/css">
		<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
		<title>自由JS列表</title>
		</head>
		<script src="../JS/PublicJS.js" language="JavaScript"></script>
		<body topmargin="0" leftmargin="0" oncontextmenu="SelectJS(true);showMenu(MouseRightMenu);return false;"  ondragstart="return false;" onselectstart="return false;">
		
<table id="MainTable" width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="93" valign="top"> 
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" onclick="SelectJS(false);">
        <tr> 
          <td width="30%" class="ButtonList"><div align="center">名称</div></td>
          <td width="16%" class="ButtonList"><div align="center">类型</div></td>
          <td width="16%" 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>
        </tr>
        <%if RsJSObj.eof then
			page_size=20
		 %>
        <tr> 
          <td colspan="5" > <div align="center"><font color="#FF0000">暂时没有记录</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
		RsJSObj.PageSize=page_size
		page_total=RsJSObj.PageCount
		if (cint(page_no) > page_total) then page_no=page_total
		RsJSObj.AbsolutePage=page_no
		record_all=RsJSObj.RecordCount
		dim i
		for i=1 to RsJSObj.PageSize
		if RsJSObj.eof then exit for
			select  case RsJSObj("Type")
				case "0"  JSType = "文字"
				case "1"  JSType = "图片"
			 end select
			Set TempObj = Conn.Execute("select count(ID) from FreeJsFile where JSName='"&RsJSObj("EName")&"'")
			if TempObj.eof then
				FileNum = "0"
			else
				FileNum = TempObj(0)
			end if
			TempNumStr = FileNum&"/"&RsJSObj("NewsNum")
			Select case RsJSObj("Manner")
			   case "1" MannerStr = "样式A"
			   case "2" MannerStr = "样式B"
			   case "3" MannerStr = "样式C"
			   case "4" MannerStr = "样式D"
			   case "5" MannerStr = "样式E"
			   case "6" MannerStr = "样式A"
			   case "7" MannerStr = "样式B"
			   case "8" MannerStr = "样式C"
			   case "9" MannerStr = "样式D"
			   case "10" MannerStr = "样式E"
			   case "11" MannerStr = "样式F"
			   case "12" MannerStr = "样式G"
			   case "13" MannerStr = "样式H"
			   case "14" MannerStr = "样式I"
			   case "15" MannerStr = "样式J"
			   case "16" MannerStr = "样式K"
			   case "17" MannerStr = "样式L"
			End Select
		%>
        <tr height="20"> 
          <td>
			 <table border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td><img src="../Images/Js/Freejs1.gif" width="18" height="18"></td>
                <td><span JsID="<%=RsJSObj("ID")%>" class="TempletItem" align="center"> 
                  <% = GotTopic(RsJSObj("CName"),40) %>
                  </span></td>
              </tr>
            </table>
		  </td>
          <td><div align="center" class="TempletItem"><%=JSType%></div></td>
          <td><div align="center" class="TempletItem"><%=MannerStr%></div></td>
          <td><div align="center" class="TempletItem"><%=TempNumStr%></div></td>
          <td><div align="center" class="TempletItem"><%=RsJSObj("AddTime")%></div></td>
        </tr>
        <%
				RsJSObj.MoveNext
			next
		end if
			RsJSObj.close
			set RsJSObj=nothing
		%>
      </table></td>
  </tr>
  <%if page_total>1 then%>
<tr>
<td height="18">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
 <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 &"&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
				%>
		</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>
</table>
		<!-- 鼠标右键菜单 -->
		<div id=MouseRightMenu onclick="ClickMenu(this);" onmouseover="MouseOverRightMenu();" onmouseout="MouseOverRightMenu();" class="menu"> 
		  <div class="MouseRightItem" id="Add" ExeFunction="OpenWindow('JsTip.asp?FileName=JsAdd.asp&Title=新建自由JS',520,446,window);">新建</div>
		  <div class="MouseRightItem" id="Edit" ExeFunction="OpenWindow('JsTip.asp?FileName=JsModify.asp&Title=自由JS修改&JsID='+JsID,520,446,window);">修改</div>
		  <div class="MouseRightItem" id="Del" ExeFunction="OpenWindow('JsTip.asp?FileName=JsDell.asp&Title=删除自由JS&JsID='+JsID,220,95,window);">删除</div>
		  <hr id="HR1"> 
		  <div class="MouseRightItem" id="Code" ExeFunction="OpenWindow('JsTip.asp?FileName=Code.asp&Title=查看调用代码&JsID='+JsID,260,110,window);">调用代码</div>
		  <hr id="HR5">
		  <div class="MouseRightItem" id="Refresh" ExeFunction="window.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 JsID = '';
Edit.className='MenuItemDisable';
Del.className='MenuItemDisable';
Code.className='MenuItemDisable';
var ListObjArray=new Array();
IntialListObjArray();
function IntialListObjArray()
{
	var CurrObj=null,j=1;
	for (var i=0;i<document.all.length;i++)
	{
		CurrObj=document.all(i);
		if (CurrObj.JsID!=null)
		{
			ListObjArray[ListObjArray.length]=new ListObj(CurrObj,0,j,false);
			j++;
		}
	}
}
function ListObj(Obj,Type,Index,Selected)
{
	this.Obj=Obj;
	this.Index=Index;
	this.Type=Type;
	this.Selected=Selected;
}
function SelectJS(MouseRight)
{
	var el=event.srcElement;
	var i=0;
	if (!MouseRight)
	{
		if ((event.ctrlKey==true)||(event.shiftKey==true))
		{
			if (event.ctrlKey==true)
			{
				for (i=0;i<ListObjArray.length;i++)
				{
					if (el==ListObjArray[i].Obj)
					{
						if (ListObjArray[i].Selected==false)
						{
							ListObjArray[i].Obj.className='TempletSelectItem';
							ListObjArray[i].Selected=true;
						}
						else
						{
							ListObjArray[i].Obj.className='TempletItem';
							ListObjArray[i].Selected=false;
						}
					}
				}
			}
			if (event.shiftKey==true)
			{
				var MaxIndex=0,ObjInArray=false,EndIndex=0,ElIndex=-1;
				for (i=0;i<ListObjArray.length;i++)
				{
					if (ListObjArray[i].Selected==true)
					{
						if (ListObjArray[i].Index>=MaxIndex) MaxIndex=ListObjArray[i].Index;
					}
					if (el==ListObjArray[i].Obj)
					{
						ObjInArray=true;
						ElIndex=i;
						EndIndex=ListObjArray[i].Index;
					}
				}
				if (MaxIndex!=0)
				{
					for (i=MaxIndex-1;i<EndIndex;i++)
					{
						ListObjArray[i].Obj.className='TempletSelectItem';
						ListObjArray[i].Selected=true;
					}
				}
				else
				{
					if (ElIndex!=-1)
					{
						ListObjArray[ElIndex].Obj.className='TempletSelectItem';
						ListObjArray[ElIndex].Selected=true;
					}
				}
			}
		}
		else
		{
			for (i=0;i<ListObjArray.length;i++)
			{
				if (el==ListObjArray[i].Obj)
				{
					ListObjArray[i].Obj.className='TempletSelectItem';
					ListObjArray[i].Selected=true;
				}
				else
				{
					ListObjArray[i].Obj.className='TempletItem';
					ListObjArray[i].Selected=false;
				}
			}
		}
	}
	else
	{
		var elInSelectArray=false;
		for (i=0;i<ListObjArray.length;i++)
		{
			if (el==ListObjArray[i].Obj)
			{
				if (ListObjArray[i].Selected==true)
				{
					elInSelectArray=true;
				}
			}
		}
		if (!elInSelectArray)
		{
			for (i=0;i<ListObjArray.length;i++)
			{
				if (el==ListObjArray[i].Obj)
				{
					ListObjArray[i].Obj.className='TempletSelectItem';
					ListObjArray[i].Selected=true;
				}
				else
				{
					ListObjArray[i].Obj.className='TempletItem';
					ListObjArray[i].Selected=false;
				}
			}
		}
		GetID();
		var NewsFlag;
		NewsFlag=(JsID!='')?1:0;   //选择了新闻----1  没有选择新闻----0
		if (NewsFlag==1) NewsFlag=(JsID.indexOf(',')==-1)?2:NewsFlag;  //只选择了一个新闻----2
		switch (NewsFlag)
		{
			case 0:
				Edit.className='MenuItemDisable';
				Del.className='MenuItemDisable';
				Code.className='MenuItemDisable';
				break;
			case 1:
				Edit.className='MenuItemDisable';
				Del.className='MouseRightItem';
				Code.className='MenuItemDisable';
				break;
			case 2:
				Edit.className='MouseRightItem';
				Del.className='MouseRightItem';
				Code.className='MouseRightItem';
				break;
			default:
			
		}
	}
}
function GetID()
{
	JsID='';
	for (i=0;i<ListObjArray.length;i++)
	{
		if (ListObjArray[i].Selected==true)
		{
			if (JsID=='') JsID=ListObjArray[i].Obj.JsID;
			else JsID=JsID+','+ListObjArray[i].Obj.JsID;
		}
	}
}
	function ChangePage(PageNum)
	{
		var page_size=<% = page_size %>;
		window.location.href='?page_no='+PageNum+'&page_size='+ page_size;
	}
		</script>
