var startTimes; var startTimesA; function $(id){ return document.getElementById(id); } function openDialog(typeName){ switch(typeName){ case "message": var openSet = "height=500, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-500)/2 + ",Left= "+(screen.width-900)/2 var openType = "_blank"; var openUrl = "../message/message.aspx?post=1"; window.open (openUrl,openType,openSet); break; case "announce": //如果已打开 var url2 = "../Message/SysAnnounceClientGridSource.aspx?handle=isclose&uid="+newGuid(); var loader2 = dhtmlxAjax.getSync(url2); var strISDELETE = loader2.xmlDoc.responseText; // var openSet = "height=500, width=900, toolbar=no, menubar=no,scrollbars=no, resizable=no,location=no, status=no,Top= " +(screen.height-500)/2 + ",Left= "+(screen.width-900)/2 var openType = "_blank"; var openUrl = "../message/SysAnnounceClient.aspx"; window.open (openUrl,openType,openSet); break; default: break; } } function recycleCount(timeCount){ startTimes = new Date(); setInterval(function(){ var frameObj = null; frameObj = parent.document.getElementById("iFrameH").contentWindow; if(frameObj.document.getElementById("scrA") == null){ var url = "../js/popmessage.js?uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); var jsVal = loader.xmlDoc.responseText; var oHead = frameObj.document.getElementsByTagName('HEAD').item(0); var oScript = frameObj.document.createElement( "script" ); oScript.language = "javascript"; oScript.type = "text/javascript"; oScript.id = "scrA"; oScript.defer = true; oScript.text = jsVal; oHead.appendChild(oScript); } var messageCountObj = null; var url = "../message/MessageService.aspx?handle=messagetotal&uid="+newGuid(); var loader = dhtmlxAjax.getSync(url); var messageVal = loader.xmlDoc.responseText; if(messageVal.trim() != ""){ messageCountObj = eval('(' + messageVal + ')'); var msgInterval = messageCountObj.totals[0].interval; if(messageCountObj.totals[0].read != 0){ var oldUrl = parent.document.getElementById("iFrameH").contentWindow.location.href; var doubleUrl = 0; if(oldUrl.indexOf("//") >= 0){ doubleUrl = oldUrl.indexOf("//")+2; } var tempUrl = oldUrl.substring(doubleUrl,oldUrl.substring(doubleUrl,oldUrl.length).indexOf("/")+doubleUrl); var newUrl = oldUrl.substring(0,doubleUrl)+tempUrl+"/"+"message/message.aspx"; //var newUrl = "message/SysAnnounceClient.aspx"; $("dvMessage").innerText = "我的消息("+messageCountObj.totals[0].read+"/"+messageCountObj.totals[0].total+")"; var currentTimes = new Date(); var spaceTimes = currentTimes.getTime() - startTimes.getTime(); var days = Math.floor(spaceTimes/(24*3600*1000)); //计算小时 var leave1 = spaceTimes%(24*3600*1000); var hours= Math.floor(leave1/(3600*1000)); //计算分钟 var leave2= leave1%(3600*1000); var minutes=Math.floor(leave2/(60*1000)); //计算秒数 var leave3=leave2%(60*1000); var seconds=Math.round(leave3/1000); if(msgInterval > 0){ if(minutes >= msgInterval){ startTimes = new Date(); frameObj.openPop("我的消息("+messageCountObj.totals[0].read+"/"+messageCountObj.totals[0].total+")",messageCountObj.totals[0].read,messageCountObj.totals[0].total,newUrl); } }else{ frameObj.openPop("我的消息("+messageCountObj.totals[0].read+"/"+messageCountObj.totals[0].total+")",messageCountObj.totals[0].read,messageCountObj.totals[0].total,newUrl); } }else{ $("dvMessage").innerText = "我的消息(0/"+messageCountObj.totals[0].total+")"; } } },timeCount); } function recycleCountAnnounce(timeCountA) { startTimesA = new Date(); var isShow = 0; setInterval(function() { var frameObjA = null; frameObjA = parent.document.getElementById("iFrameH").contentWindow; if(frameObjA.document.getElementById("scrAnnounce") == null) { var urlA0 = "../js/popAnnounce.js?uid="+newGuid(); var loaderA = dhtmlxAjax.getSync(urlA0); var jsValA = loaderA.xmlDoc.responseText; var oHeadA = frameObjA.document.getElementsByTagName('HEAD').item(0); var oScriptA = frameObjA.document.createElement( "script" ); oScriptA.language = "javascript"; oScriptA.type = "text/javascript"; oScriptA.id = "scrAnnounce"; oScriptA.defer = true; oScriptA.text = jsValA; oHeadA.appendChild(oScriptA); } var AnnounceCountObjA = null; var urlA = "../Message/SysAnnounceClientGridSource.aspx?handle=getannouncetotal&uid="+newGuid(); var loaderA = dhtmlxAjax.getSync(urlA); var AnnounceValA = loaderA.xmlDoc.responseText; if(AnnounceValA.trim() != "") { AnnounceCountObjA = eval('(' + AnnounceValA + ')'); if(AnnounceCountObjA!=null) { var msgIntervalA = 3;//AnnounceCountObjA.totals[0].interval; if(isShow==0) { msgIntervalA = 0; } // if(AnnounceCountObjA.totals[0].total != 0) { var oldUrlA = parent.document.getElementById("iFrameH").contentWindow.location.href; var doubleUrlA = 0; if(oldUrlA.indexOf("//") >= 0) { doubleUrlA = oldUrlA.indexOf("//")+2; } var tempUrlA = oldUrlA.substring(doubleUrlA,oldUrlA.substring(doubleUrlA,oldUrlA.length).indexOf("/")+doubleUrlA); //var newUrlA = oldUrlA.substring(0,doubleUrlA)+tempUrlA+"/"+"Message/SysAnnounceClient.aspx"; var newUrlA = "../Message/SysAnnounceClient.aspx"; $("dvAnnounce").innerText = "公告("+AnnounceCountObjA.totals[0].total+")"; var currentTimesA = new Date(); var spaceTimesA = currentTimesA.getTime() - startTimesA.getTime(); var daysA = Math.floor(spaceTimesA/(24*3600*1000)); //计算小时 var leaveA1 = spaceTimesA%(24*3600*1000); var hoursA= Math.floor(leaveA1/(3600*1000)); //计算分钟 var leaveA2= leaveA1%(3600*1000); var minutesA=Math.floor(leaveA2/(60*1000)); //计算秒数 var leaveA3=leaveA2%(60*1000); var secondsA=Math.round(leaveA3/1000); if(msgIntervalA > 0) { if(minutesA >= msgIntervalA) { startTimesA = new Date(); isShow=1; frameObjA.openPopA("公告("+AnnounceCountObjA.totals[0].total+")",AnnounceCountObjA,AnnounceCountObjA.totals[0].total,newUrlA); } } else { isShow=1; frameObjA.openPopA("公告("+AnnounceCountObjA.totals[0].total+")",AnnounceCountObjA,AnnounceCountObjA.totals[0].total,newUrlA); } } else { //$("dvAnnounce").innerText = "公告("+AnnounceCountObjA.totals[0].total+")"; } } } },timeCountA); } //获取GUID function newGuid() { var guid = ""; for (var i = 1; i <= 32; i++){ var n = Math.floor(Math.random()*16.0).toString(16); guid += n; if((i==8)||(i==12)||(i==16)||(i==20)) guid += "-"; } return guid.toUpperCase(); } String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g,""); }