EmessageBox.jsp 3.74 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="java.io.File" %>
<%@ page import="weaver.hrm.*" %>
<%@ page import="weaver.systeminfo.*" %>
<%@ page import="weaver.general.*" %>
<%@ page import="weaver.conn.*" %>
<%@page import="weaver.social.im.SocialImLogin"%> 

<%!
public boolean checkE4Version(String rootPath){
	boolean flag = true;
	RecordSet rs = new RecordSet();
	try{
		rs.execute("select * from MainMenuInfo where id = '10238'");
		OrderProperties emProp = new OrderProperties();
		String emPropPath = (rootPath == null ? GCONST.getRootPath(): rootPath) + 
			"/social/im/resources/emessage.properties"; 
		File emPropFile = new File(emPropPath);
		String emVersion = Util.null2String(emProp.get("version"));
		float version = emVersion.equals("") ? 0 : Float.valueOf(emVersion);
		if(emPropFile.exists()){
			emProp.load(emPropPath);
			//客户没有e4申请,emessage版本置为3.8,不认为是e4版本
			if(!rs.next()){
				if(version >= 4.0){
					emProp.put("version", "3.8");
					emProp.store(emProp, emPropPath);
				}
				flag = false;
			}
			//客户端申请了,但是版本低于4.0,不认为是e4版本
			else if(version < 4.0){
				flag = false;
			}
		}
		//配置文件不存在,不认为是e4版本
		else{
			flag = false;
		}
	}catch(Exception e){
		System.out.println("检查当前客户是否是e4版本");
		e.printStackTrace();
	}
	return flag;
}

%>
<%
	//m3不显示
	//System.out.println("===1111====");
	boolean isE4 = checkE4Version(application.getRealPath(File.separator));
	//System.out.println("===1111===="+isE4);
	if(!isE4){
		//return;
	}
    User user = HrmUserVarify.getUser (request , response);
    
    //System.out.println("===2222====");
    int checkLicense = SocialImLogin.checkLience();
    //System.out.println("===2222===="+checkLicense);
    if(checkLicense == 0) {
        return;  // 没启用不显示
    }
    else if(checkLicense == 1) {  // 授权正常,在人数正常,且pc不在线--》显示
    	//System.out.println("===3333====");
        int pcLogin = SocialImLogin.checkOnlineStatus(user.getUID(), SocialImLogin.CLIENT_TYPE_PC);
        int webLogin = SocialImLogin.checkOnlineStatus(user.getUID(), SocialImLogin.CLIENT_TYPE_WEB);
        //System.out.println("===3333===="+pcLogin+" "+webLogin);
        if(pcLogin == 1 || webLogin == 1) {
            return;
        }
        if(pcLogin == 0) {
%>
		<!-- web即时通讯消息接收-->
		<div id="IMbg" class="IMbg" style="display:none;" onclick="showIMdiv(0)"></div>
		<div id="addressdiv" style="display:none;position:fixed;width:963px;height:600px;z-index:1002;right:5px;">
			<iframe name="socialIMFrm" id="socialIMFrm" onload="initIMBox()" scrolling="no" border="0" style="width:963px;height:600px;border:0px;"></iframe>
   		</div> 
   		<div id="immsgdiv" style="display:none;" onclick="showIMdiv(1)">
   			<span id="unreadMsgSpan" style="display:none;">
   				<%=SystemEnv.getHtmlLabelName(126880, user.getLanguage())%>(<span id="unreadMsgCount">0</span>)
   			</span><!-- 您有新的消息 -->
   		</div>
 <%
        }
    }
    else {  //授权不正常或超过最大人数--》给出灰色并提示
%>
    <div id="immsgdiv" style="background-color: #ccc;" onclick="javascript:top.Dialog.alert('<%=SocialImLogin.getCheckLienceMsg(checkLicense, 7) %>');"></div>
<%
    }
%>

<style>
	.IMbg{position: absolute; opacity: 0.4; width: 100%; height: 100%; background-color: rgb(51, 51, 51);z-index:1001}
	#immsgdiv{  
		  /*width: 120px;*/
		  height: 40px;
		  background: url('/social/images/im_msg.png') #4ba9df no-repeat 15px center;
		  padding-left: 40px;
		  padding-right: 10px;
		  position: absolute;
		  right: 0px;
		  bottom: 45px;
		  z-index: 1000;
		  color: #fff;
		  line-height: 40px;
		  cursor:pointer;
	}
</style>