
<!--#include file="../inc/conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="Inc/Function.asp"-->
<%
PurviewValue="adddproduct"
If not CheckAdmin(PurviewValue) then
Response.Write("<script language=""JavaScript"">alert(""越权操作!"");history.go(-1);")
response.end
End If
%>
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from SmallClass order by SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassName"))%>","<%= trim(rs("SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function doChange(objText, objDrop){
    if (!objDrop) return;
    var str = objText.value;
    var arr = str.split("|");
    var nIndex = objDrop.selectedIndex;
    objDrop.length=1;
    for (var i=0; i<arr.length; i++){
      objDrop.options[objDrop.length] = new Option(arr[i], arr[i]);
    }
    objDrop.selectedIndex = nIndex;
  }


function changelocation(locationid)
    {
    document.myform.SmallClassName.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }    

function AddItem(strFileName){
  document.myform.IncludePic.checked=true;
  document.myform.DefaultPicUrl.value=strFileName;
  document.myform.DefaultPicList.options[document.myform.DefaultPicList.length]=new Option(strFileName,strFileName);
  document.myform.DefaultPicList.selectedIndex+=1;
  if(document.myform.UploadFiles.value==''){
	document.myform.UploadFiles.value=strFileName;
  }
  else{
    document.myform.UploadFiles.value=document.myform.UploadFiles.value+"|"+strFileName;
  }
}
</script>
<!-- #include file="Inc/Head.asp" -->

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="border">
  <tr> 
    <td  align="center" valign="top">
  <table width="100%" border="0" cellpadding="0" cellspacing="1">
    <form method="POST" name="myform" action="ProductSave.asp?action=add" target="_self"><tr>
      <td class="topbg" height="22" colspan="2" align="right"><div align="center"><b>添 
        加 产 品</b> </div></td>
    </tr>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">所属类别：</td>
      <td class="tdbg"><strong>
        <%
        sql = "select * from BigClass"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%>
        <select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1">
          <option selected value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
          <%
			dim selclass
		    selclass=rs("BigClassName")
        	rs.movenext
		    do while not rs.eof
			%>
          <option value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
          <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
        </select>
        <select name="SmallClassName">
          <option value="" selected>不指定小类</option>
          <%
			sql="select * from SmallClass where BigClassName='" & selclass & "'"
			rs.open sql,conn,1,1
			if not(rs.eof and rs.bof) then
			%>
          <option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
          <% rs.movenext
				do while not rs.eof%>
          <option value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
          <%
			    	rs.movenext
				loop
			end if
	        rs.close
			%>
          <%
			ranNum=int(9*rnd)+10
			iddata=month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum
			%>
        </select>
      </strong></td>
    </tr>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">产品编号：</td>
      <td class="tdbg"><strong>
        <input name="Product_Id" type="text"
           id="Product_Id" value="<%=iddata%>" size="10" maxlength="10">
        <font color="#FF0000">*产品编号不可以相同，如你不能确定会重复，请勿改动他！</font></strong></td>
    </tr>
    <tr>
      <td width="155" height="21" align="right" class="tdbgl">产品名称：</td>
      <td class="tdbg"><strong>
        <input name="Title" type="text"
           id="Title2" size="50" maxlength="80">
        <font color="#FF0000">*</font></strong></td>
    </tr>
	<%If FoundInarr(SiteLanguage,2,",") Then%>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">英文产品名称：</td>
      <td class="tdbg"><strong>
        <input name="EnTitle" type="text"
           id="Title3" size="50" maxlength="80">
      </strong></td>
    </tr>
	<%End If%>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">规格：</td>
      <td class="tdbg"><input name="Spec" type="text"
           id="Title" size="20" maxlength="80"></td>
    </tr>
	<%If FoundInarr(SiteLanguage,2,",") Then%>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">英文规格：</td>
      <td class="tdbg"><input name="EnSpec" type="text"
           id="Spec" size="20" maxlength="80"></td>
    </tr>
	<%End If%>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">单位：</td>
      <td class="tdbg"><input name="Unit" type="text"
           id="spec" size="20" maxlength="80"></td>
    </tr>
	<%If FoundInarr(SiteLanguage,2,",") Then%>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">英文单位：</td>
      <td class="tdbg"><input name="EnUnit" type="text"
           id="Unit" size="20" maxlength="80"></td>
    </tr>
	<%End If%>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">备注：</td>
      <td class="tdbg"><input name="Memo" type="text"
           id="unit" size="50" maxlength="80"></td>
    </tr>
	<%If FoundInarr(SiteLanguage,2,",") Then%>
    <tr>
      <td width="155" align="right" class="tdbgl"><div align="right">英文备注：</div></td>
      <td class="tdbg"><input name="EnMemo" type="text"
           id="Memo" size="50" maxlength="80"></td>
    </tr>
	<%End If%>
    <tr>
      <td width="155" align="right" class="tdbgl"><div align="right">产品说明：</div></td>
      <td class="tdbg"><input type="hidden" name="content" value="">
          <iframe ID="eWebEditor1" src="Editor/ewebeditor.asp?id=content&style=Product&savepathfilename=UploadFiles" frameborder="0" scrolling="no" width="550" HEIGHT="450"></iframe></td>
    </tr>
	<%If FoundInarr(SiteLanguage,2,",") Then%>
    <tr>
      <td width="155" align="right" class="tdbgl"><div align="right">英文产品说明：</div></td>
      <td class="tdbg"><input type="hidden" name="Encontent" value="">
          <iframe ID="eWebEditor1" src="Editor/ewebeditor.asp?id=Encontent&style=Product&savepathfilename=UploadFiles" frameborder="0" scrolling="no" width="550" HEIGHT="450"></iframe></td>
    </tr>
	<%End If%>
						            <tr> 
            <td align="right" class="tdbgl">包含图片：</td>
            <td colspan="2" class="tdbg"><input name="IncludePic" type="checkbox" id="IncludePic" value="yes" checked>
              是</td>
          </tr>
    <tr>
      <td width="155" align="right" class="tdbgl">产品缩览图：        </td>
      <td height="21" class="tdbg">
        <input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="40" maxlength="120">
        <br>
首页的图片,直接从上传图片中选择：
<select name="DefaultPicList" id="select" onChange="DefaultPicUrl.value=this.value;">
  <option value="" selected>不指定首页图片</option>
</select>
<span class="tdbgl">
<input  type="hidden"  name="UploadFiles" value=""  onChange="doChange(this,document.myform.DefaultPicList)">
</span>（<span style="color: #FF0000">先在WEB编辑器中上传图片，然后指定首页图片</span>） </td>
      </tr>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">已通过审核：</td>
      <td class="tdbg"><input name="Passed" type="checkbox" id="Passed" value="yes" checked>
        是<font color="#0000FF">（如果选中的话将直接发布）</font></td>
    </tr>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">首页显示：</td>
      <td class="tdbg"><input name="Elite" type="checkbox" id="Elite" value="yes" checked>
        是<font color="#0000FF">（如果选中的话将在首页显示）</font></td>
    </tr>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">首页新品显示：</td>
      <td class="tdbg"><input name="Newproduct" type="checkbox" id="Newproduct" value="yes" checked>
        是<font color="#0000FF">（如果选中的话将在首页显示为新品展示）</font></td>
    </tr>
    <tr>
      <td width="155" height="22" align="right" class="tdbgl">录入时间：</td>
      <td class="tdbg"><input name="UpdateTime" type="text" id="UpdateTime2" value="<%=now()%>" maxlength="50">
        当前时间为：<%=Now()%> 注意不要改变格式。</td>
    </tr>
    <tr class="a4">
      <td height="22" colspan="2" align="right" class="tdbg"><div align="center">
          <input
  name="Add" type="submit"  id="Add2" value=" 添 加 " onClick="document.myform.action='ProductSave.asp?action=add';document.myform.target='_self';">
      </div></td>
    </tr></form>
  </table>
    </td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
%>