wcf-shoutbox / templates / shoutboxFrame.tpl

{if $this->getUser()->getPermission('user.shoutbox.canRead')}
<table class="shoutboxFrame container-1" cellpadding="4" cellspacing="0" border="0" style="width:{SHOUTBOX_DEFAULTWIDTH};">
<tr><td>
	<div class="border shoutboxFrameInner container-2">
		<div id="shoutboxcontent" style="margin:5px; padding:0px; height:{SHOUTBOX_DEFAULTHEIGHT};">
			<noscript><iframe name="chat" src="index.php?page=ShoutboxContent" scrolling="yes" frameborder="0" allowtransparency="true" style="width:{SHOUTBOX_DEFAULTWIDTH}; height:{SHOUTBOX_DEFAULTHEIGHT}; border:0px;"></iframe></noscript>
		</div>
	</div>
</td></tr>
<tr><td>
<script language="javascript" type="text/javascript">
	//<![CDATA[
	
		var ajaxRequest   = null;
		var lastmessage   = 0;
		var queuedmessage = null;
		var timerPending  = false;
		var sbcontent     = document.getElementById('shoutboxcontent');
		
		// prepare div element
	//	sbcontent.style.overflow = 'scroll';
	//	sbcontent.innerHTML = '<div id="innershoutboxcontent" style="width:100%;"></div><a name="shoutboxbottom"></a><br/>';
	//	sbcontent = document.getElementById('innershoutboxcontent');
		sbcontent.innerHTML = '<iframe src="about:blank" id="shoutboxcontentframe" name="shoutboxcontentframe" scrolling="auto" frameborder="0" allowtransparency="true" style="background-color:transparent; width:{SHOUTBOX_DEFAULTWIDTH}; height:{SHOUTBOX_DEFAULTHEIGHT}; border:0px;"></iframe>';
		frames.shoutboxcontentframe.document.write('\x3chtml\x3e\x3chead\x3e<link rel="stylesheet" type="text/css" media="screen" href="{@RELATIVE_WCF_DIR}style/style-{@$this->getStyle()->styleID}.css" /></head><body style="margin:0px; padding:0px;"><div class="shoutboxFrameInner container-2" style="margin:0px; padding:0px; position:absolute; top:0px; left:0px; width:{SHOUTBOX_DEFAULTWIDTH}; height:{SHOUTBOX_DEFAULTHEIGHT};"><div id="shoutboxcontent" class="shoutboxFrameInner container-2" style="text-align:left; margin:0px; padding:0px;"></div></div></body></html>');
	//	frames.shoutboxcontentframe.document.write('<html><head'+'><link rel="stylesheet" type="text/css" media="screen" href="{@RELATIVE_WCF_DIR}style/style-{@$this->getStyle()->styleID}.css" /></head><body style="margin:0px; padding:0px;"><div class="shoutboxFrameInner container-2" style="margin:0px; padding:0px; position:absolute; top:0px; left:0px; width:{SHOUTBOX_DEFAULTWIDTH}; height:{SHOUTBOX_DEFAULTHEIGHT};"><div id="shoutboxcontent" class="shoutboxFrameInner container-2" style="text-align:left; margin:0px; padding:0px;"></div></div></body></html>');
		frames.shoutboxcontentframe.document.close();
		sbcontent = null;
		
		setTimeout('shoutboxTimer()', 100);
		
		
		function shoutboxTimer() {
			if (this.sbcontent == null) {
				this.sbcontent = frames.shoutboxcontentframe.document.getElementById('shoutboxcontent');
			}
			
			this.timerPending = false;
			sendShoutboxAjaxRequest();
			
			return;
		}
		
		
		function sendShoutboxAjaxRequest() {
			if(this.ajaxRequest == null) {
				var appendmessage = '';
				
				if(this.queuedmessage != null) {
					appendmessage = '&message=' + encodeURIComponent(this.queuedmessage);
					this.queuedmessage = null;
				}
				
				this.ajaxRequest = new AjaxRequest();
				return this.ajaxRequest.openPost(
									'index.php?page=ShoutboxContent&output=xml' + SID_ARG_2ND,
									'since=' + this.lastmessage + appendmessage,
									function() { handleShoutboxContentRequest(); }
				);
			}
			
			return true;
		}
		
		function sendShoutboxMessage() {
			this.queuedmessage = document.shoutboxInputform.message.value;
			document.shoutboxInputform.message.value='';
			return !sendShoutboxAjaxRequest();
		}
		
		function handleShoutboxContentRequest() {
			if (this.ajaxRequest && this.ajaxRequest.xmlHttpRequest.readyState == 4) {
				if(this.ajaxRequest.xmlHttpRequest.status == 200 && this.ajaxRequest.xmlHttpRequest.responseXML) {
					var lines = this.ajaxRequest.xmlHttpRequest.responseXML.getElementsByTagName('lines');
					
					if(lines.length > 0) {
						for(var i=0; i<lines[0].childNodes.length; i++) {
							var line = lines[0].childNodes[i];
							
							if(line.childNodes.length > 0) {
								var node = line.childNodes[0];
								
								if(node.nodeType == 3 || node.nodeType == 4) {
									if(line.tagName == 'line') {
										{if SHOUTBOX_MESSAGEORDER_ASC}
											this.sbcontent.innerHTML = this.sbcontent.innerHTML + node.nodeValue + '<br/>';
										{else}
											this.sbcontent.innerHTML = node.nodeValue + '<br/>' + this.sbcontent.innerHTML;
										{/if}
									}
									else if(line.tagName == 'last') {
										this.lastmessage = node.nodeValue;
									}
								}
							}
						}
					}
					
					{if SHOUTBOX_MESSAGEORDER_ASC}
						// scroll the frame to the bottom
						frames.shoutboxcontentframe.scrollTo(0, 999999);
					{/if}
					
					// request was successfully handled...
					this.ajaxRequest.xmlHttpRequest.abort();
					this.ajaxRequest = null;
					
					// if a message was queued, send another request immediately
					if(this.queuedmessage) {
						sendShoutboxAjaxRequest();
					}
					{if SHOUTBOX_RELOADTIME}
					else if(!this.timerPending) {
						this.timerPending = true;
						setTimeout('shoutboxTimer()', {SHOUTBOX_RELOADTIME*1000});
					}
					{/if}
				}
			}
			
			return;
		}
		
		function sbWhisperTo(name) {
			document.shoutboxInputform.message.value = '/w "' + name + '" ' + document.shoutboxInputform.message.value;
			return;
		}
	
	//]]>
</script>
{if $this->getUser()->getPermission('user.shoutbox.canWrite')}
	<form name="shoutboxInputform" action="index.php" method="post" target="chat" onsubmit="return sendShoutboxMessage();">
		<input type="hidden" name="page" value="ShoutboxContent">
		<noscript><span>[<a href="index.php?page=ShoutboxContent" target="chat">aktualisieren</a>]</noscript>
			<b>{if $this->getUser()->userID}{$this->getUser()->username}{else}{lang}net.northshirebund.wbb.shoutbox.guest{/lang}{/if}</b> &raquo;
			<input type=text name="message" size="60" class="input">
			<input type=submit value="Senden" class="input">
		</span>
	</form>
{/if}
</td></tr>
</table>
{/if}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.