<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="Common.jsp" %>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.*"%>
<html>
<head>
<title>
成员列表
</title>
<link href="chat.css" rel="stylesheet" type="text/css">
<meta http-equiv="refresh" content="10">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<script language="JavaScript" type="text/JavaScript">
function toSelect(nowselect){
	parent.sendFrame.document.all.toSelect.value=nowselect;
	parent.sendFrame.document.form1.textfield.focus();
}
</script>

<body bgcolor="#FFFEDD">
<table width="150" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="199" align="left" valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="24">[<font color="#FF0000"><a href="#" onClick="toSelect('所有人')">所有在线成员</a></font>]</td>
        </tr>
<%
Vector tempVector=(Vector)getServletContext().getAttribute("chatUser");
if(tempVector!=null)
for(int i=0;i<=tempVector.size()-1;i++){
	String onlineName=(String)tempVector.elementAt(tempVector.size()-1-i);
	if(getServletContext().getAttribute(onlineName)!=null){
		Calendar ca = Calendar.getInstance();
		int nm=ca.get(Calendar.MINUTE);//当前分钟
		int lm=Integer.parseInt(getServletContext().getAttribute(onlineName).toString());//最后一次登陆的分钟
		int judge=nm-lm;
              if(!(judge>2||(judge<0&&judge>-58))){//时间间隔草果3分钟
		out.println("<tr><td height=\"24\"><img src=\"images/online.gif\" width=\"16\" height=\"17\">");
		out.println("<a href=\"#\" onClick=\"toSelect('"+getStr(onlineName)+"')\">");
    		out.println(getStr(onlineName));
		out.println("</a></td></tr>");
              }
	else{
		getServletContext().removeAttribute(onlineName);
		tempVector.removeElementAt(tempVector.size()-1-i);
		getServletContext().setAttribute("chatUser",tempVector);
		String msg="[系统消息]"+getStr(onlineName)+"走了";
		addToChatmsg(msg);
              }
	}
	else{
		tempVector.removeElementAt(tempVector.size()-1-i);
		getServletContext().setAttribute("chatUser",tempVector);
		String msg="[系统消息]"+getStr(onlineName)+"走了";
		addToChatmsg(msg);
	}
}
%>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
