<%@ LANGUAGE=VBScript CodePage=65001%>
<% response.charset="utf-8" %>
<% session.codepage=65001 %>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!--#include file="../LyricInc/access.asp"  -->
<!-- #include file="LyricInc/functions.asp" -->
<!-- #include file="../LyricInc/rand.asp" -->
<!-- #include file="../LyricInc/x_to_html/index_to_html.asp" -->
<!-- #include file="../LyricInc/x_to_html/Feed_List_to_html.asp" -->
<!-- #include file="../LyricInc/x_to_html/Feed_to_html.asp" -->

<% '更新数据到数据表
page=request.querystring("page")
act=request.querystring("act")
keywords=request.querystring("keywords")
article_id=cint(request.querystring("id"))
cidx=request("cid")
pidx=request("pid")
ppidx=request("ppid")

act1=Request("act1")
If act1="save" Then 
a_id=cint(request.form("a_id"))
a_title=request.form("a_title")
a_author=request.form("a_author")
a_cid=trim(request.form("cid"))
a_pid=trim(request.form("pid"))
a_ppid=trim(request.form("ppid"))
a_image=trim(request.form("web_image"))
a_keywords=trim(request.form("a_keywords"))
a_description=trim(request.form("a_description"))
a_content=request.form("a_content")
a_person=request.form("a_person")
a_address=request.form("a_address")
a_tel=request.form("a_tel")
a_email=request.form("a_email")
a_qq=request.form("a_qq")
a_hit=trim(request.form("a_hit"))
a_index_push=trim(request.form("a_index_push"))
a_time=request.form("a_time")


set rs=server.createobject("adodb.recordset")
sql="select * from [web_info] where id="&a_id&""
rs.open(sql),cn,1,3
content1=rs("content")
ViewYes1=rs("View_yes")
rs("cid")=a_cid
rs("pid")=a_pid
rs("ppid")=a_ppid
rs("ReContent")=a_content
rs("hit")=a_hit
rs("index_push")=a_index_push
rs("time")=a_time
rs("edit_time")=now()
rs.update
rs.close
set rs=nothing
%>
<% 
If ViewYes1=1 Then
call Feed_to_html(a_id)
End if
ClassID=a_cid
Call index_to_html()
call Feed_list_to_html(ClassID)

'Mobile Html Start
If web_Show=0 then
%>
<!-- #include file="../LyricInc/m_x_to_html/index_to_html.asp" -->
<!-- #include file="../LyricInc/m_x_to_html/Feed_to_html.asp" -->
<!-- #include file="../LyricInc/m_x_to_html/Feed_list_to_html.asp" -->
<%
call Feed_to_MHtml(a_id)
call index_to_MHtml()
call Feed_list_to_MHtml(ClassID)
End If
'Mobile Html End

%>
<%
'GovPet Mail System Check Start
if ReplyMessageYes=1 then
''=========利用Jmail在线发送邮件函数 start=============
Function sendjmail(t1,t2,t3)
't1:接收邮件地址 t2:接收邮件用户名 t3:邮件正文
dim jmail
set jmail=server.createobject("Jmail.message")
jmail.silent=true
jmail.charset="gb2312"
jmail.ContentType = "text/html"

'发件人邮箱
jmail.from=MailAddress
'发件人名称
jmail.fromname=MailSentName
'收件人邮箱,姓名  
jmail.AddRecipient t1,t2
'邮件的紧急程度，1最快，5最慢
jmail.Priority=MailEmergency
'发送邮件标题
jmail.subject="您在 "&web_name&" 上发表的留言有了答复哦"
'指定别的回信地址   
JMail.ReplyTo=MailAddress

JMail.HTMLBody = "<html><head><meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312""><style type=text/css>A:link { FONT-SIZE: 10pt; TEXT-DECORATION: none; color: #000000}A:visited {FONT-SIZE: 10pt; TEXT-DECORATION: none; color: #666666}A:hover {COLOR: #ff6600; FONT-SIZE:14pt; TEXT-DECORATION: underline}BODY {FONT-SIZE: 9pt} --></style></head><body><br>"&t3&"</body></html>"

jmail.mailserverusername=MailName       '邮件发送服务器登录名称
jmail.mailserverpassword=MailPassword       '邮件发送服务器登录密码
sendok=jmail.send(MailSmtp)         'smtp服务器名称

if sendok then
'response.write "恭喜您，"&t1&"邮件发送成功！"&NOW()
else
'response.write "对不起，邮件发送失败，可能由于服务器登录设置不当或信息有误！"&NOW()
end if

jmail.Close
set jmail=nothing
End Function
''=========利用Jmail在线发送邮件函数 end=============

''调用上面定义的函数发送邮件的方法
MailDetails=MailDetails&"<table cellpadding='0' cellspacing='0' width='700' align='center' style='font-family:Microsoft Yahei,Verdana,Arial;'>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='background:#4169E1;line-height:45px;font-size:16px;font-weight:bold;color:#FFFFFF;font-family:'黑体';'>&nbsp;&nbsp;"&web_name&" -- GovPet Mail System </td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='border:#CCCCCC 1px solid;padding:20px 20px 20px 20px;line-height:180%;font-size:13px;'>"
MailDetails=MailDetails&"<strong>您好,您在"&web_name&" 网站上的留言有了回复：</strong><br />"
MailDetails=MailDetails&"<br />"
MailDetails=MailDetails&"<strong>您的留言：</strong>"&content1&"<br />"
MailDetails=MailDetails&"<strong>答复时间：</strong>"&now()&"<br />"
MailDetails=MailDetails&"<strong><span style='color:#FF0000'>答复内容：</span></strong><span style='color:#3aa704'>"&a_content&"</span><br />"
MailDetails=MailDetails&"欢迎登录 <a href='"&web_url&"' target='_blank'>"&web_url&"</a>查看更多相关信息，与我们取得进一步联系。<br />"
MailDetails=MailDetails&"</td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='background:#333333;padding:10px;line-height:180%;font-size:12px;color:#FFFFFF;'>请注意：此邮件系 <a href='"&web_url&"' target='_blank' style='color:#FFFFFF;'>"&web_name&"</a> 自动发送，请勿直接回复。<br>如果此邮件不是您请求的，请忽略并删除！</td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"<tr>"
MailDetails=MailDetails&"<td style='background:#333333;padding:5px;line-height:180%;font-size:10px;color:#494949;'>Powered By <a href='http://www.GovPet.com/' target='_blank' style='color:#494949;'>GovPet Mail System</a> All Rights Reserved</td>"
MailDetails=MailDetails&"</tr>"
MailDetails=MailDetails&"</table>"

response.write sendjmail(ReceiveMailAddress,name1,MailDetails)
end if
'GovPet Mail System Check End

response.Write "<script language='javascript'>alert('提交成功！');location.href='info_list.asp?page="&page&"&act="&act&"&cid="&cidx&"&pid="&pidx&"&ppid="&ppidx&"&keywords="&keywords&"';</script>"
end if 
%>
    <script type="text/javascript" charset="utf-8" src="GPEdt/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="GPEdt/ueditor.all.min.js"> </script>
    <script type="text/javascript" charset="utf-8" src="GPEdt/lang/zh-cn/zh-cn.js"></script>

 <!-- 三级联动菜单 开始 -->
<script language="JavaScript">
<!--
<%
'二级数据保存到数组
Dim count2,rsClass2,sqlClass2
set rsClass2=server.createobject("adodb.recordset")
sqlClass2="select id,pid,ppid,name from [category] where ppid=2 order by [Order] " 
rsClass2.open sqlClass2,cn,1,1
%>
var subval2 = new Array();
//数组结构：一级根值,二级根值,二级显示值
<%
count2 = 0
do while not rsClass2.eof
%>
subval2[<%=count2%>] = new Array('<%=rsClass2("pID")%>','<%=rsClass2("ID")%>','<%=rsClass2("Name")%>')
<%
count2 = count2 + 1
rsClass2.movenext
loop
rsClass2.close
%>

<%
'三级数据保存到数组
Dim count3,rsClass3,sqlClass3
set rsClass3=server.createobject("adodb.recordset")
sqlClass3="select id,pid,ppid,name from [category] where ppid=3 order by [Order]" 
rsClass3.open sqlClass3,cn,1,1
%>
var subval3 = new Array();
//数组结构：二级根值,三级根值,三级显示值
<%
count3 = 0
do while not rsClass3.eof
%>
subval3[<%=count3%>] = new Array('<%=rsClass3("pID")%>','<%=rsClass3("ID")%>','<%=rsClass3("Name")%>')
<%
count3 = count3 + 1
rsClass3.movenext
loop
rsClass3.close
%>

function changeselect1(locationid)
{
    document.form1.pid.length = 0;
    document.form1.pid.options[0] = new Option('选择二级分类','');
    document.form1.ppid.length = 0;
    document.form1.ppid.options[0] = new Option('选择三级分类','');
    for (i=0; i<subval2.length; i++)
    {
        if (subval2[i][0] == locationid)
        {document.form1.pid.options[document.form1.pid.length] = new Option(subval2[i][2],subval2[i][1]);}
    }
}

function changeselect2(locationid)
{
    document.form1.ppid.length = 0;
    document.form1.ppid.options[0] = new Option('选择三级分类','');
    for (i=0; i<subval3.length; i++)
    {
        if (subval3[i][0] == locationid)
        {document.form1.ppid.options[document.form1.ppid.length] = new Option(subval3[i][2],subval3[i][1]);}
    }
}
//-->
</script><!-- 三级联动菜单 结束 -->
	<%
Call header()

%>

<%
			set rs=server.createobject("adodb.recordset")
sql="select * from [web_info] where id="&article_id&""
rs.open(sql),cn,1,1
if not rs.eof and not rs.bof then
%>  <form id="form1" name="form1" method="post" action="?act1=save&cid=<%=request("cid")%>&pid=<%=request("pid")%>&ppid=<%=request("ppid")%>&page=<%=page%>&act=<%=act%>&keywords=<%=keywords%>">
         <script language='javascript'>
function checksignup1() {

if ( document.form1.cid.value == '' ) {
window.alert('请选择分类^_^');
document.form1.cid.focus();
return false;}

return true;}
</script>
	<table cellpadding='3' cellspacing='0' border='0' class='tableBorder' align=center>
	<tr>
	  <th class='tableHeaderText' colspan=2 height=25>回复留言</th>
	<tr>
	<td width="15%" height=23 class='forumRowHighLight'>信件编号</td>
	<td class='forumRowHighLight'><%=rs("PetID")%>
	  &nbsp;</td>
	</tr>
	<tr>
	<td width="15%" height=23 class='forumRow'>主题  </td>
	<td class='forumRow'><%=rs("title")%>
	<input name='a_id' type='hidden' id='a_id' value="<%=rs("id")%>" size='70'>
	  &nbsp;</td>
	</tr>
	<tr>
	<td class='forumRowHighLight' height=23>分类</td>
    <td class='forumRowHighLight'><%
set rsc1=server.createobject("adodb.recordset")
sqlClass1="select id,pid,ppid,name from category where ppid=1 and ClassType=4 order by [Order]" 
rsc1.open sqlClass1,cn,1,1
%>
            <select name="cid" id="cid" onChange="changeselect1(this.value)">
              <% '输出一级分类，并选定当前分类
count1 = 0
do while not rsc1.eof
%><option value="<%=rsc1("ID")%>"  <%if cint(rs("cid"))=rsc1("id") then
response.write "selected"
end if%>><%=rsc1("Name")%></option>
<%count1 = count1 + 1
rsc1.movenext
loop
rsc1.close
%>
            </select>
            &nbsp;&nbsp;
	
            <select name="pid" id="pid"  onchange="changeselect2(this.value)">
              <option value="">选择二级分类</option>
			 		<%'输出二级分类，并选定当前分类
			
set rsc2=server.createobject("adodb.recordset")
sqlClass2="select id,pid,ppid,name from category where ppid=2 and ClassType=4 and pid="&cint(rs("cid"))&" order by [Order]" 
rsc2.open sqlClass2,cn,1,1

count1 = 0
do while not rsc2.eof
%><option value="<%=rsc2("ID")%>"  <%
if rs("pid")<>"" then
if cint(rs("pid"))=rsc2("id") then
response.write "selected"
end if
end if%>><%=rsc2("Name")%></option>
<%count1 = count1 + 1
rsc2.movenext
loop
rsc2.close

%>
            </select>
            &nbsp;&nbsp;
				
            <select name="ppid" id="ppid">
              <option value="">选择三级分类</option>
			  			  		<% '输出三级分类，并选定当前分类
			if rs("pid")<>"" then				
set rsc3=server.createobject("adodb.recordset")
sqlClass3="select id,pid,ppid,name from category where ppid=3 and ClassType=4 and pid="&cint(rs("pid"))&" order by [Order]" 
rsc3.open sqlClass3,cn,1,1

count1 = 0
do while not rsc3.eof
%><option value="<%=rsc3("ID")%>"  <%
	if rs("ppid")<>"" then
if cint(rs("ppid"))=rsc3("id") then
response.write "selected"
end if
end if
%>><%=rsc3("Name")%></option>
<%count1 = count1 + 1
rsc3.movenext
loop
rsc3.close
end if
%>
            </select>&nbsp;</td>
	</tr>	

	<tr>
	<td width="15%" height=23 class='forumRowHighLight'>姓名</td>
	<td class='forumRowHighLight'><%=rs("PetName")%>
	  &nbsp;</td>
	</tr>
	<tr>
	<td width="15%" height=23 class='forumRow'>电话</td>
	<td class='forumRow'><%=rs("PetTel")%>
	  &nbsp;</td>
	</tr>
	<tr>
	<td width="15%" height=23 class='forumRowHighLight'>邮件</td>
	<td class='forumRowHighLight'><%=rs("PetEmail")%>
	  &nbsp;</td>
	</tr>
	<tr>
	<td width="15%" height=23 class='forumRow'>内容</td>
	<td class='forumRow'><%=rs("Content")%>
	  &nbsp;</td>
	</tr>				
	<tr>
	  <td class='forumRow' height=23>回复 </td>
	  <td class='forumRow'>
		<script type="text/plain" id="myEditor" style="width:100%; height:400px" name="a_content"><%=rs("ReContent")%></script>
		<script type="text/javascript">    var editor_a = UE.getEditor('myEditor');</script>
      </textarea>
</td>
	</tr>
	<tr>
	  <td class='forumRow' height=23>浏览次数</td>
	  <td class='forumRow'><input name='a_hit' type='text' id='a_hit' value="<%=rs("hit")%>" size='40'>
      &nbsp;只能是数字</td>
	  </tr>
	<tr>
	  <td class='forumRowHighLight' height=23>添加时间</td>
	  <td class='forumRowHighLight'><span class="forumRow">
	    <input name='a_time' type='text' id='a_time' value="<%=rs("time")%>" size='40'>
	  </span></td>
	</tr>
   	<tr>
	  <td class='forumRowHighLight' height=23>推荐</td>
	  <td class='forumRowHighLight'><label>
	    <input type="radio" name="a_index_push" value="1" <%
		if rs("index_push")=1 then
		response.write "checked"
		end if%>>
      是
      &nbsp;
      <input name="a_index_push" type="radio" value="0" <%if rs("index_push")=0 then
		response.write "checked"
		end if%>>
      否</label></td>
	</tr>	
	<tr><td height="100" colspan=2  class='forumRow2'><div class='ButtonFix' align="center">
	  <INPUT class='GPetSubmit' type=submit value='提 交'  onClick='javascript:return checksignup1()' name=Submit>
	  </div></td></tr>
	</table>
</form>
<%
else
response.write"未找到数据"
end if%>
<%
Call DbconnEnd()
 %>