<!--#include file="Config.asp" -->
<div class='menu'>&nbsp;编辑 &gt; 广告</div>
<%
eims = "Ads"
eTable = Prefix&eims
ListUrl = eims&"List.asp?eims="&eims
EditUrl = eims&"Edit.asp?eims="&eims
Mgt("p16") 'Cookies : Permission
'------------------------------------------------
Select Case action
Case "SaveAdd" '保存添加
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From ["&eTable&"]",Conn,1,3
Rs.AddNew
Rs("Title")=Trim(Request.Form("Title")) 
Rs("Photo")=Trim(Request.Form("Photo"))
Rs("ItemNote")=Trim(Request.Form("ItemNote"))
Rs("EditDate")=Trim(Request.Form("EditDate"))
Rs("ItemRec")=Trim(Request.Form("ItemRec"))
Rs("AddDate")=Now()
Rs.Update
Response.Redirect "Redirect.asp?eims="&eims&"&SortID="&SortID&"&ItemID="&Rs("ItemID")
Rs.Close:Set Rs=Nothing
Response.End
Case "SaveMod" '保存修改
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From ["&eTable&"] Where ItemID="&ItemID,Conn,1,3
Rs("Title")=Trim(Request.Form("Title")) 
Rs("Photo")=Trim(Request.Form("Photo"))
Rs("ItemNote")=Trim(Request.Form("ItemNote"))
Rs("EditDate")=Trim(Request.Form("EditDate"))
Rs("ItemRec")=Trim(Request.Form("ItemRec"))
Rs.Update
Rs.Close:Set Rs=Nothing 
Response.Redirect "Redirect.asp?eims="&eims&"&SortID="&SortID&"&ItemID="&ItemID
Response.End
Case "Edit" '显示数据
SaveStr="SaveMod"
Set Rs=Server.CreateObject("Adodb.RecordSet")
Rs.Open "Select * From ["&eTable&"] Where ItemID="&ItemID,Conn,1,1
If Not Rs.Eof Then
Title=Trim(Rs("Title")) 
Photo=Trim(Rs("Photo"))
ItemNote=Trim(Rs("ItemNote"))
End If
Rs.Close:Set Rs=Nothing
End Select
'------------------------------------------------
if SaveStr="" then SaveStr="SaveAdd"

%>
<script language="JavaScript" type="text/javascript">
function ckedit(){
   if (trim(document.eForm.Title.value).length<2){
	  alert("标题不能少于2个字符！");
	  return false;
	  exit;}
   return true;}
</script>
<div class="content">
<Form name='eForm' method='post' action='?action=<%=SaveStr%>&ItemID=<%=ItemID%>'>
  <table width="100%" border="0" cellspacing="1" cellpAdding="1" align="center">
      <tr>
        <td align="center" width="12%">标题</td>
        <td><input name="Title" type="text" value="<%=Title%>" size="60">
            <select name="ItemRec">
			<option value='1'>显示</option>
			<option value='0'>隐藏</option>
            </select>
		</td>
      </tr>
      <tr>
        <td align="center">图片</td>
        <td><iframe src="Upload.asp?eType=pic&fField=Photo" scrolling="no" frameborder="0" width="300" height="25"></iframe><br>
		<input type="text" name="Photo" size="50" value="<%=Photo%>">
		<input type="checkbox" value="1" name="Thumbnail" <%if Int(Thumbnail)=1 then response.write "checked"%>>自动缩小</td>
      </tr>
	  <% If action="Edit" Then %>
      <tr>
        <td align="center">调用</td>
        <td class="dig">&lt;% =eRead(&quot;Ads&quot;,<%=ItemID%>,&quot;ItemNote&quot;) %&gt;</td>
      </tr>
	  <% End If %> 
      <tr>
        <td align="center">内容</td>
        <td><textarea name="ItemNote" style="width:680px;height:300px;visibility:hidden;"><%=ItemNote%></textarea></td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td></td>
        <td align="left"><input type="submit" name="Submit" value="保 存" onClick="return ckedit()">
          &nbsp;&nbsp;
          <input type="button" value="返 回" onClick="history.go(-1);"></td>
      </tr>    
  </table>
</Form>
</div>
</body></html>
<%Call CloseConn()%>
