<%@language=vbscript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="JsInc/config.asp"-->
<script language = "JavaScript">
function CheckForm()
{   
  if (editor.EditMode.checked==true)
	  document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
  else
	  document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; 

  if (document.myform.Title.value=="")
  {
    alert("下载名称不能为空！");
	document.myform.Title.focus();
	return false;
  }
  if (document.myform.Content.value=="")
  {
    alert("下载说明不能为空！");
	editor.HtmlEdit.focus();
	return false;
  }
  if (document.myform.UpdateTime.value=="")
  {
    alert("录入时间不能为空！");
	document.myform.UpdateTime.focus();
	return false;
  }
 if (document.myform.downurl.value=="")
  {
    alert("下载地址不能为空！");
	document.myform.downurl.focus();
	return false;
  }
 if (document.myform.photourl.value=="")
  {
    alert("产品图片不能为空！");
	document.myform.photourl.focus();
	return false;
  }
  return true;   
}
function loadForm()
{
  editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
  return true
}
</script>
<%
If Request.QueryString("action")="add" Then
titel = Trim(Request.Form("Title"))
content = Trim(Request.Form("Content"))
downtype = Trim(Request.Form("ClassName"))
UpdateTime = Trim(Request.Form("UpdateTime"))
photourl = Trim(Request.Form("photourl"))
downurl = Trim(Request.Form("downurl"))
If Request.Form("add") = "添加" Then
If downtype="0" Then 
Response.write "<script language='javascript'>" & chr(13)
		response.write "alert('请选择下载类别！');" & Chr(13)
		response.write "javascript:history.go(-1);"&Chr(13)
		response.write "</script>" & Chr(13)
Response.End
End if
If UpdateTime<>"" and IsDate(UpdateTime)=true then
		UpdateTime=CDate(UpdateTime)
	Else
		UpdateTime=date()
	End if
Set add=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [DownLoad] Where ID is Null"
add.Open Sql,Conn,1,3
add.addnew
add("Titel")=titel
add("Content")=content
add("InfoTime")=UpdateTime
add("DownType")=downtype
add("PhotoUrl")=photourl
add("DownUrl")=downurl
add.Update
add.Close
Set add=Nothing
JaSys("管理员" & session("ManagerUser") & "<font color=red>添加下载"&titel&"</font>成功")
Response.write "<script language='javascript'>" & chr(13)
		response.write "alert('下载添加成功！');" & Chr(13)
		response.write "window.document.location.href='Down_Manage.asp';"&Chr(13)
		response.write "</script>" & Chr(13)
Response.End
End if
End if
%>
<html>
<head>
<titel></titel>
<LINK href="admin/admin.css" type=text/css rel=stylesheet>
</head>
<body>
<body onLoad="javascipt:setTimeout('loadForm()',1000);">
<table width="100%" height="43%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="300" align="center" valign="top"> <br> 
      <form method="POST" name="myform" onSubmit="return CheckForm();" action="Down_AddDown.asp?action=add">
        <table width="620" border="0" align="center" cellpadding="0" cellspacing="0" class=tableBorder>
          <tr> 
            <td height="25" align="center" background="admin/admin_bg_1.gif" class="title"><font color="#FFFFFF"><b>添 加 下 载 文 件</b></font></td>
          </tr>
          <tr align="center"> 
            <td valign="top"> 
              <table width="100%" border="0" cellpadding="2" cellspacing="0">
                <tr> 
                  <td height="22" align="right">下载名称：</td>
                  <td width="462"> <input name="Title" type="text"
           id="Title" size="50" maxlength="80"> <font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right">下载类别：</td>
                  <td> 
<%
Set dd=Conn.Execute("Select * From [BigClassDown]")
Response.Write "<select name=ClassName>"
If dd.Eof and dd.Bof Then
Response.Write "没有下载类别"
Else
Response.Write "<option value='0' selected>请选择下载类别</option>"
Do until dd.Eof
Response.Write "<option value=" &Trim(dd("DownType"))& ">" &Trim(dd("DownType"))& "</option>"
dd.MoveNext
Loop
End if
Response.Write "</select>"
%>
                    <font color="#0000FF">(添加前请选好下载类别)</font> </td>
                </tr>
                <tr> 
                  <td height="22" align="right" valign="middle">下载说明：</td>
                  <td> </td>
                </tr>
                <tr> 
                  <td colspan="2" align="right" valign="middle"> <div align="left"> 
                      <textarea name="Content" style="display:none"></textarea>
                <iframe ID="editor" src="Editod.asp" frameborder=1 scrolling=no width="620" height="405"></iframe>   
                    </div></td>
                </tr>
                <tr> 
                  <td width="152" align="right" valign="top">产品图片：</td>
                  <td colspan="6"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td width="49%" valign="top"> 
                          <input name="photourl" type="text" id="photourl" value="UpDown/defeat.gif" size="35" maxlength="100"><br>
                          (如果没有图片,就不要改动默认图片)</td>
                        <td width="51%">
<iframe name="ad" frameborder=0 width=100% height=50 scrolling=no src=../uploadd1.asp></iframe>
						</td>
                      </tr>
                    </table> </td>
                </tr>
                <tr> 
                  <td align="right" valign="top">下载地址：</td>
                  <td colspan="6"> 
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td width="49%" valign="top">
<input name="downurl" type="text" id="downurl2" value="http://" size="35" maxlength="100">
                          <font color="#FF0000">*</font> </td>
                        <td width="51%">
<iframe name="ad" frameborder=0 width=100% height=50 scrolling=no src=../uploadd2.asp></iframe>
						</td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="22" align="right">录入时间：</td>
                  <td> <input name="UpdateTime" type="text" id="UpdateTime" value="<%=date()%>" maxlength="50">
                    当前时间为：<%=now()%> 注意不要改变格式。</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
        <div align="center"> 
          <p> 
            <input name="add" type="submit" id="add" value="添加">
          </p>
        </div>
      </form></td>
  </tr>
</table>
<%call CloseConn()%>
</body>
</html>