<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>广告列表</title>
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script>
</head>
<script language="javascript">
<!--
function checkadplace()
{
	if(document.adplace.adplacename.value=="")
	{
		alert("请输入广告位种类名称!");
		document.adplace.adplacename.focus();
		return false;
	}
}
function checkadprice()
{
	if(document.adprice.adpricename.value=="广告位名称")
	{
		alert("请输入广告位名称");
		document.adprice.adpricename.focus();
		return false;
	}
	if(document.adprice.adrow.value=="行*列")
	{
		alert("请输入广告位行*列");
		document.adprice.adrow.focus();
		return false;
	}
	if(document.adprice.adwidth.value=="宽*高")
	{
		alert("请输入广告位的宽*高");
		document.adprice.adwidth.focus();
		return false;
	}	
	if(document.adprice.adid.value=="")
	{
		alert("请输入广告位编号");
		document.adprice.adid.focus();
		return false;
	}
	var objv = document.adprice.adid.value;
	var pattern = /^([0-9])+$/;
	flag = pattern.test(objv);
	if(!flag)
	{
		alert("广告位编号只能为数字!");
		document.adprice.adid.select();
		return false; 
	}
}
function view(ids)
{
	if(document.getElementById(ids).style.display=="block")
	{
		document.getElementById(ids).style.display="none";
		document.getElementById("view"+ids).innerHTML="查看";
	}
	else
	{
		document.getElementById(ids).style.display="block";
		document.getElementById("view"+ids).innerHTML="关闭";
	}
}
//-->
</script>
<%
If Not FRAdminLevel(106) Then
	Call ErrorMsg()
End If
%>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder">
  <tr>
    <th height="25">广告管理</th>
  </tr>
  <tr>
    <td height=25><span class="bodytitle"><font color="ff6600"><b class="style1">　管理选项</b></font>：</span><a href="webad.asp" target="_self">添加广告</a> | <a href="list.asp" target="_self">正常广告</a> | <a href="list.asp?type=top" target="_self">点击最高</a> | <a href="list.asp?type=end" target="_self">点击最低</a> | <a href="list.asp?type=close" target="_self">暂停列表</a> | <a href="list.asp?type=lose" target="_self">失效列表</a> | <a href="adplace.asp" target="_self">广告管理</a></td>
  </tr>
</table>
<table width="98%" border="0" cellspacing="1" cellpadding="2" align="center" class="tableBorder" style="margin-top:6px;">
  <tr align="center" bgcolor="#ffffff">
    <th height="25" colspan="2">广告种类管理</th>
    <th width="73%">广告位管理</th>
  </tr>
  <%
  adplaceid=request.QueryString("adplaceid")
  if adplaceid<>"" then
  	sqlm="select adplace_name from JOB_Adplace where adplace_id="&adplaceid&""
	set rsm=Server.CreateObject(FR_HR_RS)
	rsm.open sqlm,conn,1,1
	if not rsm.eof then
		adplacename=rsm("adplace_name")
	end if
	rsm.close
	set rsm=nothing
  end if
  %>
  <tr align="center" bgcolor="#ffffff">
    <td colspan="2" align="left"><form name="adplace" method="post" action="adplacesave.asp?action=adplacesave&adplaceid=<%=adplaceid%>" onsubmit="return checkadplace()" style="padding:0; margin:0;">&nbsp;<input type="text" name="adplacename" value="<%=adplacename%>" />&nbsp;<input name="Submit" type="submit" class="inputs" value="编辑" /></form></td>
	<%
	adpriceid=request.QueryString("adpriceid")
	if adpriceid<>"" then
		sqlp="select * from JOB_Adsplace where Adsplace_id="&adpriceid&" and projectid="&DefaultTPID&""
		set rsp=Server.CreateObject(FR_HR_RS)
		rsp.open sqlp,conn,1,1
		if not rsp.eof then
			adpricename=rsp("Adsplace_name")
			adwidth=rsp("Adsplace_width")
			adrow=rsp("Adsplace_row")
			admoney=rsp("Adsplace_price")
			adplaceid=rsp("Adsplace_placeid")
			adunit=rsp("Adsplace_unit")
			adid=rsp("Adsplace_priceid")			
		else
			adpricename="广告位名称"
			adwidth="宽*高"
			adrow="行*列"
			admoney="1000"
		end if
	else
		adpricename="广告位名称"
		adwidth="宽*高"
		adrow="行*列"
		admoney="1000"
	end if
	if adpriceid="" then
		adplaceid=request.QueryString("adplaceids")
	end if
	%>
    <td align="left"><form name="adprice" method="post" action="adplacesave.asp?action=adpricesave&adpriceid=<%=adpriceid%>" onsubmit="return checkadprice()" style="padding:0; margin:0;">&nbsp;在
      <select name="adplaceid">
	   <%
	  set rs=Server.CreateObject(FR_HR_RS)
	  sql="select adplace_id,adplace_name from JOB_Adplace where projectid="&DefaultTPID&" order by adplace_id asc"
	  rs.open sql,conn,1,1
	  if not rs.eof then
	  	for i=1 to rs.recordcount
	  %>
	  <option value="<%=rs("adplace_id")%>" <%if cstr(adplaceid)=cstr(rs("adplace_id")) then%>selected="selected"<%end if%>><%=rs("adplace_name")%></option>
	  <%
	  	rs.movenext
		next
	  end if
	  rs.close
	  set rs=nothing
	  %>
      </select>
      <input name="adpricename" type="text" size="11" value="<%=adpricename%>" onBlur="if(this.value=='') this.value='广告位名称';" onFocus="if(this.value=='广告位名称') this.value='';" /> <input name="adrow" type="text" size="5" value="<%=adrow%>" onBlur="if(this.value=='') this.value='行*列';" onFocus="if(this.value=='行*列') this.value='';" />  <input name="adwidth" type="text" size="8" value="<%=adwidth%>" onBlur="if(this.value=='') this.value='宽*高';" onFocus="if(this.value=='宽*高') this.value='';" />
    
    编号:<input name="adid" type="text" size="3" value="<%=adid%>" />
    价格:<input name="admoney" type="text" size="5" value="<%=admoney%>" />
    元/
    <select name="adunit">
		<option value="月" selected="selected">月</option>
		<option value="季" <%if adunit="季" then%>selected="selected"<%end if%>>季</option>
		<option value="年" <%if adunit="年" then%>selected="selected"<%end if%>>年</option>
    </select>
     <input name="Submit2" type="submit" class="inputs" value="提交" /></form></td>
  </tr>
  <tr align="center" bgcolor="#ffffff">
    <td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#dddddd" class="tabnoboder">
      <tr>
        <td width="17%" align="center" bgcolor="#EEF7FD"><strong>序号</strong></td>
        <td width="53%" align="center" bgcolor="#EEF7FD"><strong>广告位种类名称</strong></td>
        <td width="30%" align="center" bgcolor="#EEF7FD"><strong>操作</strong></td>
      </tr>
	  <%
	  set rs=Server.CreateObject(FR_HR_RS)
	  sql="select adplace_id,adplace_name from JOB_Adplace where projectid="&DefaultTPID&" order by adplace_id asc"
	  rs.open sql,conn,1,1
	  if not rs.eof then
	  	for i=1 to rs.recordcount
	  %>
      <tr>
        <td bgcolor="#EEF7FD"><%=rs("adplace_id")%></td>
        <td bgcolor="#EEF7FD" align="left">&nbsp;<a href="adplace.asp?adplaceids=<%=rs("adplace_id")%>" title="添加广告位"><%=rs("adplace_name")%></a></td>
        <td bgcolor="#EEF7FD"><a href="adplace.asp?adplaceid=<%=rs("adplace_id")%>">编辑</a> <a href="adplacesave.asp?action=adplcaedel&adplaceid=<%=rs("adplace_id")%>">删除</a></td>
      </tr>
	  <%
	  	rs.movenext
		next
	  end if
	  rs.close
	  set rs=nothing
	  %>
    </table></td>
    <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#dddddd" class="tabnoboder">
      <tr>
        <td width="6%" align="center" bgcolor="#FFFFFF"><strong>代码</strong></td>
        <td width="17%" align="center" bgcolor="#FFFFFF"><strong>广告种类</strong></td>
        <td width="18%" align="center" bgcolor="#FFFFFF"><strong>广告位置</strong></td>
        <td width="5%" align="center" bgcolor="#FFFFFF">&nbsp;</td>
        <td width="12%" align="center" bgcolor="#FFFFFF"><strong>行列</strong></td>
        <td width="12%" align="center" bgcolor="#FFFFFF"><strong>宽高</strong></td>
        <td width="8%" align="center" bgcolor="#FFFFFF"><strong>编号</strong></td>
        <td width="11%" align="center" bgcolor="#FFFFFF"><strong>价格</strong></td>
        <td width="11%" align="center" bgcolor="#FFFFFF"><strong>操作</strong></td>
      </tr>
	  <%
	  	if adplaceid<>"" then
			sql1="select * from JOB_Adsplace where projectid="&DefaultTPID&" and Adsplace_placeid="&adplaceid&" order by Adsplace_id asc"
		else
	  		sql1="select * from JOB_Adsplace where projectid="&DefaultTPID&" order by Adsplace_id asc"
		end if
	  	set rs1=Server.CreateObject(FR_HR_RS)
		rs1.open sql1,conn,1,1
		if not rs1.eof then
		for i=1 to rs1.recordcount
	  %>
      <tr>
        <td align="center" bgcolor="#FFFFFF"><span id="view<%=rs1("Adsplace_id")%>" onclick="javascript:view(<%=rs1("Adsplace_id")%>)" style="cursor:pointer;">查看</span></td>
        <td bgcolor="#FFFFFF"> &nbsp;<%=AdplaceNames(rs1("Adsplace_placeid"))%></td>
        <td bgcolor="#FFFFFF"> &nbsp;<a href="webad.asp?placeid=<%=rs1("Adsplace_placeid")%>&priceid=<%=rs1("Adsplace_id")%>&step=2" title="添加广告"><%=rs1("Adsplace_name")%></a></td>
        <td align="center" bgcolor="#FFFFFF"><a href="list.asp?adsid=<%=rs1("Adsplace_id")%>" title="查看广告"><%=Adcount(rs1("Adsplace_id"))%></a></td>
        <td align="center" bgcolor="#FFFFFF"><%=rs1("Adsplace_row")%></td>
        <td align="center" bgcolor="#FFFFFF"><%=rs1("Adsplace_width")%></td>
        <td align="center" bgcolor="#FFFFFF"><%=rs1("Adsplace_priceid")%></td>
        <td bgcolor="#FFFFFF"><%=rs1("Adsplace_price")%>/<%=rs1("Adsplace_unit")%></td>
        <td align="center" bgcolor="#FFFFFF"><a href="adplace.asp?adpriceid=<%=rs1("Adsplace_id")%>">编辑</a> <a href="adplacesave.asp?action=adpricedel&adpriceid=<%=rs1("Adsplace_id")%>">删除</a></td>
      </tr>
	  <tr id="<%=rs1("Adsplace_id")%>" style="display:none;"><td colspan="9" align="center"><input name="textfield" type="text" size="80" value="<script language='javascript' src='/Webad/ads.asp?priceid=<%=rs1("Adsplace_priceid")%>'></script>" /></td>
	  </tr>
	  <%
	  	rs1.movenext
		next
		end if
		rs1.close
		set rs1=nothing
	  %>
    </table></td>
  </tr>
</table>
<!--#include file="../inc/copy.asp"-->
</body>
</html>
<%
'统计广告位共有多少个广告文件
Function Adcount(adsid)
	if adsid<>"" and Isnumeric(adsid) then
		sqlcount="select count(Ad_id) as num from JOB_Ad where Ad_priceid="&adsid&" and projectid="&DefaultTPID&""
		set rscount=Server.CreateObject(FR_HR_RS)
		rscount.open sqlcount,conn,1,1
		if not rscount.eof then
			Adcount=rscount("num")
		else
			Adcount="×"
		end if
		rscount.close
		set rscount=nothing
	else
		Adcount="×"
	end if
	if Adcount=0 then
		Adcount="×"
	end if
End Function
%>
