<%@language=vbscript codepage=936 %>
<!--#include file="Conn.asp"-->
<!--#include file ="Check_Manager.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="JsInc/Function.asp"-->
<!--#include file="JsInc/config.asp"-->
<%
Dim onecount
Set rs=Conn.Execute("Select * From [SmallClassProduct]")
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%=trim(rs("Product_SmallClassName"))%>","<%= trim(rs("Product_BigClassName"))%>","<%= trim(rs("Product_SmallClassName"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        %>
onecount=<%=count%>;

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 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.key.value=="")
  {
    alert("产品关键字不能为空！");
	document.myform.key.focus();
	return false;
  }
  if (document.myform.Content.value=="")
  {
    alert("产品内容不能为空！");
	editor.HtmlEdit.focus();
	return false;
  }
   if (document.myform.guige.value=="")
  {
    alert("规格不能为空！");
	document.myform.guige.focus();
	return false;
  }

     if (document.myform.unit.value=="")
  {
    alert("单位不能为空！");
	document.myform.unit.focus();
	return false;
  }
    if (document.myform.mome.value=="")
  {
    alert("备注不能为空！");
	document.myform.mome.focus();
	return false;
  }
  if (document.myform.UpdateTime.value=="")
  {
    alert("录入时间不能为空！");
	document.myform.UpdateTime.focus();
	return false;
  }
}
function loadForm()
{
  editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
  return true
}
</script>
<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="411" align="center" valign="top"> <br> 
<%
Dim Img
Set rs_p=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [Product] Where ID="&Cint(Request("id"))
rs_p.Open Sql,Conn,1,1
Img = rs_p("Image")
Img = Split(Img,"/")
%>
      <form method="POST" name="myform" onSubmit="return CheckForm();" action="Product_EditPro.asp?action=uppro&id=<%=Request("id")%>">
        <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="1">
                <tr> 
                  <td height="22" align="right">产品名称：</td>
                  <td colspan="2"> <input name="Title" type="text"
           id="Title" value="<%=rs_p("Name")%>" size="50" maxlength="80"> <font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="10" align="right">产品类别：</td>
                  <td colspan="2"> 
                    <%
Set b_news=Conn.Execute("Select * From [BigClassProduct]")
Response.Write "<select name=BigClassName onChange='changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)'>"
If b_news.Eof and b_news.Bof Then
Response.Write "产品大类!"
Else
Do until b_news.Eof
Response.Write "<option "
If b_news("Product_BigClass")=rs_p("BigClassP") Then Response.Write "selected "
Response.Write " value=" &Trim(b_news("Product_BigClass"))& ">" &Trim(b_news("Product_BigClass"))& "</option>"
b_news.MoveNext
Loop
End if
Response.Write "</select>"

Set s_news=Conn.Execute("Select * From [SmallClassProduct] Where Product_BigClassName='"&rs_p("BigClassP")&"'")
Response.Write "<select name=SmallClassName>" 
If s_news.Eof Then
Response.Write "产品小类"
Else
Response.Write "<option value='0'>产品小类</option>"
Do until s_news.Eof
Response.Write "<option "
If s_news("Product_SmallClassName")=rs_p("SmallClassP") Then Response.Write "selected"
Response.Write " value="&Trim(s_news("Product_SmallClassName"))&">" &Trim(s_news("Product_SmallClassName"))& "</option>"
s_news.MoveNext
Loop
End if
Response.Write "</select>"
Response.Write "(在添加产品前请先选择产品小类)"
%>
                  </td>
                </tr>
                <tr> 
                  <td height="11" align="right">产品编号：</td>
                  <td colspan="2"> <input name="pro_id" type="text" id="pro_id" value="<%=rs_p("Product_ID")%>" size="20" maxlength="25"> 
                    <font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="5" align="right" valign="middle">规格：</td>
                  <td colspan="2"><input name="guige" type="text" id="guige" value="<%=rs_p("GuiGe")%>" maxlength="10"><font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="5" align="right" valign="middle">单位：</td>
                  <td colspan="2"><input name="unit" type="text" id="unit" value="<%=rs_p("Unit")%>" maxlength="10"><font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="5" align="right" valign="middle">备注：</td>
                  <td colspan="2"><input name="mome" type="text" id="mome" value="<%=rs_p("Mome")%>" size="50" maxlength="100"><font color="#FF0000">*</font></td>
                </tr>
                <tr> 
                  <td height="2" align="right" valign="middle">关键字：</td>
                  <td colspan="2"><input name="key" type="text" id="key" value="<%=rs_p("Key")%>" size="50" maxlength="100"> 
                    <font color="#FF0000">*</font><br>
                    用来查找相关文章，可输入多个关键字，中间用空格分开。不能出现&quot;&quot;'*?,.()等字符。</td>
                </tr>
                <tr> 
                  <td height="10" align="right" valign="middle">产品说明：</td>
                  <td colspan="2"> </td>
                </tr>
                <tr> 
                  <td colspan="3" align="right" valign="middle"> <div align="left"> 
                      <textarea name="Content" style="display:none"><%=rs_p("Content")%></textarea>
                      <iframe ID="editor" src="Editorp.asp" frameborder=1 scrolling=no width="620" height="405"></iframe>
                    </div></td>
                </tr>
                <tr> 
                  <td align="right" valign="middle">首页图片：</td>
                  <td> <p>首页的图片,从上传图片中选择：</p>
                    <p> 
                      <%
ComeinSTR=lcase(request.servervariables("HTTP_HOST"))
Url=split(ComeinSTR)
yourthing=Url(0)

Set rs=Server.CreateObject("Adodb.Recordset")
Sql="Select * From [UpProduct] Order By ID Desc"
rs.Open Sql,Conn,1,1
%>
                      <select name="face" id="face" onChange="document.images['image'].src=options[selectedIndex].value; ">
       <option value="../UpProduct/<%=Img(2)%>">已指定就使用的图片</option>
       <option value="../UpProduct/defeat.gif">如果没有指定就使用默认图片</option>
<%Do While Not rs.Eof%>
                      <option value="../UpProduct/<%=rs("File_Name")%>"><%=rs("File_Name")%></option>
<%rs.MoveNext
Loop
rs.Close
Set Conn=Nothing
Set rs=Nothing
%>
                      </select>
                    </p></td>
                  <td><img src="../UpProduct/defeat.gif" alt="默认图片" name="image" width="100" height="80" id="image"></td>
                </tr>
                <tr> 
                  <td width="149" align="right">首页显示：</td>
                  <td colspan="4"> <input name="Elite" type="checkbox" id="Elite" value="yes" <%If rs_p("PassShow")=true Then Response.Write "checked"%>>
                    是<font color="#0000FF">（如果选中的话将在首页显示）</font></td>
                </tr>
                <tr> 
                  <td align="right">审核：</td>
                  <td colspan="4"><input name="pass" type="checkbox" id="pass" value="yes" <%If rs_p("Pass")=true Then Response.Write "checked"%>>
                    通过<font color="#0000FF">（如果选中的话将直接发布）</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right">录入时间：</td>
                  <td colspan="2"> <input name="UpdateTime" type="text" id="UpdateTime" value="<%=date()%>" maxlength="50">
                    当前时间为：<%=now()%> 注意不要改变格式。</td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
<%
rs_p.Close
set rs_p=Nothing
call CloseConn()
%>
        <div align="center"> 
          <p> 
            <input name="Save" type="submit" id="Save" value="修改">
          </p>
        </div>
      </form></td>
  </tr>
</table>
</body>
</html>