<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%option explicit%>
<!--#include file="../Conn.asp"-->
<!--#include file="TaskConfig.asp"-->
<!--#include file="../HSK_Cls/HSK.MemberCls.asp"-->
<!--#include file="../HSK_Cls/HSK.SpaceApp.asp"-->
<%
Dim KSCls
Set KSCls = New TaskUserInfo
KSCls.Run()
Set KSCls = Nothing

Class TaskUserInfo
	Private KS,KSUser,ChannelID,ID,ClassID,RS
	Private ComeUrl,Selbutton,LoginTF,ReadPoint,Action,UserName
	Private totalPut,MaxPerPage,TopNum,CurrPage,XML,Node
	Private Sub Class_Initialize()
		MaxPerPage =20			'每页显示多少条
'		TopNum = 100			'查询多少条记录
		Set KS=New PublicCls
		Set KSUser = New UserCls
	End Sub
	Private Sub Class_Terminate()
		Set KS=Nothing
		Set KSUser=Nothing
		Call CloseConn()
	End Sub
	Public Sub Run()
		ComeUrl=Request.ServerVariables("HTTP_REFERER")
		LoginTF=Cbool(KSUser.UserLoginChecked)
		IF LoginTF=false  Then
		  GCls.ComeUrl=GCls.GetUrl()
		  Response.Redirect("/user/login/")
		  Exit Sub
		End If
		UserName = KS.FilterIllegalChar(KS.LoseHtml(KS.R(KS.S("UserName"))))
		IF KS.IsNul(UserName) Then	KS.AlertHistory "提交的参数有误！","-1"
%>
<!--#include file="Template/head.html"-->
<link href="/style/css/UserInfo.css" type="text/css" rel="stylesheet"/>
		<script type="text/javascript">
		 function checkmsg()
		 {
		     var message=escape($("#message").val());
			 var username=escape($("#username").val());
			 if (username==''){
			  alert('参数传递出错!');
			  closeWindow();
			 }
			 if (message==''){
			   alert('请输入消息内容!');
			   $("#message").focus();
			   return false;
			 }
			 $.get("../plus/ajaxs.asp",{action:"SendMsg",username:username,message:message},function(r){
			   r=unescape(r);
			   if (r!='success'){
				alert(r);
			   }else{
				 alert('恭喜，您的消息已发送!');
				 closeWindow();
			   }
			 });
         }
		 function sendMsg(ev,username)
		 {
		  new KesionPopup().popupTips("<img src='../images/user/mail.gif' align='absmiddle'> 发送消息","对方登录后可以看到您的消息(可输入255个字符)<br /><textarea name='message' id='message' style='width:340px;height:80px'></textarea><div style='text-align:center;margin:10px'><input type='button' onclick='return(checkmsg())' value=' 确 定 ' class='button'><input type='hidden' value="+username+" name='username' id='username'> <input type='button' value=' 取 消 ' onclick='closeWindow()' class='button'></div>",354,350)
		 }
        function check()
		{
		
		 var message=escape($("#message").val());
		 var username=escape($("#username").val());
		 if (username==''){
		  alert('参数传递出错!');
		  closeWindow();
		 }
		 if (message==''){
		   alert('请输入附言!');
		   $("#message").focus();
		   return false;
		 }
		 $.get("../plus/ajaxs.asp",{action:"AddFriend",username:username,message:message},function(r){
		   r=unescape(r);
		   if (r!='success'){
		    alert(r);
		   }else{
		     alert('您的请求已发送,请等待对方的确认!');
			 closeWindow();
		   }
		 });
		}
		function addF(ev,username)
		{ 
		 show(ev,username);
		 var isMyFriend=false;
		 $.get("../plus/ajaxs.asp",{action:"CheckMyFriend",username:escape(username)},function(b){
			  if (b=='true'){
			  closeWindow();
			  alert('用户['+username+']已经是您的好友了！');
			  return false;
			 }else if(b=='verify'){
			  closeWindow();
			  alert('您已邀请过['+username+'],请等待对方的认证!');
			  return false;
			 }else{
			   show(ev,username);
			 }
		 });
		 
		}
		function show(ev,username)
		{
		 new KesionPopup().popupTips("<img src='../images/user/log/106.gif'> 添加好友","通过对方验证才能成为好友(可输入255个字符)<br /><textarea name='message' id='message' style='width:340px;height:80px'></textarea><div style='text-align:center;margin:10px'><input type='button' onclick='return(check())' value=' 确 定 ' class='button'><input type='hidden' value="+username+" name='username' id='username'> <input type='button' value=' 取 消 ' onclick='closeWindow()' class='button'></div>",354,350);
		}		 
		</script>
<div class="clear"></div>
<div class="menber_tab">
<div class="dh"><span class="top">刷客基本信息</span></div>

<div class="options">

    <div class="info_l">
          <ul>
            <div align="center"><%
				Set rs = Conn.Execute("Select userid,GroupID,userface,sex,KS_TotalScore,qq,gradetitle,sign,mobile,KS_IDAuthentication From KS_User Where Username='" & UserName & "'")
				IF not rs.eof then
					dim user_face:user_face=rs("userface")
					If user_face="" or isnull(user_face) then 
					if rs("sex")="男" then  user_face="/images/face/boy.jpg" else user_face="/images/face/girl.gif"
					End If
				else
					set rs=nothing
					KS.AlertHistory "提交的参数有误！","-1"
				end if
				If Left(User_Face,1)<>"/" And lcase(left(user_face,4))<>"http" then user_face=KS.Setting(2) & "/" & user_face
				response.write "<a href='" & KS.GetSpaceUrl(rs("userid")) & "' target='_blank'><img src='" & user_face & "' width='140' height='140'/></a>"
			 %><br />
            <div class="userinfomenu"><li><a href="javascript:void(0)" onClick="addF(event,'<%=UserName%>');"><img src="/style/images/adfriend.gif" border="0" align="absmiddle"> 加为好友</a></li><li> <a href="javascript:void(0)" onClick="sendMsg(event,'<%=UserName%>')"><img src="/style/images/sendmsg.gif" border="0" align="absmiddle"> 发站内信</a></li></div>
            </div>
      </ul>
    </div>

    <div class="info_center">
      <ul>
        <li>姓名：<%=UserName%> &nbsp; &nbsp; [<%=KS.U_G(rs("GroupID"),"groupname")%>]</li>
        <li>积分：<%=rs("KS_TotalScore")%> <%=ScoreGradeIco(rs("KS_TotalScore"))%></li>
        <li>头衔：<%=rs("gradetitle")%></li>
        <li>手机认证：<%
IF rs("mobile")<>"" And KS.ChkClng(rs("KS_IDAuthentication"))=1 Then
	KS.Echo "<img src=""/style/images/mobile_1.gif"" align=""absmiddle""><span class=""orange"">已认证</span>"
Else
	KS.Echo "<img src=""/style/images/mobile_2.gif"" align=""absmiddle""><span class=""orange"">未认证</span>"
End IF
%></li>
        <li>个人签名： <%=rs("sign")%><br />
        <a href='<%= KS.GetSpaceUrl(rs("userid")) %>' target='_blank'><img src="/style/images/space_bt.gif" width="120" height="36" style="padding-top:4px;" /></a></li>
      </ul>
    </div>
<% 	set rs=nothing %>
        <div class="info_r">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td>已发布任务数：<span class="orange"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From KS_U_sxyrw Where Inputer='" & UserName & "'")(0))%></span> 条</td>
              <td>被申诉次数：<span class="orange"><%=KS.ChkClng(Conn.Execute("Select Count(ID) from ks_feedback where Object='" & UserName & "'")(0))%></span> 次</td>
            </tr>
            <tr>
              <td>已接手任务数：<span class="orange"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From KS_U_sxyrw Where KS_BuyUserName='" & UserName & "'")(0))%></span> 条</td>
              <td>被拉入黑名单人数：<span class="orange"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From KS_Friend Where Friend='" & UserName & "' And flag=3")(0))%></span> 人</td>
            </tr>
          </table>
          <div>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="center" class="rough">刷客满意度</td>
                <td class="blue">好评<img src="/style/images/emot/haoping.gif" align="absmiddle" /></td>
                <td class="orange">中评<img src="/style/images/emot/zhongping.gif" align="absmiddle" /></td>
                <td class="red">差评<img src="/style/images/emot/chaping.gif" align="absmiddle" /></td>
                <td class="blue rough">好评率</td>
              </tr>
              <tr>
                <td align="center" class="rough">作为发布者：</td>
                <td class="blue"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=2 And HaoPing=1")(0))%></td>
                <td class="orange"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=2 And ZhongPing=1")(0))%></td>
                <td class="red"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=2 And ChaPing=1")(0))%></td>
                <td class="blue rough"><%
				Dim HaoPing,ChaPing
				HaoPing = KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=2 And HaoPing=1")(0))
				ChaPing = KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=2 And ChaPing=1")(0))
				IF HaoPing>0 Then
					KS.Echo Round(HaoPing/(HaoPing + ChaPing),2)*100 & "%"
				Else
					KS.Echo "0"
				End IF
				%></td>
              </tr>
              <tr>
                <td align="center" class="rough">作为接手者：</td>
                <td class="blue"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=1 And HaoPing=1")(0))%></td>
                <td class="orange"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=1 And ZhongPing=1")(0))%></td>
                <td class="red"><%=KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=1 And ChaPing=1")(0))%></td>
                <td class="blue rough"><%
				HaoPing = KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=1 And HaoPing=1")(0))
				ChaPing = KS.ChkClng(Conn.Execute("Select Count(ID) From PingJia Where FriendName='" & UserName & "' And NameType=1 And ChaPing=1")(0))
				IF HaoPing>0 Then
					KS.Echo Round(HaoPing/(HaoPing + ChaPing),2)*100 & "%"
				Else
					KS.Echo "0"
				End IF
				%></td>
              </tr>
              </tr>
            </table>
          </div>
        </div>
  </div>

			<div class="clear"></div>
			<div class="tl_b"></div><div class="tr_b"></div><div class="bl_b"></div><div class="br_b"></div>
</div>

<div class="clear"></div>
  <div class="pinjia_content"> 
	<!-- 列表 -->
	<div class="pinjiaHall">
	  
      
      <ul class="pinjia_tab">
        <li<%If KS.S("tab")="" then response.write " class='current'"%>><a href="UserInfo.asp?UserName=<%=UserName%>"><span>来自接手方的评价</span></a></li>
        <li<%If KS.S("tab")="2" then response.write " class='current'"%>><a href="?UserName=<%=UserName%>&Tab=2"><span>来自发布方的评价</span></a></li>
        <li<%If KS.S("tab")="3" then response.write " class='current'"%>><a href="?UserName=<%=UserName%>&Tab=3"><span>给他人的评价</span></a></li>
<!--        <li<%If KS.S("tab")="3" then response.write " class='current'"%>><a href="?UserName=<%=UserName%>&Tab=3"><span>被他人申诉情况</span></a></li> -->
      </ul>
  
      <div class="clear"></div>

		<!-- 模板列表 -->
	  <div class="Pingjia_list">
	    <table style="border-bottom:1px solid #ACDAFF; margin-bottom:6px;" border="0" cellSpacing="0" cellPadding="4" height="30" width="100%">
		    <tr>
		      <th width="50">序号</th>
		      <th width="120">任务区</th>
		      <th width="120"><%
			  if KS.S("tab")="3" then
			  	  ks.echo "被评价人"
			  elseif KS.S("tab")="2" then
			  	  ks.echo "评价人（发布方）"
			  else
				  ks.echo "评价人（接手方）"
			  end if%></th>
		      <th width="120">评分</th>
		      <th width="120">评价时间</th>
		      <th width="">评价内容</th>
	      </tr>
	    </table>
		  <table class="list_tbl" border="0" cellSpacing="0" cellPadding="4" width="100%">
  <%   	 
  		 CurrPage = KS.ChkClng(KS.CheckXSS(KS.R(KS.S("page"))))
		 If CurrPage<=0 Then CurrPage=1
  		 Dim RS:	Set RS=Server.CreateObject("ADODB.RECORDSET")
		 IF KS.CheckXSS(KS.R(KS.S("tab"))) = "3" Then
		 	 RS.Open "Select * From PingJia Where UserName='" & UserName & "' Order By ID Desc",Conn,1,1
		 ElseIF KS.CheckXSS(KS.R(KS.S("tab"))) = "2" Then
			 RS.Open "Select * From PingJia Where FriendName='" & UserName & "' And NameType=1 Order By ID Desc",Conn,1,1
		 Else
			 RS.Open "Select * From PingJia Where FriendName='" & UserName & "' And NameType=2 Order By ID Desc",Conn,1,1
		 End IF
	 	 If Not RS.Eof Then
			 TotalPut = RS.RecordCount
			 If TotalPut>TopNum And TopNum<>0 Then TotalPut=TopNum
			 If CurrPage >1 and (CurrPage - 1) * MaxPerPage < totalPut Then
					RS.Move (CurrPage - 1) * MaxPerPage
			 Else
					CurrPage = 1
			 End If
			 Set XML=KS.ArrayToXml(RS.GetRows(MaxPerPage),RS,"row","root")
			End If
			RS.Close
			Set RS=Nothing
			
		 	Dim i: i = 1
			If IsObject(XML) Then
			For Each Node In Xml.DocumentElement.SelectNodes("row") %>
		    <tr>
		      <td width="50" align="center"><%=i%></td>
		      <td width="120" align="center"><%=KS.C_C(GetNodeText("tid"),1)%></td>
		      <td width="120" align="center"><%
			  if KS.S("tab")="3" then
				  if KS.ChkClng(GetNodeText("NameType"))=1 then
					KS.Echo "接手人："
				  elseif KS.ChkClng(GetNodeText("NameType"))=2 then
					KS.Echo "发布人："
				  end if
			  end if%><%=GetNodeText("FriendName")%></td>
		      <td width="120" align="center"><%=ChkPingJia()%></td>
		      <td width="120" align="center"><%=GetNodeText("AddDate")%></td>
		      <td width="" align="center"><%=GetNodeText("Content")%>&nbsp;</td>
		   </tr>
		    <%
             i = i + 1
			 Next
		 Else
		 	KS.Echo "<tr><td class=""border"">还没有评价！</td></tr>"
	 	 End If
	 %>
	    </table>
        <%  Call KS.ShowPage(totalput, MaxPerPage, "", CurrPage,false,true)%>
	  </div>
    </div>

<!-- 任务列表结束 -->
</div>

<!--#include file="Template/foot.html"-->
<%
End Sub

Function GetNodeText(NodeName)
	Dim N,Str
	NodeName=Lcase(NodeName)
		If IsObject(Node) Then
		set N=node.SelectSingleNode("@" & NodeName)
		If Not N is Nothing Then Str=N.text
	GetNodeText=Str
	End If
End Function

Function ChkPingJia()
	IF KS.ChkClng(GetNodeText("HaoPing"))=1 Then ChkPingJia = "好评"
	IF KS.ChkClng(GetNodeText("ZhongPing"))=1 Then ChkPingJia = "中评"
	IF KS.ChkClng(GetNodeText("ChaPing"))=1 Then ChkPingJia = "差评"
End Function

'**************************************************
'函数名：ShowPage
'作  用：显示“上一页 下一页”等信息
'参  数：filename文件名 TotalNumber总数量 MaxPerPage每页数量 ShowTurn显示转到 PrintOut立即输出
'**************************************************
Function ShowPage(totalnumber, MaxPerPage, FileName, CurrPage,ShowTurn,PrintOut)
			 Dim n,j,startpage,pageStr,TotalPage,ParamStr
			 If totalnumber Mod MaxPerPage = 0 Then
					TotalPage = totalnumber \ MaxPerPage
			 Else
					TotalPage = totalnumber \ MaxPerPage + 1
			 End If
			 n=0:startpage=1
			 pageStr=pageStr & "<div id='fenye' class='fenye'><table border=""0"" align=""right""><tr><td>" & vbcrlf
			 if (CurrPage>1) then pageStr=PageStr & "<a href='?Tid=" & ClassID & "&Status=" & StatusID & "&p="& CurrPage-1 &"' class=""prev"">上一页</a>"
			 if CurrPage<>TotalPage and totalnumber>MaxPerPage then pageStr=PageStr & "<a href='?Tid=" & ClassID & "&Status=" & StatusID & "&p="& CurrPage+1 &"' class=""next"">下一页</a>"
			 pageStr=pageStr & "<a href='?Tid=" & ClassID & "&Status=" & StatusID & "' class=""prev"">首 页</a>"
			 if (CurrPage>=7) then startpage=CurrPage-5
			 if TotalPage-CurrPage<5 Then startpage=TotalPage-9
			 If startpage<0 Then startpage=1
			 For J=startpage To TotalPage
				If J= CurrPage Then
				 PageStr=PageStr & " <a href=""#"" class=""curr""><font color=red>" & J &"</font></a>"
				Else
				 PageStr=PageStr & " <a class=""num"" href='?Tid=" & ClassID & "&Status=" & StatusID & "&p="& J &"'>" & J &"</a>"
				End If
				n=n+1
				if n>=10 then exit for
			 Next
			 pageStr=pageStr & "<a href='?Tid=" & ClassID & "&Status=" & StatusID & "&p="& TotalPage &"' class=""prev"">末页</a>"
			 pageStr=PageStr & "</td><td>共" & totalnumber & "条评价 分" & TotalPage & "页</td></tr></table></div>"
			If PrintOut=true Then echo PageStr Else ShowPage=PageStr
End Function
End Class
%>