
<!--#include file="../inc/Conn.asp"-->
<!--#include file="Inc/Admin.Asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim ID,rsProduct
ID=trim(request("ID"))
if ID="" then 
	response.Redirect("ProductManage.asp")
end if
sql="select * from Product where ID=" & ID & ""
Set rsProduct= Server.CreateObject("ADODB.Recordset")
rsProduct.open sql,conn,1,1
if FoundErr=True then
	call WriteErrMsg()
else
%>
<%
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" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td  align="center" valign="top"><b> </b>
<form method="POST" name="myform"  action="ProductSave.asp?action=Modify">
        <table width="650" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
          <tr> 
            <td class="topbg" height="22" colspan="2" align="right" bgcolor="#C0C0C0"><div align="center"><b>修 
                改 产 品</b> </div></td>
          </tr>
          <tr> 
            <td width="155" height="22" align="right" class=tdbgl>所属栏目：</td>
            <td class=tdbg> <%
        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">
                <%
		    do while not rs.eof
			%>
                <option <% if rs("BigClassName")=rsProduct("BigClassName") then response.Write("selected") end if%> value="<%=trim(rs("BigClassName"))%>"><%=trim(rs("BigClassName"))%></option>
                <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
              </select> <%
	%> <select name="SmallClassName">
                <option value="" <%if rsProduct("SmallClassName")="" then response.write "selected"%>>不指定小类</option>
                <%
			sql="select * from SmallClass where BigClassName='" & rsProduct("BigClassName") & "'"
			rs.open sql,conn,1,1
			if not(rs.eof and rs.bof) then
				do while not rs.eof%>
                <option <% if rs("SmallClassName")=rsProduct("SmallClassName") then response.Write("selected") end if%> value="<%=rs("SmallClassName")%>"><%=rs("SmallClassName")%></option>
                <%
			    	rs.movenext
				loop
			end if
	        rs.close
			%>
              </select> </td>
          </tr>
          <tr> 
            <td width="155" height="22" align="right" class=tdbgl>产品编号：</td>
            <td class=tdbg> <input name="Product_Id" type="text"
           id="Product_Id" value="<%=rsProduct("Product_Id")%>" size="10" maxlength="10"> 
              <font color="#FF0000">*</font> </td>
          </tr>
          <tr> 
            <td width="155" height="22" align="right" class=tdbgl>产品名称：</td>
            <td class=tdbg> <input name="Title" type="text"
           id="Title" value="<%=rsProduct("Title")%>" size="50" maxlength="80"> 
              <font color="#FF0000">*</font></td>
          </tr>
		  <%If FoundInarr(SiteLanguage,2,",") Then%>
          <tr> 
            <td width="155" height="22" align="right" class=tdbgl>英文产品名称：</td>
            <td class=tdbg><input name="EnTitle" type="text"
           id="EnTitle" value="<%=rsProduct("EnTitle")%>" size="50" maxlength="80"></td>
          </tr>
		  <%End If%>
          <tr> 
            <td width="155" height="22" align="right" class=tdbgl>规格：</td>
            <td class=tdbg><input name="Spec" type="text"
           id="Spec" value="<%=rsProduct("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="EnSpec" type="text"
           id="EnSpec" value="<%=rsProduct("EnSpec")%>" 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" value="<%=rsProduct("Unit")%>" 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" value="<%=rsProduct("EnUnit")%>" 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" value="<%=rsProduct("Memo")%>" size="50" maxlength="80"></td>
          </tr>
		  <%If FoundInarr(SiteLanguage,2,",") Then%>
          <tr>
            <td width="155" align="right" valign="middle" class=tdbgl>英文备注：</td>
            <td class=tdbg><input name="EnMemo" type="text"
           id="Memo" value="<%=rsProduct("EnMemo")%>" size="50" maxlength="80"></td>
          </tr>
		  <%End If%>
          <tr> 
            <td width="155" align="right" valign="middle" class=tdbgl> <div align="right">产品说明： 
            </div></td>
            <td class=tdbg><input type="hidden" name="content" value="<%=Server.HTMLEncode(rsProduct("Content"))%>"> 
              <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" height="22" align="right" class=tdbgl>英文产品说明：</td>
            <td class=tdbg><input type="hidden" name="Encontent" value="<%=Server.HTMLEncode(rsProduct("EnContent"))%>"> 
              <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 class="tdbg"><input name="IncludePic" type="checkbox" id="IncludePic" value="yes" <% if rsArticle("IncludePic")=True then response.Write("checked") end if%>>
              是</td>
          </tr>
          <tr>
            <td align="right" class="tdbgl" >首页图片：            </td>
            <td class="tdbg" ><input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="<%=rsProduct("DefaultPicUrl")%>" size="50" maxlength="180">
                <br>
              首页的图片,直接从上传图片中选择：
              <input type=hidden name="UploadFiles" onChange="doChange(this,document.myform.DefaultPicList)" value="<%=rsProduct("UploadFiles")%>">
              <select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
                <option value="" selected>不指定首页图片</option>
                <%
if rsProduct("UploadFiles")<>"" then
	dim IsOtherUrl
	IsOtherUrl=True
	if instr(rsProduct("UploadFiles"),"|")>1 then
		dim arrUploadFiles,intTemp
		arrUploadFiles=split(rsProduct("UploadFiles"),"|")						
		for intTemp=0 to ubound(arrUploadFiles)
			if rsProduct("DefaultPicUrl")=arrUploadFiles(intTemp) then
				response.write "<option value='" & arrUploadFiles(intTemp) & "' selected>" & arrUploadFiles(intTemp) & "</option>"
				IsOtherUrl=False
			else
				response.write "<option value='" & arrUploadFiles(intTemp) & "'>" & arrUploadFiles(intTemp) & "</option>"
			end if
		next
	else
		if rsProduct("UploadFiles")=rsProduct("DefaultPicUrl") then
			response.write "<option value='" & rsProduct("UploadFiles") & "' selected>" & rsProduct("UploadFiles") & "</option>"
			IsOtherUrl=False
		else
			response.write "<option value='" & rsProduct("UploadFiles") & "'>" & rsProduct("UploadFiles") & "</option>"		
		end if
	end If
	if IsOtherUrl=True then
		response.write "<option value='" & rsProduct("DefaultPicUrl") & "' selected>" & rsProduct("DefaultPicUrl") & "</option>"
	end if
end if
%>
              </select>
                          
            （<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" <% if rsProduct("Passed")=true then response.Write("checked") end if%>>
              是<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" <% if rsProduct("Elite")=true then response.Write("checked") end if%>>
              是<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" <% if rsProduct("newproduct")=true then response.Write("checked") end if%>>
              是<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="UpdateTime" value="<%=rsProduct("UpdateTime")%>" maxlength="50">
              当前时间为：<%=Now()%> 注意不要改变格式。</td>
          </tr>
          <tr> 
            <td height="22" colspan="2" align="right" class=tdbg> <div align="center"> 
                <input  name="Save" type="submit"  id="Save2" value="保存修改结果">
              </div></td>
          </tr>
        </table>
        <div align="center"> 
          <p> 
            <input name="ID" type="hidden" id="ID" value="<%=rsProduct("ID")%>">
          </p>
        </div>
    </form></td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
<%
end if
rsProduct.close
set rsProduct=nothing
call CloseConn()
%>