<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<% Option Explicit %>
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<META NAME="Keywords" CONTENT="" />
<META NAME="Description" CONTENT="" />
<TITLE>编辑广告</TITLE>
<link rel="stylesheet" href="Images/CssAdmin.css">
<script language="javascript" src="../Script/Admin.js"></script>
</HEAD>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="CheckAdmin.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<BODY>
<% 
dim Result
Result=request.QueryString("Result")
dim ID,ADsNameCh,ADsNameJp,ADsNameEn,ViewFlagCh,ViewFlagJp,ViewFlagEn,ContentCh,ContentJp,ContentEn
dim ADsWidth,ADsHeight,UploadFiles
ID=request.QueryString("ID")
call ADsEdit() 
%>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  <tr>
    <td height="24" nowrap><font color="#FFFFFF"><img src="Images/Explain.gif" width="18" height="18" border="0" align="absmiddle">&nbsp;<strong>弹窗广告：添加，修改弹窗广告相关的内容</strong></font></td>
  </tr>
  <tr>
    <td height="24" align="center" nowrap  bgcolor="#eafefe"><a href="ADsEdit.asp?Result=Add" onClick='changeAdminFlag("添加弹窗广告")'>添加弹窗广告</a><font color="#0000FF">&nbsp;|&nbsp;</font><a href="ADsList.asp" onClick='changeAdminFlag("弹窗广告列表")'>查看弹窗广告</a></td>
  </tr>
</table>
<br>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#6ab6b6">
  <form name="editForm" method="post" action="ADsEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  <tr>
    <td height="24" nowrap bgcolor="#eafefe"><table width="100%" border="0" cellpadding="0" cellspacing="0" id=editProduct idth="100%">

      <tr>
        <td width="120" height="20" align="right">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td height="20" align="right">中文名称：</td>
        <td><input name="ADsNameCh" type="text" class="textfield" id="ADsNameCh" style="WIDTH: 240;" value="<%=ADsNameCh%>" maxlength="100">&nbsp;显示：<input name="ViewFlagCh" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" checked <%if ViewFlagCh then response.write ("checked")%>>
&nbsp;*&nbsp;</td>
      </tr>
      <tr>
        <td height="20" align="right">英文名称：</td>
        <td><input name="ADsNameEn" type="text" class="textfield" id="ADsNameEn" style="WIDTH: 240;" value="<%=ADsNameEn%>" maxlength="100">&nbsp;显示：<input name="ViewFlagEn" type="checkbox" value="1" style='HEIGHT: 13px;WIDTH: 13px;' <%if ViewFlagEn then response.write ("checked")%>></td>
      </tr>
      <tr>
        <td height="20" align="right">弹窗尺寸：</td>
        <td><input name="ADsWidth" type="text" class="textfield" id="ADsWidth" style="WIDTH: 60;" value="<%=ADsWidth%>" maxlength="4" onKeyDown="if(event.keyCode==13)event.returnValue=false" onChange="if(/\D/.test(this.value)){alert('宽度和高度只能输入整数！');this.value='150';}">&nbsp;宽×高&nbsp;<input name="ADsHeight" type="text" class="textfield" id="ADsHeight" style="WIDTH: 60;" value="<%=ADsHeight%>" maxlength="4" onKeyDown="if(event.keyCode==13)event.returnValue=false" onChange="if(/\D/.test(this.value)){alert('宽度和高度只能输入整数！');this.value='100';}">&nbsp;*&nbsp;至少150×100像素</td>
      </tr>
      <tr>
        <td height="20" align="right" valign="top">中文内容：<br></td>
		  
        <td><textarea name="ContentCh" style="display:none" id="ContentCh" readonly><%=ContentCh%></textarea>
          <iframe ID="eWebEditor1" src="../webedit/ewebeditor.htm?id=ContentCh&ewebeditor.htm?id=ContentCH&style=coolblue&savepathfilename=UploadFiles" frameborder="0" scrolling="no" width="550" HEIGHT="450"></iframe></td>
      </tr>
      <tr>
	 
        <td height="20" align="right" valign="top">英文内容：<br>
          </td>
        <td><textarea name="ContentEn" style="display:none" id="ContentEn" readonly><%=ContentEn%></textarea>
          <iframe ID="eWebEditor1" src="../webedit/ewebeditor.htm?id=ContentEn&ewebeditor.htm?id=ContentCH&style=coolblue&savepathfilename=UploadFiles" frameborder="0" scrolling="no" width="550" HEIGHT="450"></iframe></td>
      </tr>

      <tr>
        <td height="30" align="right">&nbsp;</td>
        <td valign="bottom"><input  type="hidden"  name="UploadFiles" value="<%=UploadFiles%>"  onChange="doChange(this,document.editForm.DefaultPicList)">
        <input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
      </tr>
      <tr>
        <td height="20" align="right">&nbsp;</td>
        <td valign="bottom">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  </form>
</table>
</BODY>
</HTML>
<%
sub ADsEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then '保存编辑管理员信息
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("ADsNameCh")))<1 then
      response.write ("<script language=javascript> alert('""中文""标题为必填项目！');history.back(-1);</script>")
      response.end
    end if
	
    if request.Form("ViewFlagEn")=1 then
      if len(trim(request.Form("ADsNameEn")))<1 then
      response.write ("<script language=javascript> alert('您已经选择了""英文""显示，因此英文标题必填！');history.back(-1);</script>")
      response.end
      end if
    end if
	if trim(request.Form("ADsWidth"))="" or trim(request.Form("ADsHeight"))="" then
      response.write ("<script language=javascript> alert('弹窗广告规格必须为150×100像素以上！');history.back(-1);</script>")
      response.end
	end if
	if trim(request.Form("ADsWidth"))<150 or trim(request.Form("ADsHeight"))<100 then
      response.write ("<script language=javascript> alert('弹窗广告规格必须为150×100像素以上！');history.back(-1);</script>")
      response.end
	end if
    if Result="Add" then '创建网站管理员
	  sql="select * from TianTianCMS_ADs"
      rs.open sql,conn,1,3
      rs.addnew
      rs("ADsNameCh")=trim(Request.Form("ADsNameCh"))
	 
      rs("ADsNameEn")=trim(Request.Form("ADsNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  
	  if Request.Form("ViewFlagEn")=1 then
        rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        rs("ViewFlagEn")=0
	  end if
	  rs("ContentCh")=Request.Form("ContentCh")
	  rs("ContentEn")=Request.Form("ContentEn")
	  rs("ADsWidth")=trim(Request.Form("ADsWidth"))
	  rs("ADsHeight")=trim(Request.Form("ADsHeight"))
	  rs("UploadFiles")=trim(Request.Form("UploadFiles"))
	  rs("AddTime")=now()
	end if  
	if Result="Modify" then '修改网站管理员
      sql="select * from TianTianCMS_ADs where ID="&ID
      rs.open sql,conn,1,3
      rs("ADsNameCh")=trim(Request.Form("ADsNameCh"))
	  
      rs("ADsNameEn")=trim(Request.Form("ADsNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	 
	  if Request.Form("ViewFlagEn")=1 then
        rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        rs("ViewFlagEn")=0
	  end if
	  rs("ContentCh")=Request.Form("ContentCh")
	
	  rs("ContentEn")=Request.Form("ContentEn")
	  rs("ADsWidth")=trim(Request.Form("ADsWidth"))
	  rs("ADsHeight")=trim(Request.Form("ADsHeight"))
	  rs("UploadFiles")=Request.Form("UploadFiles")
	end if
	rs.update
	rs.close
    set rs=nothing 
    response.write "<script language=javascript> alert('成功编辑弹窗广告！');changeAdminFlag('弹窗广告列表');location.replace('ADsList.asp');</script>"
   else '提取管理员信息
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from TianTianCMS_ADs where ID="& ID
      rs.open sql,conn,1,1
	  ADsNameCh=rs("ADsNameCh")
	 
	  ADsNameEn=rs("ADsNameEn")
	  ViewFlagCh=rs("ViewFlagCh")
	 
	  ViewFlagEn=rs("ViewFlagEn")
	  ADsWidth=rs("ADsWidth")
	  ADsHeight=rs("ADsHeight")
      ContentCh=rs("ContentCh")
	 
      ContentEn=rs("ContentEn")
      UploadFiles=rs("UploadFiles")
	  rs.close
      set rs=nothing 
	end if
  end if
end sub
%>