<!--#include file="conn.asp"-->
<!--#include file="inc/function.asp"-->
<%
Dim m,askid,rs,askuser,asktime,ansNum,title,xShang,uScore
m=Trim(Request.QueryString("m"))
askid=Trim(Request.QueryString("id"))

Dim AskD
Set AskD = Server.CreateObject("KwAsk.FunAsk")
opendb
	set AskD.myConn =conn
	AskD.myPredb =predb
	AskD.Getsetting()
	siteinfo=AskD.siteinfo
	setting=AskD.setting
	
set rs=conn.execute("select title,askuser,asktime,xShang,ansNum from "&predb&"ask where askid="&askid)
    title=rs("title")
    askuser=rs("askuser")
	asktime=rs("asktime")
	xShang=rs("xShang")
	ansNum=rs("ansNum")
set rs=nothing

if Request.Cookies("Muser")<>cstr(askuser) then
   Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""您没有操作权限！"");</script>")
   Response.End()
end if

select case m
   case "no"
   call nop()
   case "end"
   call ends()
   case "tg"
   call tg()
   case "tgs"
   call tgs()
end select

set AskD.myConn =Nothing
Closedb
Set AskD = Nothing

sub tgs()
  xShang=Trim(Request.Form("xShang"))
  if xShang<>"" then
      conn.execute("update "&predb&"ask set xShang="&xShang&" where askid="&askid)
      Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""提高悬赏操作成功！"");setTimeout(""window.parent.location.reload()"",1000);</script>")
  else
      Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""悬赏分值有误或你的积分不够！"");setTimeout(""window.parent.location.reload()"",1000);</script>")
  end if
end sub

sub tg()
%>
<!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" />
</head>
<body>
<div class="shortbox">
<form action="?id=<%= askid %>&m=tgs" method="post">
		<fieldset class="a_f">
			<legend class="a_l">问题标题</legend>
			<div class="a_d"><%= title %></div>
		</fieldset>
		<fieldset class="a_p">
			<legend class="a_l">提高悬赏分</legend>
			<div class="a_l">当前悬赏分：<%= xShang %></div>
            <div class="a_l">新悬赏分：
            <select name="xShang" id="xShang">
            <%= xsFen %>
            </select>
            </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

sub ends()
   If ansNum=0 Then
      conn.execute("update "&predb&"ask set State=3 where askid="&askid)
      Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""撤销问题操作成功！"");setTimeout(""window.parent.location.reload()"",1000);</script>")
   else
   Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""已有回答，请到期前选择无满意答案！"");</script>")
   End IF
end sub

sub nop()
   If DateDiff("d",AskTime,now())>=setting(27)-3 Then
      conn.execute("update "&predb&"ask set State=8 where askid="&askid)
      Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""无满意答案操作成功！"");setTimeout(""window.parent.location.reload()"",1000);</script>")
   else
   Response.Write("<script>var a = new parent.xWin(""1"",240,100,"""&siteInfo(4)&""",""尚未可以选择无满意答案！"");</script>")
   End IF
end sub
%>
