<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
dim action,id,qid,aUser
action=Trim(Request.QueryString("action"))
id=Trim(Request.QueryString("id"))
qid=Trim(Request.QueryString("qid"))
aUser=Trim(Request.QueryString("aUser"))

Dim AskD
Set AskD = Server.CreateObject("KwAsk.FunAsk")
	opendb
	set AskD.myConn =conn
	AskD.myPredb =predb
	AskD.Getsetting()
	siteinfo=AskD.siteinfo
	setting=AskD.setting
if action="1" then
   call saveadd()
else
   call main()
end if

set AskD.myConn =Nothing
closedb
Set AskD = Nothing

sub saveadd()
   dim endcomm,xjpd,rs,xShang
   set rs=conn.execute("select xShang from "&predb&"ask where askid="&qid)
       xShang=rs("xshang")
   set rs=nothing
   endcomm=Trim(Request.Form("endcomm"))
   endcomm=AskD.HTMLcode(endcomm)
   endcomm=AskD.chkAllow(endcomm,4)
   xjpd=Trim(Request.Form("xjpd"))
   conn.execute("update "&predb&"ans set iscn=1,star="&xjpd&",endcomm='"&endcomm&"' where ansid="&id)
   conn.execute("update "&predb&"ask set state=1,bcnUser="&aUser&",bcnAns="&id&" where askid="&qid)
   conn.execute("update "&predb&"user set Bcn=Bcn+1 where id="&aUser)
   Call AskD.Score(aUser,setting(15)+xshang,"回答被提问者采纳")
   Call AskD.Score(Request.Cookies("Muser"),setting(52),"采纳回答")
   Response.Write("您已经成功采纳答案")
%>
<input type="button" name="button2" id="button2" value="  确 定  " onClick="new parent.dialog().reset();"/>
<%
end sub


sub main()
%>
<!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=utf-8" />
<title>采纳答案</title>
<link href="Template/<%= siteInfo(11) %>/css/style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="JS/MyErr.js"></script>
<script language="javascript">

function ChkPut(put,text,num)
{
	if(put.value.length >num)
	{
		put.value = put.value.substring(0,num);
	}
	else
	{
		text.innerText = num - put.value.length;
	}
}
</script>
</head>
<body>
<div class="shortbox">
<form action="?id=<%= id %>&qid=<%= qid %>&aUser=<%= aUser %>&action=1" method="post" onSubmit="return ChkAsk();">
		<fieldset class="a_p">
			<legend class="a_l">感谢语或对答案的评价</legend>
			<div class="a_c"><textarea name="endcomm" rows="10" style="width:380px;overflow: hidden;" onKeyDown="ChkPut(this,nr,200)" onKeyUp="ChkPut(this,nr,200)"></textarea></div>
		    <div class="a_i">可输入 <b><span id="nr">200</span></b> 字</div>
            <div class="a_c"><font color="#333333">星级评定：</font><input name="xjpd" type="radio" value="1">
            ☆ 
              <input name="xjpd" type="radio" value="2">
              ☆☆ 
              <input name="xjpd" type="radio" value="3" checked>
              ☆☆☆ 
              <input name="xjpd" type="radio" value="4">
              ☆☆☆☆ 
              <input name="xjpd" type="radio" value="5">☆☆☆☆☆</div>
        </fieldset>
            <div class="a_s">
              <input type="submit" name="button" id="button" value=" 提交评价 " /> 
               <input type="button" name="button2" id="button2" value="  取 消  " onClick="new parent.dialog().reset();"/>
            </div>
</form>
</div>
</body>
</html>
<% end sub %>