<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Function.asp" -->
<%
'==============================================================================
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System 2.0 
'最新更新：2005.01
'==============================================================================
'商业注册联系：028-85098980-601,602 技术支持：028-85098980-607,客户支持：608
'项目开发：028-66026180-606，QQ：655071
'产品咨询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"),"P109") then Call ReturnError1()
Conn.Execute("Update Ads set State=0 where State<>0 and (ClickNum>=MaxClick or ShowNum>=MaxShow or ( EndTime<>null and EndTime<=#"&date()&"#))")

Dim TempState,RsAdsObj,AdsSql,AdsFlag,TempAddTime,TempType,TempAdsState,Location,AdsIDTemp
	 AdsSql = "select * from Ads where State=1"
	 AdsFlag = "正常广告"
TempState = Request("State")
if TempState <> "" then
     if  Cstr(TempState)="InGear" then
	 AdsSql = "select * from Ads where State=1 order by Location asc"
	 AdsFlag = "正常广告"
	 elseif Cstr(TempState)="ClickMax" then
	 AdsSql = "select * from Ads order by ClickNum desc,Location asc"
	 AdsFlag = "点击最高"
	 elseif Cstr(TempState)="ClickMin" then
	 AdsSql = "select * from Ads order by ShowNum desc,Location asc"
	 AdsFlag = "显示最高"
	 elseif Cstr(TempState)="Abate" then
	 AdsSql = "select * from Ads where State=0 order by Location asc"
	 AdsFlag = "失效广告"
	 elseif Cstr(TempState)="ShowAds" then
	 AdsSql = "select * from Ads where Type=1 order by Location asc"
	 AdsFlag = "显示广告"
	 elseif Cstr(TempState)="Stop" then
	 AdsSql = "select * from Ads where State=2 order by Location asc"
	 AdsFlag = "暂停广告"
	 elseif Cstr(TempState)="NewWindow" then
	 AdsSql = "select * from Ads where Type=2 order by Location asc"
	 AdsFlag = "弹出新窗口"
	 elseif Cstr(TempState)="OpenWindow" then
	 AdsSql = "select * from Ads where Type=3 order by Location asc"
	 AdsFlag = "打开新窗口"
	 elseif Cstr(TempState)="FilterAway" then
	 AdsSql = "select * from Ads where Type=4 order by Location asc"
	 AdsFlag = "渐隐消失"
	 elseif Cstr(TempState)="DialogBox" then
	 AdsSql = "select * from Ads where Type=5 order by Location asc"
	 AdsFlag = "网页对话框"
	 elseif Cstr(TempState)="ClarityBox" then
	 AdsSql = "select * from Ads where Type=6 order by Location asc"
	 AdsFlag = "透明对话框"
	 elseif Cstr(TempState)="DriftBox" then
	 AdsSql = "select * from Ads where Type=8 order by Location asc"
	 AdsFlag = "满屏浮动"
	 elseif Cstr(TempState)="LeftBottom" then
	 AdsSql = "select * from Ads where Type=9 order by Location asc"
	 AdsFlag = "左下底端"
	 elseif Cstr(TempState)="RightBottom" then
	 AdsSql = "select * from Ads where Type=7 order by Location asc"
	 AdsFlag = "右下底端"
	 elseif Cstr(TempState)="Couplet" then
	 AdsSql = "select * from Ads where Type=10 order by Location asc"
	 AdsFlag = "对联广告"
	 elseif Cstr(TempState)="Cycle" then
	 AdsSql = "select * from Ads where Type=11 or CycleTF=1 order by Location asc"
	 AdsFlag = "循环广告"
	 end if
end if
Set RsAdsObj = Server.CreateObject("ADODB.RecordSet")
RsAdsObj.Open AdsSql,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" type="text/css">
<script src="../JS/PublicJS.js" language="JavaScript"></script>
<body topmargin="0" leftmargin="0" oncontextmenu="SelectAds();showMenu(MouseRightMenu);return false;">
<table width="100%" onclick="SelectAds();" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<td valign="top">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
          <td width="10%" class="ButtonList"><div align="center">广告位</div></td>
          <td width="23%" class="ButtonList"><div align="center">广告类型</div></td>
          <td width="22%" 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="13%" class="ButtonList"><div align="center">状态</div></td>
        </tr>
		<%
		if RsAdsObj.eof then
			page_size = 20
		%>
		<tr>
			<td colspan="6" align="center"><font color="#FF0000">暂时没有记录</font></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
		RsAdsObj.PageSize=page_size
		page_total=RsAdsObj.PageCount
		if (cint(page_no)>page_total) then page_no=page_total
		RsAdsObj.AbsolutePage=page_no
		record_all=RsAdsObj.RecordCount
		Dim i
		for i=1 to RsAdsObj.PageSize
			if RsAdsObj.eof then exit for
			select  case RsAdsObj("Type")
				case "1"  TempType = "显示广告"
				case "2"  TempType = "弹出新窗口"
				case "3"  TempType = "打开新窗口"
				case "4"  TempType = "渐隐消失"
				case "5"  TempType = "网页对话框"
				case "6"  TempType = "透明对话框"
				case "7"  TempType = "右下底端"
				case "8"  TempType = "满屏浮动"
				case "9"  TempType = "左下底端"
				case "10"  TempType = "对联广告"
				case "11"  TempType = "循环广告"
			 end select
			 TempAddTime = year(RsAdsObj("AddTime"))&"-"&month(RsAdsObj("AddTime"))&"-"&day(RsAdsObj("AddTime"))
			  select case RsAdsObj("State")
				   case "0" TempAdsState="失效"
				   case "1" TempAdsState="正常"
				   case "2" TempAdsState="暂停"
			  end select
		 AdsIDTemp = RsAdsObj("ID")
%>
        <tr height="20" State="<%=RsAdsObj("State")%>" Location="<%=RsAdsObj("Location")%>" style="background:white;cursor:default;"> 
          <td><div align="center"><%=RsAdsObj("Location")%></div></td>

          <td height="25"> 
            <div align="center"><%=TempType%></div></td>
          <td><div align="center"><%=TempAddTime%></div></td>
          <td><div align="center"><%=RsAdsObj("ClickNum")%></div></td>
          <td><div align="center"><%=RsAdsObj("ShowNum")%></div></td>
          <td><div align="center"><%=TempAdsState%></div></td>
        </tr>
        <%
		RsAdsObj.MoveNext
	next
	end if
	RsAdsObj.close
	set RsAdsObj=nothing
%>
      </table>
	  </td>
	  </tr>
	  <%if page_total>1 then%>
	  <tr> 
    	<td valign="middle" height="10">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr height="1">
                  <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>
<!-- 鼠标右键菜单 -->
<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=Location&JSTable=Ads&JsID='+Location,360,140,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 TempStates = '<% = TempState %>';
var DisableOrActiveMenuArrayNo=new Array();
DisableOrActiveMenuArrayNo[0]=Code;

DisableMenu(DisableOrActiveMenuArrayNo);

function SelectAds()
{
	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.Location!=null) Location=TRObj.Location;
	else Location='';
	if (Location!='')
	{
		TRObj.style.backgroundColor='highlight';
		Code.className='MouseRightItem';
		for (i=0;i<TRObj.children.length;i++) TRObj.children(i).style.color='white';
	}
	else
	{
		Location='';
		Code.className='MenuItemDisable';
	}
}
function ChangePage(PageNum)
{
	var page_size;
	page_size=<% = page_size %>;
	window.location.href='?page_no='+PageNum+'&page_size='+page_size;
}
</script>