  <% 
	data_path="../../" 'ACC连接数据库路径，对SQL无效
	numid="41"
	dir="../err.asp" 
  %>
  <!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
 <!--#include file="../rolecheck.asp"--><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../css/style.css" rel=stylesheet type=text/css>
</head>
<%
if Chkrequest(request("id")) then
id=Replace_Text(request("id"))
else
response.Redirect("../../login/chklogin.asp?login=4")
response.end
end if
sql="select * from Websen_productshow where id="&id&""
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1
if rs.eof then 
response.write"<SCRIPT language=JavaScript> this.location.href='javascript:window.history.go(-1)';</SCRIPT>" 
response.end
else
sid=rs("sortid")
tid=rs("typeid")
tid2=rs("typeid_2")
set rs3=conn.execute("select Websen_class_2.*,Websen_class_1.* from Websen_class_2,Websen_class_1 where Websen_class_2.typeid="&rs("typeid")&" and Websen_class_1.sortid=Websen_class_2.sortid")
%>


<table width="98%" border="0" cellspacing="0" cellpadding="0" align=center class="tableBorder">
<tr> 
<th class="tableHeaderText" colspan=2 height=25>会员产品信息管理</th>
</tr>
<tr>
<td   colspan=2><FONT color="#666666">温馨提示： ①任何的删除操作都是不可逆的，执行删除时请慎重。 
 ②点击产品信息查看或修改该条供求详细信息。 
③点击公司名查看或者修改用户"企业信息"。</font>
</td>
</tr>
<FORM name=searchForm action="select.asp" method=post>
<tr>
<td width="19%" height=25 class="forumRowHighlight">
<B>管理操作选项</B></td>
<td width="81%" class=forumRowHighlight>关键字：<input name="keywords" type="text" value="<%=keywords%>">
&nbsp;类型：
<select name="which">
			  <option value="0" <%if action ="0" then Response.Write "selected"%>>待审产品信息</option>
			  <option value="1" <%if action ="1" then Response.Write "selected"%>>已审产品信息</option>
			  <option value="2" <%if action ="" then Response.Write "selected"%>>推荐产品信息</option>
		</select> <input type="submit" value="立刻查找" id=submit name=submit></td>
</tr>
</form><tr><td height="1" bgcolor="#CCCCCC" colspan="2"></td></tr>

  <tr>
    <td height=25 class="forumRowHighlight">&nbsp;</td>
    <td height=25 class="forumRowHighlight"><a href="admin_check.asp?action=0">待审产品信息</a> | <a href="admin_check.asp?action=1">已审产品信息</a> |  <a href="index.asp">推荐产品信息</a> |  [<a href="javascript:location.reload()">刷新页面</a>] </td>
  </tr>
</table><TABLE class=content_border cellSpacing=0 cellPadding=0 width=100% 
border=0>
  <TBODY>
        <TR>
          <TD align=middle>
		  
<SCRIPT language=JavaScript>

function setSubjectText(){
	
	if(trim(document.form.cpmc.value) == "") {
		    alert("请先填写产品名称");
			document.form.cpmc.focus();
		    return false;
	} 
	if(trim(document.form.cpgg.value) == "") {
		    alert("请先填写产品型号");
			document.form.cpgg.focus();
		    return false;
	} 
	if(trim(document.form.cpcd.value) == "") {
		    alert("请先填写产品原产地");
			document.form.cpcd.focus();
		    return false;
	} 
	
		if(trim(document.form.p_z_Z_RootCategory.value) == "") {
      alert("请先选择行业大类");
      form.p_z_Z_RootCategory.focus();
      return false;
    }
		if(trim(document.form.p_z_Z_CategoryId1.value) == "") {
		    alert("请先选择行业小类");
			document.form.p_z_Z_CategoryId1.focus();
		return false; 
	} 
	if(trim(document.form.keywords.value) == "") {
		    alert("注意：请按左至右的顺序填写\n\n关键字最少要填一个");
			document.form.keywords.focus();
		    return false;
	}
	if(trim(document.form.xxsm.value) == "") {
		    alert("请先填写详细说明");
			document.form.xxsm.focus();
		    return false;
	} 


   var keywords = form.keywords.value;
   for(i=0;i<keywords.length;i++){keywords=keywords.replace(',','，');}
    if(form.keywords2.value){
        for(i=0;i<form.keywords2.value.length;i++){form.keywords2.value=form.keywords2.value.replace(',','，');}
        keywords+=','+form.keywords2.value;
    }
    if(form.keywords3.value){
        for(i=0;i<form.keywords3.value.length;i++){form.keywords3.value=form.keywords3.value.replace(',','，');}
        keywords+=','+form.keywords3.value;
    }    
    form.p_z_Z_Keywords.value = keywords
	
  //  return true;
	document.form.submit()
    }
function trim(inputString) {
	   
              if (typeof inputString != "string") { return inputString; }
              var retValue = inputString;
              var ch = retValue.substring(0, 1);
              while (ch == " ") { 
	          //检查字符串开始部分的空格
                  retValue = retValue.substring(1, retValue.length);
                  ch = retValue.substring(0, 1);
              }
              ch = retValue.substring(retValue.length-1, retValue.length);
              while (ch == " ") {
                 //检查字符串结束部分的空格
                 retValue = retValue.substring(0, retValue.length-1);
                 ch = retValue.substring(retValue.length-1, retValue.length);
              }
              while (retValue.indexOf("  ") != -1) { 
	         //将文字中间多个相连的空格变为一个空格
                 retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
              }
              return retValue;
           } 	

</SCRIPT>
<form method="POST" action="save_edit.asp" name="form" >
 <input type="hidden" name="id" value="<%=id%>">
 <%
 set firs=server.CreateObject("adodb.recordset")
 fisql="select * from Websen_corporation where id="&rs("gsid")
 firs.open fisql,conn,1,1
 if not firs.eof then
 %>
 <input type="hidden"  name="uname" value="<%=firs("User")%>" maxlength="50" />
 <%
 firs.close
 end if
 %>
           <TABLE cellSpacing=2 cellPadding=3 width="98%" border=0 align=center class="tableBorder">
		  <tr>
      <th align=center height=23 colspan="2">产品基本信息</th>
    </tr>
              <TR>
                <TD class=forumRow><FONT color=#ff0000>*</FONT> 
                  <B>产品名称：</B></TD>
                <TD class=forumRow><INPUT maxLength=50 size=30 name="cpmc" value="<%=rs("cpmc")%>"> <BR>
                          <SPAN 
                  class=note>例：“数控车床”</SPAN></TD>
            </TR>
				<TR>
                <TD class=forumRow><FONT color=#ff0000>*</FONT> 
                  <B>产品型号：</B></TD>
                <TD class=forumRow><INPUT maxLength=50 size=30 name="cpgg" value="<%=rs("cpgg")%>"> <BR>
                          <SPAN 
                  class=note>例：“CJK0632”</SPAN> </TD>
                </TR>
				<TR>
                <TD class=forumRow><FONT color=#ff0000>*</FONT> 
                  <B>原 产 地：</B></TD>
                <TD class=forumRow><INPUT maxLength=50 size=30 name="cpcd" value="<%=rs("cpcd")%>"> <BR>
                          <SPAN 
                  class=note>例：“广东省北京市”</SPAN> </TD>
                </TR>
              <TR>
                <TD class=forumRow><FONT color=#ff0000>*</FONT> 
                  <B>行 业：</B></TD>
                <TD class=forumRow>
				<select name="p_z_Z_RootCategory" onchange="changeCategory(this)"  >
                                  <option selected>--请选择行业大类--</option>
                                </select> <select name="p_z_Z_CategoryId1" maxlength="80">
                                  <option value="0" selected>--无该行业子类--</option>
                                </select>
		
	   
		
	   <BR>
                          <SPAN 
                  class=note>指您产品所属的行业</SPAN> </TD>
            </TR>
              
				<TR>
                <TD class=forumRow width="20%"><B>产品图片：</B></TD>
                <TD class=forumRow>
				<%
'				查出公司的名称作为路径中目录
                 set rscc=server.CreateObject("adodb.recordset")
				 sqlcc="select * from Websen_corporation  where id="&rs("Gsid")
				 rscc.open sqlcc,conn,1,1
				 if not rscc.eof then
				 gsname=rscc("user")
				 set rscc=nothing
				 end if
               				
				%>
   <!----------------------------------------------------文件上传----------------------------------------------->
  <iframe id="d_file" frameborder="0" src="../../inc/upload.asp?tMode=2&istwo=0&guser=<%=gsname%>&utype=guser" width="300" height="40" scrolling="no"></iframe>
  <!--------------------------------------------------------------------------->
				 <br /> <input type="hidden" name="picture" value="<%=rs("Picture")%>" size="50">
				 <input  type="hidden" name="oldpic" value="<%=rs("Picture")%>" size="50">
                          <br><input type="radio" name="cimg" value="1" checked><b><font color="red">▲</font></b>使用原有图片 
                           | 
                          <input type="radio" name="cimg" value="2"><b><font color="red">◆</font></b>删除原有图片重新上传 </TD>
              <TR>
                <TD class=forumRow><FONT color=#ff0000>*</FONT> <B>关键字：</B></TD>
                <TD class=forumRow>
				          <%
				keywords=rs("keywords")
				if keywords<>"" then
				  if instr(keywords,",")>0 then
				     kwarry=split(keywords,",")
					 if ubound(kwarry)=1 then
				           response.write"<INPUT maxLength=8 size=20 value='"&kwarry(0)&"' name=keywords>, <INPUT maxLength=8 size=20 value='"&kwarry(1)&"' name=keywords2>, <INPUT maxLength=8 size=20 name=keywords3>"
				           elseif ubound(kwarry)=2 then
				           response.write"<INPUT maxLength=8 size=20 value='"&kwarry(0)&"' name=keywords>, <INPUT maxLength=8 size=20 value='"&kwarry(1)&"' name=keywords2>, <INPUT maxLength=8 size=20 value='"&kwarry(2)&"' name=keywords3>"
                           elseif ubound(kwarry)>2 then
				           response.write"<INPUT maxLength=8 size=20 value='"&kwarry(0)&"' name=keywords>, <INPUT maxLength=8 size=20 value='"&kwarry(1)&"' name=keywords2>, <INPUT maxLength=8 size=20 value='"&kwarry(2)&"' name=keywords3>"
                     end if
				  else
				  response.write"<INPUT maxLength=8 size=20 value='"&keywords&"' name=keywords>, <INPUT maxLength=8 size=20 name=keywords2>, <INPUT maxLength=8 size=20 name=keywords3>"
                  end if
				else
				response.write"<INPUT maxLength=8 size=20 name=keywords>, <INPUT maxLength=8 size=20 name=keywords2>, <INPUT maxLength=8 size=20 name=keywords3>"
				end if
				%>
                           <INPUT type=hidden 
                  name=p_z_Z_Keywords> <SPAN 
                  class=note><BR>用产品名、行业类目做关键字，可填1-3个（每个最多8个字），尽量填全；<BR>
                          例：供应发电机，可填“发电机”“发电机及电动机”“机械”为关键字<BR>
                    </SPAN></TD>
            </TR>
              <TR>
                <TD class=forumRow><FONT color=#ff0000>*</FONT> 
                  <B>详细说明：</B></TD>
                <TD class=forumRow><TEXTAREA name="xxsm" rows=10 cols=75><%=rs("xxsm")%></TEXTAREA>                  </TD>
              </TR>
          </TABLE>
            <TABLE cellSpacing=2 cellPadding=3 width="98%" border=0 align=center class="tableBorder">
		  <tr>
      <th align=center height=23 colspan="2">产品补充信息</th>
    </tr>			  <TR>
                <TD class=forumRow><B>产品品牌：</B></TD>
                <TD class=forumRow><INPUT 
                  style="FONT-SIZE: 9pt; WIDTH: 250px" maxLength=50 size=30 
                  name="cpsb" value="<%=rs("cpsb")%>"> </TD></TR>
              
              <TR>
                <TD class=forumRow><B>产品数量</B>：</TD>
                <TD class=forumRow><INPUT 
                  style="FONT-SIZE: 9pt; WIDTH: 250px" maxLength=50 size=30 
                  name="Quantity" value="<%=rs("Quantity")%>"></TD></TR>
              <TR>
                <TD class=forumRow><B>包装说明：</B></TD>
                <TD class=forumRow><INPUT 
                  style="FONT-SIZE: 9pt; WIDTH: 250px" maxLength=50 size=30 
                  name="Packaging" value="<%=rs("Packaging")%>"></TD></TR>
              <TR>
                <TD class=forumRow><B>价格说明：</B></TD>
                <TD class=forumRow><INPUT 
                  style="FONT-SIZE: 9pt; WIDTH: 250px" maxLength=50 size=30 
                  name="cpjg" value="<%=rs("cpjg")%>"></TD></TR>
              <TR>
                <TD height="25" colspan="2" class=forumRow><TABLE cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <TBODY>

              <TR>
                <TD><INPUT type=checkbox <%if rs("FeedbackFlag")=true then response.write"CHECKED"%> value="<%=rs("FeedbackFlag")%>" 
                  name="FeedbackFlag"  style="display:none"></TD>
                </TR></TBODY></TABLE></TD>
              </TR>
              <TR>
                <TD colspan="2" class=forumRow><TABLE width="100%" border=0 cellPadding=4 cellSpacing=0>
              <TBODY>
              <TR>
                
                <TD Align=center noWrap><INPUT class=subbutton style="WIDTH: 160px" onclick=javascript:setSubjectText() type=button value=一切完成，我要发布！ name=Post> 
                </TD></TR></TBODY></TABLE></TD>
              </TR>
            </TABLE>
            </FORM>
</TD></TR></TBODY></TABLE>
<script>

        //category methods
        function Category(id,title) {
                this.id = id;
                this.title=title;
                this.boardlist=new Array();
                this.addBoard=addBoard;
                this.getOptions = getOptions;
        }        
        
        function addBoard(board) {
                this.boardlist = this.boardlist.concat(board);
        }
        
        function getOptions() {
                var tmp = new Array();
                for(var i=0; i < this.boardlist.length;i++) {
                        var b = this.boardlist[i];
                        tmp[i]= b.getOption();
                }
                return tmp;
        }
        
        //board methods
        function Board(catid,id,title,total) {                
                this.catid=catid;
                this.id=id;
                this.title=title;
                this.getOption=getOption;
        }
                
        function getOption() {
                return new Option(this.title,this.id);                
        }
                
        function changeCategory(list) {
        if (list.selectedIndex<=0) {
                catForm.options[0].selected=true;
                var len = boardForm.options.length;
                for (var i=len-1;i>0;i--){
                        boardForm.options[i]=null;
                }                                        
         }
        else {
                var boards = catArr[list.selectedIndex-1].getOptions();
                var len = boardForm.options.length;
                for (var i=len-1;i>0;i--){
                        boardForm.options[i]=null;
                }                
                for (var i=0;i<boards.length;i++) {
                        boardForm.options[i+1]=boards[i];
                }
                }
                boardForm.options[0].selected=true;
        }
                
        function selectBoard(catid,bid,list) {
                var isExist = false; //是否是叶子类目
                for(var i=0;i<catForm.length;i++) {
                        if (catForm.options[i].value==catid) {
                                //alert("get Category");
                                catForm.options[i].selected=true;
                                changeCategory(catForm);
                                break;                        
                        }                        
                }                                
                for(var i=0;i<boardForm.length;i++) {
                        if (boardForm.options[i].value==bid) {
                                //alert("get Board");
                                boardForm.options[i].selected=true;  
                                isExist = true;                              
                                break;
                        }                        
                }   
                
                if (!isExist) {//如果是二级类目，则下拉框只显示该二级类目下所有类目                   
                    var boards = catArr[catForm.selectedIndex-1].getOptions();
                    var len = boardForm.options.length;
                    for (var i=len-1;i>0;i--){
                        boardForm.options[i]=null;
                    }     
                    var locate = 1;           
                    for (var i=0;i<boards.length;i++) {                                                              
                        if(boards[i].text.indexOf(bid) == 0){
                            boardForm.options[locate]=boards[i];
                            locate++;
                        }                                                
                    }
                
                    boardForm.options[0].selected=true;   
                }            
        }        

        //static methods        
        var catArr = new Array();
        var cur;   
		//init catform
        var catForm = document.form.p_z_Z_RootCategory;
        var boardForm = document.form.p_z_Z_CategoryId1;
        
        
        
        function showCategorys() {
            var catId = catForm.value
            if(boardForm.value){
                catId = boardForm.value
            }else if(catForm.value){
                catId = catForm.value
            }
            window.open('/tradeinfo/smalllist.asp?sortid='+catId,'newwin','toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=600,height=500')            
        }
        for (var i=0;i<catArr.length;i++) {
                catForm.options[i+1]=new Option(catArr[i].title,catArr[i].id);
        }
  
                      function initRootCategorys(){
	    for (var i=0;i<catArr.length;i++) {
		 catForm.options[i+1]=new Option(catArr[i].title,catArr[i].id);
	    }
	}  
        //init                
</script>
<script src="<%=HOPE_InstallDir%>js/allCategorys.js"></script>
<script>
initRootCategorys(); 
</script>
<script>
selectBoard("<%=sid%>","<%=tid%>,<%=tid2%>");
</script>
<%
end if
rs.close
set rs=nothing

conn.close
set conn=nothing
%>
<!--#include file="../copy.asp"-->