mirror of
				https://github.com/Mibew/tray.git
				synced 2025-10-03 00:03:34 +03:00 
			
		
		
		
	reload page if agent lost the thread (switch to viewonly mode) or agent became its owner
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@145 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									fe87d0dfc2
								
							
						
					
					
						commit
						06e1c2e8eb
					
				| @ -62,6 +62,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, { | ||||
|     this.cansend = true; | ||||
|     this.skipNextsound = true; | ||||
|     this.focused = true; | ||||
|     this.ownThread = this._options.message != null; | ||||
| 	FrameUtils.initFrame(this._options.container); | ||||
|     if( this._options.message ) { | ||||
| 		this._options.message.onkeydown = this.handleKeyDown.bind(this); | ||||
| @ -205,6 +206,13 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, { | ||||
| 		this.showTyping(typing == '1'); | ||||
| 	} | ||||
| 
 | ||||
| 	var canpost = NodeUtils.getAttrValue(xmlRoot, "canpost"); | ||||
| 	if( canpost ) { | ||||
| 		if( canpost == '1' && !this.ownThread || this.ownThread && canpost != '1' ) { | ||||
| 			window.location.href = window.location.href; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	for( var i = 0; i < xmlRoot.childNodes.length; i++ ) { | ||||
| 		var node = xmlRoot.childNodes[i]; | ||||
| 		if( node.tagName == 'message' ) { | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| var myAgent="";var nk=0;var myRealAgent="";function qk(){var rk=["\157p\u0065\u0072\u0061","\u006d\u0073\u0069e","\163\141f\141ri","fi\u0072\u0065f\157\170","\156\145\164\u0073\u0063\141p\u0065","\u006d\157\172\u0069\u006c\154a"];var jj=navigator.userAgent.toLowerCase();for(var i=0;i<rk.length;i++){var sk=rk[i];if(jj.indexOf(sk)!=-1){myAgent=sk;if(!window.RegExp)break;var tk=new RegExp(sk+"\u005b \/\135\u003f\u0028\133\u0030-\u0039]+\050\.[\u0030-\071\u005d+\051\077)");if(tk.exec(jj)!=null){nk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="Ge\143k\157")myAgent="m\157z";} qk();function getEl(name){return document.getElementById(name);}  | ||||
| var myAgent="";var rk=0;var myRealAgent="";function sk(){var tk=["\u006f\u0070\145r\u0061","\u006d\163\151\u0065","\u0073af\u0061\u0072\151","\u0066i\162\u0065\u0066\u006fx","\u006eet\u0073\143a\160\145","\155\u006f\172i\u006cl\141"];var lj=navigator.userAgent.toLowerCase();for(var i=0;i<tk.length;i++){var uk=tk[i];if(lj.indexOf(uk)!=-1){myAgent=uk;if(!window.RegExp)break;var hk=new RegExp(uk+"\133\u0020\/]?(\1330-9]\u002b\u0028\.[0-9\u005d+\051\u003f\u0029");if(hk.exec(lj)!=null){rk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\u0047e\u0063k\u006f")myAgent="m\157\u007a";} sk();function getEl(name){return document.getElementById(name);}  | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -126,7 +126,7 @@ function get_messages($threadid,$meth,$isuser,&$lastid) { | ||||
| 	return $messages; | ||||
| } | ||||
| 
 | ||||
| function print_thread_messages($thread, $token, $lastid, $isuser,$format) { | ||||
| function print_thread_messages($thread, $token, $lastid, $isuser, $format, $agentid=null) { | ||||
| 	global $webim_encoding, $webimroot, $connection_timeout; | ||||
| 	$threadid = $thread['threadid']; | ||||
| 	$istyping = abs($thread['current']-$thread[$isuser ? "lpagent" : "lpuser"]) < $connection_timeout | ||||
| @ -136,7 +136,7 @@ function print_thread_messages($thread, $token, $lastid, $isuser,$format) { | ||||
| 		$output = get_messages($threadid,"xml",$isuser,$lastid); | ||||
| 
 | ||||
| 		start_xml_output(); | ||||
| 		print("<thread lastid=\"$lastid\" typing=\"".$istyping."\">"); | ||||
| 		print("<thread lastid=\"$lastid\" typing=\"".$istyping."\" canpost=\"".(($isuser || $agentid != null && $agentid == $thread['agentId']) ? 1 : 0)."\">"); | ||||
| 		foreach( $output as $msg ) { | ||||
| 			print $msg; | ||||
| 		} | ||||
|  | ||||
| @ -49,7 +49,7 @@ if( !$isuser && $act != "rename" ) { | ||||
| 
 | ||||
| if( $act == "refresh" ) { | ||||
| 	$lastid = verifyparam( "lastid", "/^\d{1,9}$/", -1); | ||||
| 	print_thread_messages($thread, $token, $lastid, $isuser,$outformat); | ||||
| 	print_thread_messages($thread, $token, $lastid, $isuser,$outformat, $isuser ? null : $operator['operatorid']); | ||||
| 	exit; | ||||
| 
 | ||||
| } else if( $act == "post" ) { | ||||
| @ -64,7 +64,7 @@ if( $act == "refresh" ) { | ||||
| 	} | ||||
| 
 | ||||
| 	post_message($threadid,$kind,$message,$from, $isuser ? null : $operator['operatorid'] ); | ||||
| 	print_thread_messages($thread, $token, $lastid, $isuser, $outformat); | ||||
| 	print_thread_messages($thread, $token, $lastid, $isuser, $outformat, $isuser ? null : $operator['operatorid']); | ||||
| 	exit; | ||||
| 
 | ||||
| } else if( $act == "rename" ) { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user