logging.jsp 5.94 KB
Newer Older
CED SA's avatar
CED SA committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234

<%
	/*
	 * Created on 16/12/2019
	 *
	 * Copyright (c) EldaSoft S.p.A.
	 * Tutti i diritti sono riservati.
	 *
	 * Questo codice sorgente e' materiale confidenziale di proprieta' di EldaSoft S.p.A.
	 * In quanto tale non puo' essere distribuito liberamente ne' utilizzato a meno di 
	 * aver prima formalizzato un accordo specifico con EldaSoft.
	 */
%>

<%@ taglib uri="http://www.eldasoft.it/genetags" prefix="gene"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:set var="contextPath" value="${pageContext.request.contextPath}" />

<gene:template file="popup-template.jsp">

	<gene:redefineInsert name="head" >
		<style type="text/css">
			body {
				background: #FFFFFF;
				color: #000000;
				margin: 0px;
			}
			
			TABLE.griglialog {
				vertical-align: middle;
				margin-left: 10px;
				margin-right: 10px;
				margin-top: 10px;
				margin-bottom: 10px;
				padding: 0px;
				border-collapse: collapse;
				font: 11px Verdana, Arial, Helvetica, sans-serif;
				width: 930px;
			}
			
			TABLE.griglialog TR {
				background-color: #FFFFFF;
			}
					
			TABLE.griglialog TR TD {
				padding-left: 0px;
				padding-right: 0px;
				padding-top: 10px;
				padding-bottom: 10px;
				height: 25px;
				text-align: left;
			}
			
			div.msg {
				border-left: 2px solid #0034D3;
				background-color: #EFEFEF;
				padding: 10 0 10 10;
				margin-bottom: 5px;
				width: 900px;
			}
			
			div.msg-error {
				border-left: 2px solid #C60000;
				background-color: #EFEFEF;
				color: #C60000;
				padding: 10 0 10 10;
				margin-bottom: 5px;
				width: 900px;
			}		

			span.cnt {
				font: 9px Verdana, Arial, Helvetica, sans-serif;
				font-weight: bold;
				color: #FFFFFF;
				border: 1px solid #0034D3;
				background-color: #0034D3;
				padding-left: 2px;
				padding-right: 2px;
				-moz-border-radius-topleft: 3px; 
				-webkit-border-top-left-radius: 3px; 
				-khtml-border-top-left-radius: 3px; 
				border-top-left-radius: 3px; 
				-moz-border-radius-topright: 3px;
				-webkit-border-top-right-radius: 3px;
				-khtml-border-top-right-radius: 3px;
				border-top-right-radius: 3px;
				-moz-border-radius-bottomleft: 3px; 
				-webkit-border-bottom-left-radius: 3px; 
				-khtml-border-bottom-left-radius: 3px; 
				border-bottom-left-radius: 3px; 
				-moz-border-radius-bottomright: 3px;
				-webkit-border-bottom-right-radius: 3px;
				-khtml-border-bottom-right-radius: 3px;
				border-bottom-right-radius: 3px;
			}
		
		</style>
		
		
		
		<script type="text/javascript">
		
			window.opener.currentPopUp=null;
			
		    window.onfocus=resettaCurrentPopup;
	
			function resettaCurrentPopup() {
				window.opener.currentPopUp=null;
			}
		
			var socket;
			function connect() {
				if ('WebSocket' in window){
					
					var _loc = $(location).attr('href');
					_loc = _loc.replace('https://','wss://');
					_loc = _loc.replace('http://','ws://');
					_loc = _loc.replace('ApriPopup.do?href=/commons/logging.jsp&numeroPopUp=1','websocketlogging');
					
					var _url = _loc;
					
					socket = new WebSocket(_url);
					
					socket.onerror = function(evt) {
						var _d = $("<div/>", {"class": "msg-error"});
						_d.append("Collegamento con il server (" + _loc + ")... KO");
						$('#logging').append(_d);
						window.scrollTo(0,document.body.scrollHeight);
					}
					
					socket.onopen = function() {
						var _d = $("<div/>", {"class": "msg"});
						_d.append("Collegamento con il server (" + _loc + ")... OK");
						_d.append("<br>");
						_d.append("Inizializzazione della tracciatura dei messaggi... OK");
						$('#logging').append(_d);
						window.scrollTo(0,document.body.scrollHeight);
					}
					
					socket.onclose = function() {
						setTimeout(function(){connect();}, 5000);
					}
					
					socket.onmessage = function (evt) { 
						
						var _ok = true;
						var received_msg = evt.data;
						
						if ($("#filtro").val() != "") {
							var _ifiltro = received_msg.indexOf($("#filtro").val());
							if (_ifiltro <= 0) {
								_ok = false;
							}
						}
						
						if (_ok) {						
							var _n = $("#logging div").length;
							var _nmax = $("#numeromassimomessaggi").val();
							var _ntot = $("#numeromessaggitotali").text();
							
							_ntot++;
							
							$("#numeromessaggitotali").text(_ntot);
							
	
							if (_n > _nmax) {
								$("#logging div:lt(-" + _nmax + ")").remove();
							}
							
							var _d = $("<div/>", {"class": "msg"});
							var _s = $("<span/>", {"class": "cnt"});
							_s.append(_ntot);
							_d.append(_s);
							_d.append("<br>");
							_d.append("<br>");
							_d.append(document.createTextNode(received_msg));
							$('#logging').append(_d);
							
							window.scrollTo(0,document.body.scrollHeight);
						}

				  	}
				} 
			}
			
			function disconnect () {
				socket.close();
			}
		   
		    setTimeout(function(){connect();}, 1000);
		</script>
		
	</gene:redefineInsert>
		
	<gene:redefineInsert name="addHistory" />
	<gene:redefineInsert name="gestioneHistory" />

	<gene:setString name="titoloMaschera" value="Logging" />		
  
	<gene:redefineInsert name="corpo">
		<table class="griglialog">
			<tr>
				<td>
					<div id="logging" style="width:100%; font-size: 11px; white-space: pre-wrap; word-wrap: break-word;"></div>
				</td>
			</tr>
			
			<tr>
				<td>
					<div class="msg">
						Numero messaggi totali: <span id="numeromessaggitotali">0</span>
						<br>
						<br>
						Filtro messaggi: <input style="font-size: 11px;" type="text" id="filtro" placeholder="Inserire l'eventuale filtro sui messaggi" size="60"/>
						<br>
						<br>
						Visualizzare gli ultimi&nbsp; 
						<select id="numeromassimomessaggi">
							<option value="1000">1000</option>
							<option value="2000">2000</option>
							<option value="4000">4000</option>	
						</select>
						&nbsp;messaggi
					</div>
				</td>
			</tr>
		</table>
	</gene:redefineInsert>

	<gene:redefineInsert name="documentiAssociati"></gene:redefineInsert> 
	<gene:redefineInsert name="noteAvvisi"></gene:redefineInsert>

</gene:template>