<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!--#include file="../inc/function.asp"-->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p21")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改分类信息</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #FF0000}
.width100{width:100%;}
.style2 {
	color: #FFFFFF;
	font-weight: bold;
}

-->
</style>
<script type="text/javascript" src="../js/prototype.js"></script>
<script type="text/javascript" src="../js/effects.js"></script>
<script type="text/javascript" src="../js/validation.js"></script>
<script language="JavaScript" src="../JS/PublicJS.js"></script>
<script type="text/javascript" src="/js/areas.js"></script>
<script type="text/javascript" src="/member/js/date.js"></script>
<script type="text/javascript">
function selectcity(provinceid,cityid){	
var citySelect=document.PostForm.City;
citySelect.options.length = 0;		
new Ajax.Request('/member/get_citys.asp?pid='+provinceid,
  {
    method:'get',
    onSuccess: function(transport){
			var response = transport.responseXML.documentElement;
			var classidList = response.getElementsByTagName('city');	
			
			for(var i=0;i<classidList.length;i++){
				xx=classidList[i].getElementsByTagName('id');
				yy=classidList[i].getElementsByTagName('title');
				classid=xx[0].firstChild.data
				classtitle=yy[0].firstChild.data				
				citySelect.options[i]=new Option(classtitle,classtitle);							
				if(cityid==classtitle){
					citySelect.options[i].selected=true;
				}
			}
		},
    onFailure: function(){ alert('Something went wrong...') }
  });
}
////////////////////////	
function getCatalogs(pid,cid){
new Ajax.Request('/member/getchilds.asp?classid='+pid,
  {
    method:'get',
    onSuccess: function(transport){
      var response = transport.responseXML.documentElement;
			var classidList = response.getElementsByTagName('catalog');	
			var childs=$('CatalogId');
			for(var i=0;i<classidList.length;i++){
				xx=classidList[i].getElementsByTagName('id');
				yy=classidList[i].getElementsByTagName('title');
				classid=xx[0].firstChild.data
				classtitle=yy[0].firstChild.data				
				childs.options[i]=new Option(classtitle,classid);							
				if(cid==classid){
					childs.options[i].selected=true;
				}
			}
    },
    onFailure: function(){ alert('Something went wrong...') }
  });
}
</script>
</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top">
	<%
dim act,id
if(isnumeric(request.QueryString("id"))) then
	id=Clng(request.QueryString("id"))
else
	response.Write("id is null.")
	response.End()
end if
act=request.querystring("act")
if(act="do") then
	call mod_personalinfook()
	response.write("<div align=""center"">成功修改信息</p>")
	response.write("<p align=""center""><a href=""javascript:history.go(-2)"">返回</a></p>")
else
	call mod_personalinfo()
end if
%>    </td>
  </tr>
</table>
<%
sub mod_personalinfook
	dim rs,InfoTypeId,ParentId,CatalogId,DelPass,Title,ExpireDate,ItemsNum,Price,Province,City,ContactMan,Tel,Mobile,QQ,Content,Photo,SavePath,Demons,Address,Color,Area,Score,ScoreEndDate
	Color=request.Form("Color")
	InfoTypeId=Cint(request.Form("InfoTypeId"))
	ParentId=Cint(request.form("ParentId"))
	if(isnumeric(request.Form("CatalogId"))) then
		CatalogId=Cint(request.Form("CatalogId"))
	else
		CatalogId=0
	end if
	Title=tohtml2(request.Form("Title"))
	Price=Csng(request.form("Price"))
	Province=request.Form("Province")
		if(Province<>"") then
			Province=Cint(Province)
		else
			Province=0
		end if
		City=request.Form("City")
		if(City<>"") then
			City=Cint(City)
		else
			City=0
		end if
		if(Province>0) then
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select title from t_area where id="&Province,conn,3,1
			if not rs.eof then
				Area=rs(0)
			end if
			rs.close
			set rs=nothing
		end if
		if(City>0) then
			set rs=server.CreateObject("adodb.recordset")
			rs.open "select title from t_area where id="&City,conn,3,1
			if not rs.eof then
				Area=Area&rs(0)
			end if
			rs.close
			set rs=nothing
		end if
	ContactMan=tohtml2(request.Form("ContactMan"))
	Tel=tohtml2(request.Form("Tel"))
	QQ=tohtml2(request.Form("QQ"))
	Content=request.Form("content")
	Demons=request.Form("Demons")
	Photo=request.Form("Photo")
	Address=request.Form("Address")
	Score=Cint(request.Form("Score"))
	if isdate(request.Form("ScoreEndDate")) then
		ScoreEndDate=Cdate(request.Form("ScoreEndDate"))
	else
		ScoreEndDate=date()
	end if
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from t_info where id="&id,conn,3,3
	rs("InfoTypeId")=InfoTypeId
	rs("ParentId")=ParentId
	rs("CatalogId")=CatalogId	
	rs("Photo")=Photo
	rs("Title")=Title
	rs("Color")=Color
	rs("Price")=Price
	rs("Province")=Province
	rs("City")=City
	rs("ContactMan")=ContactMan
	rs("QQ")=QQ
	rs("Tel")=Tel	
	rs("Content")=Content
	rs("Demons")=Demons
	rs("PubDate")=now()
	rs("IsCheck")=1
	rs("Address")=Address
	rs("Area")=Area
	rs("Score")=Score
	rs("ScoreEndDate")=ScoreEndDate
	rs.update
	rs.close
	set rs=nothing
end sub
sub mod_personalinfo
	dim rs,userinfo,sql
	set rs=server.CreateObject("adodb.recordset")
	sql="select id,title from catalogs where parentid="&PlugIn_InfoId&" order by title asc"
	rs.open sql,conn,3,1
	if not rs.eof and not rs.bof then
		first=rs.GetRows()
	else
		
	end if
	rs.close
	set rs=nothing
	sql="select * from t_info where  id="&id
	set rs=server.CreateObject("adodb.recordset")
	rs.open sql,conn,3,1
	if not rs.eof then		
%>
<form id="PostForm" name="PostForm" method="post" action="?act=do&id=<%=id%>">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
  <tr>
    <td height="28" colspan="2" bgcolor="#FF9900" class="th_title style2"><div align="center">修改交易信息</div></td>
  </tr>
  <tr>
    <td class="td_row">信息类别：</td>
    <td class="td_row">
	<select name="InfoTypeId" id="InfoTypeId">
		<option value="1" <%if(rs("InfoTypeId")=1) then response.write("selected=""selected""") end if%>>供</option>
		<option value="2" <%if(rs("InfoTypeId")=2) then response.write("selected=""selected""") end if%>>求</option>
    </select>    </td>
  </tr>
  <tr>
    <td class="td_row">信息分类：</td>
    <td class="td_row">
		<select name="ParentId" id="ParentId" onchange="getCatalogs(this.options[this.selectedIndex].value,0)">
		<%
		dim sele
		for i=0 to ubound(first,2)
				if(first(0,i)=rs("ParentId")) then
					sele="selected"
				else
					sele=""
				end if
				response.Write("<option value="&first(0,i)&" "&sele&">"&first(1,i)&"</option>"&Chr(10))    	
  	next	
		%>
    </select>		
		<select name="CatalogId" id="CatalogId">
			<option>请选择二级分类</option>
		</select>
		<script type="text/javascript">
		getCatalogs(<%=rs("ParentId")%>,<%=rs("CatalogId")%>);	
		</script>    </td>
  </tr>
  <tr>
    <td class="td_row">标题：(<span class="style1">*</span>)</td>
    <td class="td_row"><input name="Title" type="text" id="Title" size="32" class="validate-title" value="<%=rs("Title")%>" title="请输入信息标题" /><span id="advice-validate-title-Title" style="display:none;">标题5-30个字符</span>色彩&nbsp;
      <input type="text" size="8" name="Color" value="<%=rs("Color")%>" />
&nbsp;
<input type="button" name="title_colors" value="选色" onclick="OpenWindowAndSetValue('editor/selcolor.htm',230,190,window,document.PostForm.Color);" /></td>
  </tr>
	<tr>
	  <td class="td_row">图片：</td>
	  <td class="td_row"><input name="Photo" type="text" id="Photo" value="<%=rs("Photo")%>" size="30" />
      <input type="button" name="Button" value="上传-&gt;" onclick="javascript:document.PostForm.Photo.value=window.showModalDialog('upimg.htm','','dialogHeight:130px;dialogWidth:410px;help:no;status:no;scroll:no')" /></td>
	  </tr>
	<tr>
    <td width="18%" class="td_row">价格：(<span class="style1">*</span>)</td>
    <td width="82%" class="td_row"><input name="Price" type="text" id="Price" class="validate-number" value="<%=rs("Price")%>" size="8" /><span id="advice-validate-number-Price" style="display:none;">请输入数字</span></td>
  </tr>
    <tr>
    <td class="td_row">地区：</td>
    <td class="td_row">
 
  <select name="Province" id="Province" onchange="GetChilds(this.options[this.selectedIndex].value,0,'City')">
        <option value="0">选择城市</option>
        <script type="text/javascript">
				document.write(GetFirst(<%=rs("Province")%>,''));
        </script>
      </select>
      <select name="City" id="City">
        <option value="0">选择地区</option>
      </select>	
      <script type="text/javascript">
				GetChilds(<%=rs("Province")%>,<%=rs("City")%>,'City');
      </script>
  </td>
  </tr>
  <tr>
    <td class="td_row">联系人：(<span class="style1">*</span>)</td>
    <td class="td_row"><input name="ContactMan" type="text" id="ContactMan" value="<%=rs("ContactMan")%>" class="required" /><span id="advice-required-ContactMan" style="display:none;">联系人不能为空!</span></td>
  </tr>
  <tr>
    <td class="td_row">电话：(<span class="style1">*</span>)</td>
    <td class="td_row"><input name="Tel" type="text" value="<%=rs("Tel")%>" class="required" /><span id="advice-required-Tel" style="display:none;">电话不能为空!</span></td>
  </tr>
  <tr>
    <td class="td_row">地址：</td>
    <td class="td_row"><input name="Address" type="text" id="Address" value="<%=rs("Address")%>" size="32" /></td>
  </tr>
  <tr>
    <td class="td_row">QQ：</td>
    <td class="td_row"><input name="QQ" type="text" value="<%=rs("QQ")%>" /></td>
  </tr>
  <tr>
    <td class="td_row">描述：</td>
    <td class="td_row"><textarea name="Demons" id="Demons" cols="55" rows="5"><%=rs("Demons")%></textarea></td>
  </tr>
  <tr>
    <td class="td_row">详细说明：</td>
    <td class="td_row"><textarea name="content" style="display:none; "><%=rs("Content")%></textarea>
	    <IFRAME ID="eWebEditor1" src="webedit/editor.html" frameborder="0" scrolling="no" width="98%" height="350"></IFRAME><span id="advice-validate-content-Content" style="display:none;">详细说明10-2000字!</span></td>
  </tr>
  <tr>
    <td class="td_row">竞价：</td>
    <td class="td_row"><INPUT name="Score" id="Score" onBlur="if(this.value==''){this.value=0}" onClick="if(this.value=='0'){this.value=''}" onKeyUp="this.value=this.value.replace(/\D/g,'');if(this.value!='' && this.value.charAt(0)=='0'){this.value=''}" value="<%=rs("Score")%>" size="15" maxlength="50" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/\D/g,''))">
      积分</td>
  </tr>
  <tr>
    <td class="td_row">竞价有效期至：</td>
    <td class="td_row"><input name="ScoreEndDate" type="text" id="ScoreEndDate" onclick="setday(this)" value="<%=rs("ScoreEndDate")%>" readonly />
      （注:信息过期，竞价费用自动清0）</td>
  </tr>
  <tr>
    <td class="td_row">&nbsp;</td>
    <td class="td_row"><input type="submit" name="Submit" value="确 定" />
      <input type="reset" name="Submit2" value="取 消" /></td>
  </tr>
</table>
</form>
<%
	end if
	rs.close
	set rs=nothing
end sub
%>
</body>
</html>
<%
call connclose()
%>