<jsp:useBean id="record" scope="page" class="chatweb.manager" />
<jsp:useBean id="emotes" scope="page" class="chatweb.emote" />
<%@ page contentType="text/html; charset=gb2312" %>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.*"%>
<%@include file="Common.jsp" %>
<%@ page import="java.util.Date"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>
send
</title>
<link href="chat.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
parent.freshFrame.location.href="fresh.jsp";
</script>
</head>
<%

//初始化变量
int emote=0;
String toSelect=null;
String fontSet=null;
String colorSet=null;
String words=null;
String sender=null;
String msg="";
long block=0;
if(session.getAttribute("username")!=null)
	sender=session.getAttribute("username").toString();
if(request.getParameter("emote")!=null&&(!request.getParameter("emote").toString().equals("")))
	emote=Integer.parseInt(request.getParameter("emote"));
//动作表情处理
if(sender==null){//是否登陆
if(request.getParameter("emote")!=null){//不是第一次打开
%>
<!--没有session的处理-->
<script language="JavaScript" type="text/JavaScript">
window.alert("你还没有登陆");
</script>
<%}
}
else{
if(getServletContext().getAttribute(session.getAttribute("username").toString())==null)
{//检查是否超时
%>
<!--超作超时的处理-->
<script language="JavaScript" type="text/JavaScript">
window.alert("操作超时，请重新登陆");
</script>
<%
}
else{
toSelect=request.getParameter("toSelect");
fontSet=request.getParameter("fontSet");
colorSet=request.getParameter("colorSet");
block=record.getBlocked(session.getAttribute("username").toString());
if(block>0){//检查是否被禁言
%>
<!--被禁言的处理，时间不是很准确-->
	<script language="JavaScript" type="text/JavaScript">
window.alert("你被禁止发言（"+<%=block%>+"）");
</script>
<%
}
else{
if(emote>0){
String eto="<font color=\\\\\"#0000FF\\\\\"><a href=\\\\\"#\\\\\" onClick=\\\\\"parent.toSelect('"+getStr(toSelect)+"')\\\\\" style=\\\\\"text-decoration:none;color: #0000FF;\\\\\">"+getStr(toSelect)+"</a></font>";
String efr="<font color=\\\\\"#0000FF\\\\\"><a href=\\\\\"#\\\\\" onClick=\\\\\"parent.toSelect('"+sender+"')\\\\\" style=\\\\\"text-decoration:none;color: #0000FF;\\\\\">"+sender+"</a></font>";
msg=emotes.getEmote(emote,efr,eto,getStr(toSelect));
if(!msg.equals("")){
msg="<font color=\\\"#FF0000\\\">"+msg+"</font>";
addToChatmsg(msg);
	}
}
//表情处理结束
else{
//处理讲话
words=request.getParameter("textfield");
if(words!=null&&words.trim()!=""){//检查是否是空信息
	msg=new String("");
	words=new String(words.replaceAll("<","&lt;"));
	words=new String(words.replaceAll(">","&gt;"));
	//Date sendDate=new Date();
	Calendar ca=Calendar.getInstance();
   	String sendTime=ca.get(Calendar.HOUR_OF_DAY)+":"+ca.get(Calendar.MINUTE)+":"+ca.get(Calendar.SECOND);
	//String sendTime=sendDate.getHours()+":"+sendDate.getMinutes()+":"+sendDate.getSeconds();
	//String msg="<font color=\"#0000FF\">"+getStr(session.getAttribute("username").toString())+"</font>说："+getStr(words)+"<font color=\"#CCCC33\">["+sendTime+"]</font>";
	msg="<font color=\\\"#0000FF\\\"><a href=\\\"#\\\" onClick=\\\"parent.toSelect('"+sender+"')\\\" style=\\\"text-decoration:none;color: #0000FF;\\\">"+sender+"</a></font>&nbsp;";
	msg=msg+"&nbsp;对&nbsp;"+"<font color=\\\"#0000FF\\\"><a href=\\\"#\\\" onClick=\\\"parent.toSelect('"+getStr(toSelect)+"')\\\" style=\\\"text-decoration:none;color: #0000FF;\\\">"+getStr(toSelect)+"</a></font>&nbsp;说：";
	msg=msg+"<font color=\\\"#"+getStr(colorSet)+"\\\" face=\\\""+getStr(fontSet)+"\\\">";//设置字体和颜色
	msg=msg+getStr(words)+"</font>";
	msg=msg+"<font color=\\\"#CCCC33\\\">["+sendTime+"]</font>";
	addToChatmsg(msg);
}
}
}
}
}
%>
<body bgcolor="#FEC01D" onload="document.form1.textfield.focus()">
<script language="JavaScript" type="text/JavaScript">
function check(){
	if(document.all.textfield.value==""){
		window.alert("不能发空信息");
	}
    	else {
	     document.all.form1.submit();
	  }
	}
function sendEmote(emote,eto){
	location.href="addEmote.jsp?emote="+emote+"&eto="+eto;
}
</script>
<form name="form1" method="post" action="">

  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td nowrap>
              <div align="right">对象:</div></td>
            <td>
              <input name="toSelect" type="text" id="toSelect" value="<%=(toSelect==null?"所有人":getStr(toSelect))%>" readonly>
            </td>
            <td>
              <div align="center">
                <select name='colorSet' id="colorSet" onChange="document.form1.textfield.focus();">
                  <option style='color: #ff8800' value='ff8800'>黄金</option>
                  <option style='color: #50b000' value='50b000'>春草</option>
                  <option style='color: #CCAA00' value='CCAA00'>卡布</option>
                  <option style='color: #008800' value='008800'>橄榄</option>
                  <option style='color: #8800FF' value='8800FF'>篮紫</option>
                  <option style='color: #111111' value="111111" selected>颜色</option>
                </select>
              </div></td>
            <td width="4%">
			<TD>
	<SELECT name='fontSet' id="fontSet" onChange="document.form1.textfield.focus();">
        <OPTION	value="仿宋_GB2312">仿宋</option>
        <OPTION	value="楷体_GB2312">楷体</option>
        <OPTION	value="黑体">黑体</option>
        <OPTION	value="隶书">隶书</option>
        <OPTION	value="幼圆">幼圆</option>
        <OPTION value="" selected>字体</option>
      </SELECT>
			</td>
            <td nowrap> 
              <select name="emote" onChange="javascript:document.all.form1.submit();">
                <option value="0">动作表情</option>
                <!--以下代码由DELPHI生成-->
                <option value="1">:(</option>
                <option value="2">:((</option>
                <option value="3">:)</option>
                <option value="4">:))</option>
                <option value="5">:)..</option>
                <option value="6">:D</option>
                <option value="7">惊讶</option>
                <option value="8">?</option>
                <option value="9">??</option>
                <option value="10">@@</option>
                <option value="11">惊叫</option>
                <option value="12">加油</option>
                <option value="13">崇拜</option>
                <option value="14">同意</option>
                <option value="15">惊讶</option>
                <option value="16">爱</option>
                <option value="17">生气</option>
                <option value="18">鼓掌</option>
                <option value="19">坏</option>
                <option value="20">熊</option>
                <option value="21">指</option>
                <option value="22">生日</option>
                <option value="23">生日1</option>
                <option value="24">咬</option>
                <option value="25">眨眼</option>
                <option value="26">脸红</option>
                <option value="27">无聊</option>
                <option value="28">头来了</option>
                <option value="29">鞠躬</option>
                <option value="30">侮辱</option>
                <option value="31">万福</option>
                <option value="32">膜拜</option>
                <option value="33">害虫</option>
                <option value="34">白</option>
                <option value="35">再见</option>
                <option value="36">擦</option>
                <option value="37">哭1</option>
                <option value="38">小心</option>
                <option value="39">猫</option>
                <option value="40">天气真好</option>
                <option value="41">木棒</option>
                <option value="42">棺材</option>
                <option value="43">安慰</option>
                <option value="44">考虑</option>
                <option value="45">做菜</option>
                <option value="46">尸体</option>
                <option value="47">鼓励</option>
                <option value="48">狂笑</option>
                <option value="49">哭</option>
                <option value="50">抱拳</option>
                <option value="51">失落</option>
                <option value="52">切</option>
                <option value="53">跳舞</option>
                <option value="54">逛街</option>
                <option value="55">死</option>
                <option value="56">失望</option>
                <option value="57">想</option>
                <option value="58">德芙</option>
                <option value="59">做梦</option>
                <option value="60">喝酒</option>
                <option value="61">药</option>
                <option value="62">简单</option>
                <option value="63">不知道</option>
                <option value="64">吃饭</option>
                <option value="65">嗯</option>
                <option value="66">溜</option>
                <option value="67">运动</option>
                <option value="68">不要脸</option>
                <option value="69">昏</option>
                <option value="70">昏1</option>
                <option value="71">胖</option>
                <option value="72">害怕</option>
                <option value="73">拍马屁</option>
                <option value="74">望</option>
                <option value="75">飞</option>
                <option value="76">白痴</option>
                <option value="77">原谅</option>
                <option value="78">知音</option>
                <option value="79">台阶</option>
                <option value="80">咯咯</option>
                <option value="81">默默</option>
                <option value="82">goodbye</option>
                <option value="83">打招呼</option>
                <option value="84">邪恶</option>
                <option value="85">哈哈</option>
                <option value="86">哈哈1</option>
                <option value="87">铁锤</option>
                <option value="88">握手</option>
                <option value="89">摇头</option>
                <option value="90">傻笑</option>
                <option value="91">讥笑</option>
                <option value="92">救命</option>
                <option value="93">哼</option>
                <option value="94">嗯1</option>
                <option value="95">狼</option>
                <option value="96">拥抱</option>
                <option value="97">愚蠢</option>
                <option value="98">发呆</option>
                <option value="99">委屈</option>
                <option value="100">不怀好意</option>
                <option value="101">跳</option>
                <option value="102">踢</option>
                <option value="103">杀</option>
                <option value="104">吻</option>
                <option value="105">大笑</option>
                <option value="106">懒</option>
                <option value="107">依靠</option>
                <option value="108">舔</option>
                <option value="109">相爱</option>
                <option value="110">温柔的看</option>
                <option value="111">花痴</option>
                <option value="112">化妆</option>
                <option value="113">求婚</option>
                <option value="114">眉毛</option>
                <option value="115">想念</option>
                <option value="116">美眉</option>
                <option value="117">新年</option>
                <option value="118">点头</option>
                <option value="119">不可能</option>
                <option value="120">醒悟</option>
                <option value="121">两块钱</option>
                <option value="122">拍</option>
                <option value="123">猪</option>
                <option value="124">剑1</option>
                <option value="125">指</option>
                <option value="126">翘嘴</option>
                <option value="127">擦1</option>
                <option value="128">高</option>
                <option value="129">点</option>
                <option value="130">恶心</option>
                <option value="131">吐</option>
                <option value="132">结婚</option>
                <option value="133">姐姐</option>
                <option value="134">流氓</option>
                <option value="135">叹气</option>
                <option value="136">幸会</option>
                <option value="137">报仇</option>
                <option value="138">玫瑰</option>
                <option value="139">玫瑰2</option>
                <option value="140">彼此</option>
                <option value="141">无辜</option>
                <option value="142">恐惧</option>
                <option value="143">拼命</option>
                <option value="144">无奈</option>
                <option value="145">害羞</option>
                <option value="146">叹气</option>
                <option value="147">唱歌</option>
                <option value="148">椅子</option>
                <option value="149">睡</option>
                <option value="150">口号</option>
                <option value="151">愉快</option>
                <option value="152">抽烟</option>
                <option value="153">得意</option>
                <option value="154">偷偷笑</option>
                <option value="155">雪球</option>
                <option value="156">不舍</option>
                <option value="157">有事</option>
                <option value="158">道歉</option>
                <option value="159">干的好</option>
                <option value="160">看</option>
                <option value="161">臭</option>
                <option value="162">气度</option>
                <option value="163">汗水</option>
                <option value="164">茶</option>
                <option value="165">冤枉</option>
                <option value="166">道谢</option>
                <option value="167">想</option>
                <option value="168">感动</option>
                <option value="169">爱怜</option>
                <option value="170">兔</option>
                <option value="171">兔</option>
                <option value="172">拜</option>
                <option value="173">吩咐</option>
                <option value="174">反对</option>
                <option value="175">清醒</option>
                <option value="176">浪费</option>
                <option value="177">挥手</option>
                <option value="178">欢迎</option>
                <option value="179">眨眼</option>
                <option value="180">红颜</option>
                <option value="181">错误</option>
                <option value="182">辛苦</option>
                <option value="183">辛苦1</option>
                <option value="184">嘻嘻</option>
                <option value="185">胜利</option>
                <option value="186">依人</option>
                <option value="187">啵</option>
                <option value="188">闪电</option>
                <option value="189">困</option>
                <option value="190">捅</option>
                <option value="191">看什么看</option>
                <option value="192">板凳</option>
                <option value="193">板凳2</option>
                <option value="194">西瓜</option>
                <option value="195">哈根达斯</option>
                <option value="196">开花</option>
                <option value="197">鼓掌</option>
                <option value="198">喝醉酒</option>
                <option value="199">自做多情</option>
                <option value="200">打劫</option>
                <option value="201">冰棒</option>
                <option value="202">咕咕</option>
                <option value="203">请罪</option>
                <option value="204">自杀</option>
                <option value="205">长寿</option>
                <option value="206">感情破裂</option>
                <option value="207">橘子</option>
                <option value="208">花</option>
                <option value="209">拨楞鼓</option>
                <option value="210">手绢</option>
                <option value="211">江湖</option>
                <option value="212">汽车</option>
                <option value="213">自行车</option>
                <option value="214">深情款款</option>
                <option value="215">坐怀不乱</option>
                <option value="216">耸肩</option>
                <option value="217">侮辱1</option>
                <option value="218">臭臭</option>
                <option value="219">口水</option>
                <option value="220">膏药</option>
                <option value="221">笨蛋</option>
                <option value="222">扯呼</option>
                <option value="223">游子1</option>
                <option value="224">闪现</option>
                <option value="225">智商</option>
                <option value="226">不要</option>
                <option value="227">瓜子</option>
                <option value="228">金兰</option>
                <option value="229">男朋友</option>
                <option value="230">女朋友</option>
                <option value="231">博士</option>
                <option value="232">游子</option>
                <option value="233">跳</option>
                <option value="234">喜宝</option>
                <option value="235">流星</option>
                <option value="236">慢</option>
                <option value="237">汗</option>
                <option value="238">随便说说</option>
                <option value="239">私奔</option>
                <option value="240">否定</option>
                <option value="241">企图</option>
                <option value="242">抖</option>
                <!--以上代码由DELPHI生成-->
              </select><a href="help.htm" target="_blank">&gt;&gt;&gt;索引</a></td>
            <td width="100%">&nbsp;</td>
            <td width="7%">&nbsp;</td>
          </tr>
        </table></td>
    </tr>
    <tr>
      <td width="0" nowrap>信息:</td>
      <td width="20%">
        <input name="textfield" type="text" size="50" maxlength="80" onkeydown="if(event.keyCode==13)check()">
      </td>
      <td width="80%">&nbsp;&nbsp;
        <input type="button" name="button1" value="说话了" onclick="check()">
      </td>
    </tr>
  </table>
</form>
<script language="JavaScript" type="text/JavaScript">
 document.all.colorSet.value="<%=(colorSet==null?"111111":colorSet)%>";
 document.all.fontSet.value="<%=(fontSet==null?"":getStr(fontSet))%>";
</script>

</body>
</html>
