<!--#include file="../inc/Conn.asp"-->
<!--#include file="../inc/base64.asp"-->
<!--#include file="../inc/Function.asp"-->
<!--#include file="loginisok.asp"-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>修改信息 - <%=Dream_SiteTitle%></title>
<meta name="keywords" content="<%=Dream_SiteKeywords%>" />
<meta name="description" content="<%=Dream_SiteDescription%>" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes" />
<meta name="format-detection" content="telephone=no" />
<link rel="stylesheet" href="../css/style_guolv.css" />
<script type="text/javascript" src="../js/zepto.min.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery.wallform.js"></script>
<script type="text/javascript">
$(function(){
	$('#photoimg').die('click').live('change', function(){
		var imgnum=1
		if($("#preview div").length<imgnum){
		var status = $("#up_status");
		var btn = $("#up_btn");		
		$("#imageform").ajaxForm({
			target: '#preview', 
			beforeSubmit:function(){
				status.show();
				btn.hide();
			}, 
			success:function(){
				status.hide();
				btn.show();
			}, 
			error:function(){
				status.hide();
				btn.show();
		}}).submit();		
		}else{
		alert("最多只能上传"+imgnum+"传图片!");
		}
	});
});
</script>
<script>
$(document).ready(function(){
  $("button").live("click",function(){
  var imgid=$(this).val();
  //alert($(this).attr("name"));
  var buttonname=$(this).attr("name");
  var imgsrc=$("#"+imgid+" img").attr("src");
  if ($(this).attr("name")=="del"){  
	  $.get("delimg.asp?src="+imgsrc,function(data,status){if(data){alert(data);}});
	  $("#"+imgid+"").remove();  
  }
  });
  $('#button').click(function (){$("#picurl").html($("#preview").html());});
});
</script>
</head>
<body>
<section>
<header id="hd" bk="tuan_m_detail_top">
    <!-- 文本title -->
    <h1 class="txt-title">修改信息</h1>
    <div class="left_an"><a href="#" class="btn1 ret-btn" bk="tuan_m_detail_back">返回</a> <a href="index.asp" class="btn2">首页</a></div><div class="right_an"><%if session("Dream_UserName")<>"" then%><a href="user.asp" class="btn3">会员中心</a><%else%><a href="reg.asp" class="btn1">注册</a> <a href="login.asp" class="btn2">登录</a><%end if%></div></header>
  <script type="text/javascript">
    
    // History, by lww, 2013/09/02
    ;(function($){
        if(!$) { return; }
        if( history.length > 1){
            $("#hd .ret-btn").show();
        }
        else {
            $("#hd .ret-btn").hide();
        }

        $("#hd .ret-btn").click(function(e){
            e.preventDefault();
            if( history.length > 1 ) {
                history.back();
            }
        });
    })(Zepto);
    
</script>
<div id="content">
<div class="visa_t"><h3>修改信息</h3><span>注意：图片格式gif,jpg,bmp,jpeg,png。</span></div>
<%
id=request("id")
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.open "Select * From Dream_Menpiao where Dream_UserID='"&session("Dream_UserName")&"' and id="&id,conn,1,3
if not rs.eof then

imgurl=rs("Dream_DefaultPicUrl")
if imgurl<>"" then
imgurl="../"&imgurl
end if
p_title=rs("Dream_Title")
p_titlecon=rs("Dream_TitleCon")
p_area=rs("Dream_Area")
p_theme=rs("Dream_Theme")
p_address=rs("Dream_Address")
p_phone=rs("Dream_Phone")
p_qq=rs("Dream_QQ")
p_mapurl=rs("Dream_MapUrl")
p_content=rs("Dream_content")
p_content3=rs("Dream_content3")
p_content4=rs("Dream_content4")
else
response.Redirect "listinfo.asp"
end if
session("imgurlstr")=imgurl
%>
<div class="reg">

<form id="imageform" name="form1" method="post" enctype="multipart/form-data" action="upfile1.asp">
<div class="updemo"><div id="up_status" style="display:none"><img src="loader.gif" alt="uploading"/></div>
<div id="up_btn" class="btn">
	<span>添加缩略图</span>
	<input id="photoimg" type="file" name="photoimg">
</div>
</div>	
</form>
<div id="preview"><%if imgurl<>"" then%><div id="img0"><img src="<%=imgurl%>"><br><button value="img0" name="del">删除</button></div><%end if%></div>
<ul>
<form name="form1" method="post" action="addinfo_ok.asp?action=editinfo">
<input name="id" type="hidden" value="<%=rs("id")%>">
<textarea name="picurl" id="picurl" style="display:none"></textarea>
<li><span>所属地区：</span>
<select name="p_area" id="p_area">
  	<option value="请选择">选择地区</option>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from Dream_Area where Dream_ClassID=0 order by Dream_Zid asc"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
do while not rs.eof
%>
	<option value="<%=rs("id")%>" <%if p_area=rs("id") then%> selected<%end if%>> + <%=rs("Dream_Names")%></option>
<%
	set rss=server.CreateObject("adodb.recordset")
	sqls="select * from Dream_Area where Dream_ClassID="&rs("id")&" order by Dream_Zid asc"
	rss.open sqls,conn,1,1
	if not(rss.eof and rss.bof) then
	do while not rss.eof
	%>
	<option value="<%=rss("id")%>" <%if p_area=rss("id") then%> selected<%end if%>> --- <%=rss("Dream_Names")%></option>
	<%
	rss.movenext
	loop
	end if
	rss.close
	set rss=nothing 
rs.movenext
loop
else
%>
	<option value="0">暂无分类</option>
	<%
end if
rs.close
set rs=nothing
%>
</select></li>
<li><span>所属分类：</span><select name="p_theme" id="p_theme">
<option value="请选择">选择分类</option>
<%
set rs=server.CreateObject("adodb.recordset")
sql="select * from Dream_Theme where Dream_ClassID=0 order by Dream_Zid asc"
rs.open sql,conn,1,1
if not(rs.eof and rs.bof) then
do while not rs.eof
%>
	<option value="<%=rs("id")%>" <%if p_theme=rs("id") then%> selected<%end if%>> + <%=rs("Dream_Names")%></option>
<%
	set rss=server.CreateObject("adodb.recordset")
	sqls="select * from Dream_Theme where Dream_ClassID="&rs("id")&" order by Dream_Zid asc"
	rss.open sqls,conn,1,1
	if not(rss.eof and rss.bof) then
	do while not rss.eof
	%>
	<option value="<%=rss("id")%>" <%if p_theme=rss("id") then%> selected<%end if%>> --- <%=rss("Dream_Names")%></option>
	<%
	rss.movenext
	loop
	end if
	rss.close
	set rss=nothing 
rs.movenext
loop
else
%>
	<option value="0">暂无分类</option>
	<%
end if
rs.close
set rs=nothing
%>
</select></li>
<li><span>标题：</span><input type="text" name="p_title" id="p_title" class="input_1" value="<%=p_title%>"></li>
<li><span>简要：</span><input type="text" name="p_titlecon" id="p_titlecon" class="input_1" value="<%=p_titlecon%>"></li>
<li><span>电话：</span><input type="text" name="p_phone" id="p_phone" class="input_1" value="<%=p_phone%>"></li>
<li><span>QQ：</span><input type="text" name="p_qq" id="p_qq" class="input_1" value="<%=p_qq%>"></li>
<li><span>地址：</span><input type="text" name="p_address" id="p_address"  class="input_1" value="<%=p_address%>"></li>
<li><span>地图链接：</span><input type="text" name="p_mapurl" id="p_mapurl" class="input_1" value="<%=p_mapurl%>"></li>
<li class="nop"><span>优惠信息：</span><textarea name="p_content4" rows="4" id="p_content4"><%=p_content4%></textarea></li>
<li class="nop"><span>温馨提示：</span><textarea name="p_content" rows="4" id="p_content"><%=p_content%></textarea></li>
<li class="nop"><span>商家介绍：</span><textarea name="p_content3" rows="4" id="p_content3"><%=p_content3%></textarea></li>
<input type="hidden" name="p_ceshi">
<li class="an">
   <input type="submit"  id="button" value="修改名片" class="input_an" >
 </li>
</form>
</ul>
</div>
</div>
<!--#include file="footer.asp"-->
</section>
<script>
$('#button').click(function () {
	var p_area = $('#p_area').val();
	var p_theme = $('#p_theme').val();
	var p_title = $('#p_title').val();
	if (p_area == "请选择") {
		alert("请选择所属地区");
		return false;
	}
	if (p_theme == "请选择") {
		alert("请选择所属分类");
		return false;
	}	
	if (p_title.length<1) {
		alert("标题不能为空");
		return false;
	}
});	
</script>
</body>
</html>
