Se ha producido un error al procesar la plantilla.
Unable to find resource '10155#10193#176057880'
1#*
 
2    * MIGRACIÓN A LIFERAY 7.2
 
3    *
 
4	* Autor: Andrea Olivero
 
5	* Fecha Inicio: 22/06/2020
 
6	* Formato migracion: freemarker (ftl)
 
7	* Fecha Finalizacion: 30/06/2020
 
8	* SVN 7.2: https://subversion.gva.es/svn/liferay-portales/liferay-portales-7_2/trunk/fuentes/plantillas/global
 
9	*
 
10	*#
 
11
 
12	<div class="webContent" style="float:none;">
 
13		#if($validator.isNotNull($reserved-article-title.data) || ($reserved-article-title.data!="") )
 
14		  <p class="header10">$reserved-article-title.data</p>
 
15		#end
 
16	</div>
 
17
 
18	##Dependiendo del valor de la variable posicion el Cuerpo se pinta arriba o abajo
 
19	##por lo que primero recogemos los valores en variables 
 
20
 
21	##Posición arriba/abajo.
 
22	#if ($validator.isNotNull($Posicion.getData()))
 
23		#set ($posicion=$Posicion.getData())
 
24	#end
 
25
 
26	##Texto en el cuerpo caja de texto enriquecido.
 
27	#set ($cuerpo="")
 
28	#if ($validator.isNotNull($!Cuerpo.getData()) || ($!Cuerpo.getData()!="") )
 
29		  #set ($cuerpo=$!Cuerpo.getData())
 
30	#end
 
31
 
32	<div class="iframe">
 
33	##Si el valor seleccionado es arriba entonces imprimimos el contenido del cuerpo.
 
34	#if ($posicion.equals("arriba"))
 
35	   <div class="texto_cuerpo"> 
 
36			$cuerpo
 
37	   </div>
 
38	#end
 
39
 
40	## Inicializamos las variables necesarias y definimos sus valores por defecto
 
41	#set($iframeId = $reserved-article-id.data) 
 
42	#set($width = "100%")
 
43	#set($height = "650")
 
44	#set($scrolling = "auto")
 
45	#set($src = "")
 
46	#set($ajustar_alto = false)
 
47	#set($mostrar_atras = true)
 
48	#set($mostrar_enlazar = false)
 
49	#set($mostrar_imprimir = false)
 
50
 
51	## Comprobamos valores rellenados por usuario
 
52
 
53	#if($validator.isNotNull($ancho.getData()) && $ancho.getData() != "")
 
54		#set($width = $ancho.getData())
 
55	#end
 
56
 
57	#if($validator.isNotNull($alto.getData()) && $alto.getData() != "")
 
58		#set($height = $alto.getData())
 
59	#end
 
60
 
61	#if($validator.isNotNull($barra_desplazamiento.getData()))
 
62		#set($scrolling = $barra_desplazamiento.getData())
 
63	#end
 
64
 
65	#if($validator.isNotNull($barra_desplazamiento.getData()))
 
66		#set($scrolling = $barra_desplazamiento.getData())
 
67	#end
 
68
 
69	#if($validator.isNotNull($url.getData()))
 
70		#set($src = $url.getData())
 
71	#end
 
72
 
73	#if($validator.isNotNull($autoajustar_alto.getData()) && $autoajustar_alto.getData() == "true")
 
74		#set($ajustar_alto = true)
 
75	#end
 
76
 
77	#if($validator.isNotNull($mostrar_enlace_atras.getData()) && $mostrar_enlace_atras.getData() == "false")
 
78		#set($mostrar_atras = false)
 
79	#end
 
80
 
81	#if($validator.isNotNull($mostrar_enlace_enlazar.getData()) && $mostrar_enlace_enlazar.getData() == "true")
 
82		#set($mostrar_enlazar = true)
 
83	#end
 
84
 
85	#if($validator.isNotNull($mostrar_boton_imprimir.getData()) && $mostrar_boton_imprimir.getData() == "true")
 
86		#set($mostrar_imprimir = true)
 
87	#end
 
88
 
89
 
90	## Obtengo el dominio actual
 
91	#set ($currentUrl = $request.get("attributes").CURRENT_COMPLETE_URL)
 
92	#set ($urlParts = $stringUtil.split($currentUrl, "/"))
 
93	#set ($currentdomain = "")
 
94	#set ($currentProtocol = "")
 
95	#foreach($urlPart in $urlParts)
 
96		#if ($velocityCount == 3)
 
97			#set ($currentDomain = $urlPart)
 
98		#end
 
99	#end
 
100
 
101	##Obtengo el dominio del iframe 
 
102	#set ($srcParts = $src.split("/"))
 
103	#set ($iframeDomain = "")
 
104	#set ($serverUrl = "")
 
105
 
106	#if ($srcParts.get(0).equals("http:") || $srcParts.get(0).equals("https:"))
 
107		#set ($iframeDomain = $srcParts.get(2))
 
108		#set ($iframeProtocol = $srcParts.get(0))
 
109		#set ($serverUrl = $iframeProtocol + "//" + $iframeDomain)
 
110	#end
 
111
 
112	#if($validator.isNotNull($src) )
 
113
 
114		## parámetros de la url del portal
 
115			#set($parameterList = $httpUtil.getParameterMap($httpUtil.getQueryString($request.attributes.CURRENT_URL)))
 
116			## ENT-308086 : Tenemos que ver si se ha añadido algún valor en el campo ignore_parametros
 
117			#if($validator.isNotNull($ignore_parametros.getData()))
 
118				#set ($ignoreParameters = $ignore_parametros.getData().split(";"))
 
119				#foreach($ignoreParameter in $ignoreParameters)
 
120					#if($parameterList.containsKey($ignoreParameter))
 
121						#set($void = $parameterList.remove($ignoreParameter))
 
122					#end		
 
123				#end
 
124			#end
 
125			## FIN ENT-308086
 
126			#set($sufijo = $httpUtil.parameterMapToString($parameterList))
 
127			#if($validator.isNotNull($sufijo))
 
128				## Establecemos la URL que se ha de ver en el iFrame, si se ha definido
 
129				#set($viewUrl = $parameterList.get("viewUrl${iframeId}").get(0))
 
130				#if ($validator.isNotNull($viewUrl))
 
131					#set($void = $parameterList.remove("viewUrl${iframeId}"))
 
132					#set($sufijo = $httpUtil.parameterMapToString($parameterList))
 
133					#set($src = $serverUrl + $viewUrl)
 
134				#end
 
135				
 
136				## INICIO ENT-316287
 
137				## DIFERENCIA CON LA PLANTILLA DE IFRAME GLOBAL
 
138				## SI NOS LLEGA UN PARÁMETRO A PARTIR DE LA URL POR LA QUE ACEDEMOS AL PORTAL
 
139				## ELIMINAMOS EL TEXTO "?param1=" Y REEMPLAZAMOS LO QUE HACE DE SEPARADOR PARA QUE LO PINTE CORRECTAMENTE
 
140				#set ($sufijo = $sufijo.replace("?param=","").replace("%2F","/"))
 
141				##FIN ENT-316287
 
142
 
143				
 
144				## Comprobamos si la URL ya trae parametros para concatenarlos
 
145				#set ($index = $src.indexOf('?'))
 
146				#if($index >= 0 )    
 
147					#set( $sufijo = $sufijo.replace("?", "&") )
 
148				#end
 
149				#set($src = "$src$sufijo" )
 
150			#end
 
151			
 
152			
 
153			<div class="iframe-error-protocol iframe-error-protocol-$reserved-article-id.data" style="display: none;"><span>#language('iframe.mensaje') <a href="$src" target="_blank"><b>#language('iframe.mensaje.ventana')</b></a></span></div>
 
154			
 
155			#if ($mostrar_enlazar || $mostrar_atras || $mostrar_imprimir)
 
156				<div class="iframe-controls iframe-controls-$reserved-article-id.data">
 
157					#if ($mostrar_atras)
 
158						<a class="back-link pull-right" id="iframe-back-link-$reserved-article-id.data" href="javascript:history.go(-1)">&laquo; #language('back')</a>
 
159					#end
 
160					#if ($mostrar_enlazar)
 
161						<a class="iframe-show-link pull-right" id="iframe-show-link-$reserved-article-id.data" tabindex="0">#language('iframe.enlazar')</a>
 
162						<div id="iframe-link-$reserved-article-id.data" class="iframe-link">
 
163							<input id="iframe-link-input-$reserved-article-id.data" class="iframe-link-input" type="text" style="display: none;" />
 
164						</div>
 
165					#end
 
166					#if ($mostrar_imprimir)
 
167						<a class="taglib-icon pull-right" id="iframe-print-$reserved-article-id.data" tabindex="0" target="_self"> 
 
168							<img class="icon" src="/GVA-theme/images/common/print.png" alt=""> 
 
169							<span class="taglib-text">#language('print')</span> 
 
170						</a> 
 
171					#end
 
172				</div>
 
173			#end
 
174			
 
175			<div id="iframe-container-$reserved-article-id.data">
 
176				<iframe src="$src" width="$width" height="$height" scrolling="$scrolling" title="$reserved-article-title.data" target="_blank" border="0" seamless="seamless" id="iframe-$reserved-article-id.data" name="iframe-$reserved-article-id.data"></iframe>
 
177			</div>
 
178
 
179	 
 
180			##Si el valor seleccionado es abajo imprimimos el contenido del cuerpo.
 
181			#if ($posicion.equals("abajo"))
 
182			  <div class="texto_cuerpo"> 
 
183				  $cuerpo
 
184			 </div>
 
185			#end
 
186			
 
187		</div>
 
188
 
189		<script type="text/javascript">
 
190		
 
191			##No es el mismo dominio, así que definimos el valor del document.domain
 
192			#if (($ajustar_alto || $mostrar_enlazar) && $validator.isNotNull($currentDomain) && $validator.isNotNull($iframeDomain) && !$currentDomain.equals($iframeDomain))
 
193				document.domain = 'gva.es';
 
194			#end
 
195			
 
196			##ENT-337637 Cogemos protocolo por js
 
197			if( location.protocol == "https:" &&  "${iframeProtocol}" == "http:" )
 
198				$('.portlet-journal-content .iframe-error-protocol-$reserved-article-id.data').css('display','block');
 
199			
 
200		
 
201			##Autoajustar el alto del iframe 
 
202			#if ($ajustar_alto)
 
203				## Al cambiar el tamaño de la ventana
 
204				##$(window).resize(function (){
 
205				##	var iframe = document.getElementById('iframe-$reserved-article-id.data');
 
206				##	iframe.style.height = (iframe.contentWindow.document.body.offsetHeight + 30 ) + 'px';
 
207				##});
 
208
 
209				## INICIO ENT-525601
 
210				## DIFERENCIA CON LA PLANTILLA DE IFRAME GLOBAL
 
211				## Se cambia la función para calcular el alto para que tenga en cuenta el alto de un tag del iframe
 
212				## También se aprovecha para coger un id del iframe y utilizar su texto para completar el breadcrumb
 
213				
 
214				##Autoajustar alto del iframe cada X milisengundos
 
215				var milisengundosRefresco = 100;
 
216				//milisengundosRefresco = 2000;
 
217			
 
218
 
219				var debug = false;
 
220				//debug = true;
 
221				setInterval(function() {
 
222					
 
223					/* Recogemos los diferentes elementos del DOM */
 
224					const iframeContainer 	= document.getElementById('iframe-container-$reserved-article-id.data');
 
225					const iframe 			= document.getElementById('iframe-$reserved-article-id.data');
 
226					const iframeWindow 		= iframe.contentWindow;
 
227					const iframeDocument 	= iframeWindow.document;				
 
228					const main 				= iframeDocument.querySelector("app-root main");
 
229					const header 			= iframeDocument.querySelector("app-root app-header header");
 
230					const legislation 		= iframeDocument.querySelector("app-root app-legislation-by-areas section");
 
231					
 
232				
 
233					/* Se setablecen los valores por defecto por si el contenido de iframe todavía no está cargado */
 
234					let mainScrollHeight 			 = 500;
 
235					let headerScrollHeight 			 = 500;
 
236					let iframeScrollHeight 			 = 0;
 
237					
 
238					/*Obtenemos los alto de los elementos*/
 
239					if(main){
 
240						mainScrollHeight = main.scrollHeight;
 
241					}else if(legislation){
 
242						mainScrollHeight = legislation.scrollHeight;
 
243					}
 
244					if(header){
 
245						headerScrollHeight = header.scrollHeight;
 
246					}
 
247					if(iframe){
 
248						iframeScrollHeight = iframe.scrollHeight
 
249					}
 
250					
 
251					
 
252					const margenAnyadido = 100;
 
253					
 
254					const alturaCalculada = mainScrollHeight + headerScrollHeight + margenAnyadido + 'px';
 
255					
 
256					if (debug) console.log("--------------------------------------");
 
257					if (debug) console.log("BUSCAMOS EL NUEVO ALTO DEL IFRAME");
 
258					if (debug) console.log("iframeScrollHeight = " 				+ iframeScrollHeight);
 
259					if (debug) console.log("mainScrollHeight = " 				+ mainScrollHeight);
 
260					if (debug) console.log("headerScrollHeight = " 				+ headerScrollHeight);
 
261					if (debug) console.log("alturaCalculada = " 				+ alturaCalculada);
 
262					if (debug) console.log("FIN BUSCAMOS EL NUEVO ALTO DEL IFRAME");
 
263					if (debug) console.log("--------------------------------------");
 
264					
 
265					if(iframeScrollHeight != mainScrollHeight){
 
266						iframe.style.height = alturaCalculada;
 
267					}
 
268
 
269					
 
270					/* ************************************************************************************ */
 
271					/* Cogemos del IFRAME del DOGV la parte del camino de migas que montan en la aplicacion */
 
272					/* ************************************************************************************ */
 
273					if (debug) console.log("--------------------------------------");
 
274					if (debug) console.log("BUSCAMOS EL BREADCRUMB");
 
275					
 
276					/* Definimos el selector del elemento dentro del iframe con el texto que se debe incluir en el iframe */
 
277					var bselector = 'breadcrumb-title';
 
278					var biframeselector = "iframe-"+bselector;
 
279					/* Definimos el selector del elemento del breadcrumb dentro del iframe */
 
280					var bselectorBreadcrumb = 'ul.breadcrumbs-horizontal';
 
281					var biframeDocument = iframeDocument;
 
282					var belement =  biframeDocument.getElementById(bselector);
 
283					if ((typeof belement !== 'undefined') && belement ) {
 
284						if (debug) console.log("Se ha encontrado el elemento: " + bselector); 
 
285						var text_to_add = belement.textContent;
 
286						if (debug) console.log("text_to_add: " + text_to_add);
 
287						if (text_to_add.length !== 0) {
 
288							/* Ya tenemos el texto ahora hay que buscar el elemento del breadcrumb donde incluirlo */
 
289							var bul = document.querySelector(bselectorBreadcrumb);
 
290							if ((typeof bul !== 'undefined') && bul) {
 
291								if (debug) console.log("Se encuentra el ul con el selector: " + bselectorBreadcrumb);
 
292								/* Tenemos que buscar si el elemento li ya existe o hay que crearlo */
 
293								var bli =  bul.querySelector("#"+biframeselector);
 
294								if ((typeof bli !== 'undefined') && bli) {
 
295									if (debug) console.log("Se encuentra el li con el selector: " + biframeselector);
 
296									var span = bli.getElementsByTagName("span")[0];
 
297									if (debug) console.log("Se encuentra el span");
 
298									span.innerHTML = text_to_add;
 
299								} else {
 
300									if (debug) console.log("Vamos a crear el li");
 
301									bli = document.createElement("li");
 
302									bli.setAttribute('id',biframeselector);
 
303									var span = document.createElement("span");
 
304									span.appendChild(document.createTextNode(text_to_add));
 
305									bli.appendChild(span)
 
306									bul.appendChild(bli)
 
307								}
 
308							}
 
309						}
 
310					}
 
311					if (debug) console.log("FIN BUSCAMOS EL BREADCRUMB");
 
312					if (debug) console.log("--------------------------------------");
 
313					
 
314				},milisengundosRefresco);
 
315				## FIN ENT-525601
 
316					
 
317			#end 
 
318			
 
319
 
320			$(document).ready(function() {
 
321		
 
322				##Autoajustar alto cada vez que se cargue el contenido del iframe
 
323				#if ($ajustar_alto)
 
324					$('#iframe-$reserved-article-id.data').load(function() {
 
325						this.style.height = (this.contentWindow.document.body.offsetHeight + 30 ) + 'px';
 
326					});
 
327				#end 
 
328
 
329				##Ocultar los enlaces de Atrás y Enlace permanente para que aparezcan sólo si se ha navegado dentro del iframe
 
330				#if ($mostrar_enlazar)
 
331					$('#iframe-show-link-$reserved-article-id.data').hide();
 
332				#end
 
333				#if ($mostrar_atras)
 
334					$('#iframe-back-link-$reserved-article-id.data').hide();
 
335				#end
 
336
 
337				var numLoads = 0;
 
338				document.getElementById('iframe-$reserved-article-id.data').onload = function (element) {
 
339					if (numLoads > 0) {
 
340						if ($(window).scrollTop() > $('#iframe-container-$reserved-article-id.data').offset().top) {
 
341							$('html, body').animate({ scrollTop: $('#iframe-container-$reserved-article-id.data').offset().top - 60 }, 'slow');
 
342						}
 
343						
 
344						#if ($mostrar_enlazar || $mostrar_atras)
 
345							$('#iframe-link-input-$reserved-article-id.data').fadeOut();
 
346						#end
 
347					}
 
348					
 
349					
 
350					if (numLoads == 1) {
 
351						#if ($mostrar_enlazar)
 
352							$('#iframe-show-link-$reserved-article-id.data').show();
 
353						#end
 
354						#if ($mostrar_atras)
 
355							$('.portlet-journal-content .iframe-controls-$reserved-article-id.data .back-link').show();
 
356						#end
 
357					}
 
358					
 
359					numLoads++;
 
360				}
 
361
 
362				##Obtener enlace permanente del iframe
 
363				#if ($mostrar_enlazar) 
 
364				$('#iframe-show-link-$reserved-article-id.data').click(function (event) {
 
365					//Cuando le damos click no queremos que se quede el marco del foco
 
366					$('#iframe-show-link-$reserved-article-id.data').blur();
 
367					
 
368					var input = $('#iframe-link-input-$reserved-article-id.data');
 
369					
 
370					if (!$(input).is(':visible')) {
 
371						var iframeLocation = document.getElementById('iframe-$reserved-article-id.data').contentWindow.location;
 
372						var pageUrl = window.location.href;
 
373						var iframeParams = iframeLocation.href;
 
374
 
375						if (pageUrl.includes('?')) {
 
376							pageUrl = pageUrl.substring(0, pageUrl.indexOf('?'));
 
377						}
 
378						
 
379						if (iframeParams.includes('?')) {
 
380							iframeParams = iframeParams.substring(iframeParams.indexOf('?')+1);
 
381							iframeParams = '&' + iframeParams.replace(/(&)?viewUrl=[^&]+/g, '');
 
382						} else {
 
383							iframeParams = '';
 
384						}
 
385						
 
386						$(input).val(pageUrl + '?viewUrl${iframeId}=' + encodeURIComponent(iframeLocation.pathname) + iframeParams);
 
387					}
 
388					$(input).fadeToggle();
 
389				});
 
390				##Para que funcione cuando le damos al enter
 
391				$('#iframe-show-link-$reserved-article-id.data').keyup(function(event){
 
392					if (event.keyCode == 13) {
 
393						event.preventDefault();
 
394						$('#iframe-show-link-$reserved-article-id.data').click();
 
395					}
 
396				});
 
397				#end
 
398
 
399				##Imprimimos sólo el contenido del iframe
 
400				#if ($mostrar_imprimir) 
 
401				$('#iframe-print-$reserved-article-id.data').click(function (event) {
 
402					var ifr = document.getElementById("iframe-$reserved-article-id.data");
 
403					ifr.contentWindow.focus();
 
404					ifr.contentWindow.print();		
 
405					//Cuando le damos click no queremos que se quede el marco del foco
 
406					$('#iframe-print-$reserved-article-id.data').blur();
 
407				});
 
408				
 
409				##Para que funcione cuando le damos al enter
 
410				$('#iframe-print-$reserved-article-id.data').keyup(function(event){
 
411					if (event.keyCode == 13) {
 
412						event.preventDefault();
 
413						$('#iframe-print-$reserved-article-id.data').click();
 
414					}
 
415				});
 
416				#end
 
417				
 
418				##El enlace « Atrás de los publicadores para los contenidos de tipo IFRAME, vuelve atrás en el historial para que deshaga una posible navegación realizada en la página incrustada
 
419				$("span[class='header-back-to']").find("a").attr("href", "javascript:window.history.back()"); 
 
420			});
 
421			
 
422			## Controlamos los click en el iframe para que si está desplegado el menu del portal, se esconda 		
 
423			var myConfObj = {
 
424			  iframeMouseOver : false
 
425			}
 
426			window.addEventListener('blur',function(event){
 
427			  if(myConfObj.iframeMouseOver){
 
428				// Ocultar menu desplegado cuando haces click en otro sitio distinto al menu
 
429				var $trigger = $(".horizontal .navegacion-superior .nav-menu .level-1 li, .sede .navegacion-superior .nav-menu .level-1 li");
 
430				$trigger.children('ul').slideUp(300);
 
431			  }
 
432			});
 
433			document.getElementById('iframe-container-$reserved-article-id.data').addEventListener('mouseover',function(){
 
434			   myConfObj.iframeMouseOver = true;
 
435			});
 
436			document.getElementById('iframe-container-$reserved-article-id.data').addEventListener('mouseout',function(){
 
437				myConfObj.iframeMouseOver = false;
 
438			});
 
439			
 
440
 
441		</script>
 
442	#else
 
443		No se ha introduccido una URL de iframe.
 
444	#end