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)">« #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 ##Funcion para ver si el dispositivo es IOS
219 function iOS() {
220 const userAgent = navigator.userAgent;
221 const isSafari = /Safari/.test(userAgent) && !/Chrome/.test(userAgent) && !/Chromium/.test(userAgent);
222 return isSafari;
223 }
224
225
226 var debug = false;
227 debug = true;
228 setInterval(function() {
229
230 if (debug) console.log("--------------------------------------");
231 if (debug) console.log("BUSCAMOS EL NUEVO ALTO DEL IFRAME");
232
233 /* Recogemos los diferentes elementos del DOM */
234 var iframeContainer = document.getElementById('iframe-container-$reserved-article-id.data');
235 var iframe = document.getElementById('iframe-$reserved-article-id.data');
236 var iframeWindow = iframe.contentWindow;
237 var iframeDocument = iframeWindow.document;
238 var iframeDocumentElement = iframeDocument.documentElement;
239
240 /* Vemos si se trata de un iphone */
241
242
243 /* A la altura calculada del iframe le vamos a dar un margen de maniobra añadido */
244 var margenAnyadido = 30;
245
246 /* Calculamos la altura en pixeles actual del contenedor del iframe */
247 var alturaContenedorIframe = 0;
248 alturaContenedorIframe = iframe.style.height.replace('px', '');
249
250 /* Vamos a intentar calcular la altura actual del contenido del iframe */
251 /* Recogemos todas estas posibles variables de la altura */
252 var iframeOffsetHeight = iframe.offsetHeight;
253 var iframeScrollHeight = iframe.scrollHeight;
254 var iframeDocumentElementClientHeight = iframeDocumentElement.clientHeight;
255 var iframeDocumentElementScrollHeight = iframeDocumentElement.scrollHeight;
256 var iframeDocumentElementOffsetHeight = iframeDocumentElement.offsetHeight;
257
258 /* Comprobamos que las variables existan */
259 if (!(typeof iframeOffsetHeight !== 'undefined')) {iframeOffsetHeight=0;}
260 if (!(typeof iframeScrollHeight !== 'undefined')) {iframeScrollHeight=0;}
261 if (!(typeof iframeDocumentElementClientHeight !== 'undefined')) {iframeDocumentElementClientHeight=0;}
262 if (!(typeof iframeDocumentElementScrollHeight !== 'undefined')) {iframeDocumentElementScrollHeight=0;}
263 if (!(typeof iframeDocumentElementOffsetHeight !== 'undefined')) {iframeDocumentElementOffsetHeight=0;}
264
265 /* Anular las variables
266 var iframeScrollHeight = 0;
267 var iframeDocumentElementClientHeight = 0;
268 var iframeDocumentElementScrollHeight = 0;
269 var iframeDocumentElementOffsetHeight = 0;
270 */
271
272 /* Nos quedamos con el mayor de los valores */
273 var nuevaAltura = Math.max( iframeScrollHeight, iframeOffsetHeight,
274 iframeDocumentElementClientHeight, iframeDocumentElementScrollHeight, iframeDocumentElementOffsetHeight );
275
276 if (debug) console.log("--------------------------------------");
277 if (debug) console.log("margenAnyadido = "+ margenAnyadido);
278 if (debug) console.log("alturaContenedorIframe = "+ alturaContenedorIframe);
279 if (debug) console.log("iframeOffsetHeight = "+ iframeOffsetHeight);
280 if (debug) console.log("iframeScrollHeight = "+ iframeScrollHeight);
281 if (debug) console.log("iframeDocumentElementClientHeight = "+ iframeDocumentElementClientHeight);
282 if (debug) console.log("iframeDocumentElementScrollHeight = "+ iframeDocumentElementScrollHeight);
283 if (debug) console.log("iframeDocumentElementOffsetHeight = "+ iframeDocumentElementOffsetHeight);
284 if (debug) console.log("nuevaAltura = "+ nuevaAltura);
285
286 /**************************************************/
287 var nomElement = "app-root";
288 const element = iframeDocument.getElementsByTagName(nomElement)[0];
289
290 if ((typeof element !== 'undefined')) {
291 alturaElement = element.offsetHeight;
292 if (debug) console.log("alturaElement " + nomElement + " = "+ alturaElement);
293 // Si es IOS no cambiamos la altura
294 if (iOS()){
295 console.log("Es Safari");
296 if(alturaElement != 0){
297 nuevaAltura = alturaElement;
298 if (debug) console.log("nuevaAltura basada en el element " + nomElement + " = "+ nuevaAltura);
299 }
300
301 }
302 if (debug) console.log("nuevaAltura final " + nomElement + " = "+ nuevaAltura);
303 }
304 /**************************************************/
305
306
307
308 /* Sólo cambiamos el alto del contenedor del iframe si es diferente al actual */
309 if(alturaContenedorIframe > nuevaAltura || alturaContenedorIframe < nuevaAltura){
310 /* Cambiamos el alto del contenedor del iframe con el nuevo alto mas el margen indicado*/
311 //nuevaAltura = nuevaAltura + margenAnyadido;
312 iframe.style.height = nuevaAltura + 'px';
313
314 if (debug) console.log("** nuevaAltura + margenAnyadido= "+ nuevaAltura + " **");
315 }
316
317 if (debug) console.log("FIN BUSCAMOS EL NUEVO ALTO DEL IFRAME");
318 if (debug) console.log("--------------------------------------");
319
320
321 /* ************************************************************************************ */
322 /* Cogemos del IFRAME del DOGV la parte del camino de migas que montan en la aplicacion */
323 /* ************************************************************************************ */
324 if (debug) console.log("--------------------------------------");
325 if (debug) console.log("BUSCAMOS EL BREADCRUMB");
326
327 /* Definimos el selector del elemento dentro del iframe con el texto que se debe incluir en el iframe */
328 var bselector = 'breadcrumb-title';
329 var biframeselector = "iframe-"+bselector;
330 /* Definimos el selector del elemento del breadcrumb dentro del iframe */
331 var bselectorBreadcrumb = 'ul.breadcrumbs-horizontal';
332 var biframeDocument = iframeDocument;
333 var belement = biframeDocument.getElementById(bselector);
334 if ((typeof belement !== 'undefined') && belement ) {
335 if (debug) console.log("Se ha encontrado el elemento: " + bselector);
336 var text_to_add = belement.textContent;
337 if (debug) console.log("text_to_add: " + text_to_add);
338 if (text_to_add.length !== 0) {
339 /* Ya tenemos el texto ahora hay que buscar el elemento del breadcrumb donde incluirlo */
340 var bul = document.querySelector(bselectorBreadcrumb);
341 if ((typeof bul !== 'undefined') && bul) {
342 if (debug) console.log("Se encuentra el ul con el selector: " + bselectorBreadcrumb);
343 /* Tenemos que buscar si el elemento li ya existe o hay que crearlo */
344 var bli = bul.querySelector("#"+biframeselector);
345 if ((typeof bli !== 'undefined') && bli) {
346 if (debug) console.log("Se encuentra el li con el selector: " + biframeselector);
347 var span = bli.getElementsByTagName("span")[0];
348 if (debug) console.log("Se encuentra el span");
349 span.innerHTML = text_to_add;
350 } else {
351 if (debug) console.log("Vamos a crear el li");
352 bli = document.createElement("li");
353 bli.setAttribute('id',biframeselector);
354 var span = document.createElement("span");
355 span.appendChild(document.createTextNode(text_to_add));
356 bli.appendChild(span)
357 bul.appendChild(bli)
358 }
359 }
360 }
361 }
362 if (debug) console.log("FIN BUSCAMOS EL BREADCRUMB");
363 if (debug) console.log("--------------------------------------");
364
365 },milisengundosRefresco);
366 ## FIN ENT-525601
367
368 #end
369
370
371 $(document).ready(function() {
372
373 ##Autoajustar alto cada vez que se cargue el contenido del iframe
374 #if ($ajustar_alto)
375 $('#iframe-$reserved-article-id.data').load(function() {
376 this.style.height = (this.contentWindow.document.body.offsetHeight + 30 ) + 'px';
377 });
378 #end
379
380 ##Ocultar los enlaces de Atrás y Enlace permanente para que aparezcan sólo si se ha navegado dentro del iframe
381 #if ($mostrar_enlazar)
382 $('#iframe-show-link-$reserved-article-id.data').hide();
383 #end
384 #if ($mostrar_atras)
385 $('#iframe-back-link-$reserved-article-id.data').hide();
386 #end
387
388 var numLoads = 0;
389 document.getElementById('iframe-$reserved-article-id.data').onload = function (element) {
390 if (numLoads > 0) {
391 if ($(window).scrollTop() > $('#iframe-container-$reserved-article-id.data').offset().top) {
392 $('html, body').animate({ scrollTop: $('#iframe-container-$reserved-article-id.data').offset().top - 60 }, 'slow');
393 }
394
395 #if ($mostrar_enlazar || $mostrar_atras)
396 $('#iframe-link-input-$reserved-article-id.data').fadeOut();
397 #end
398 }
399
400
401 if (numLoads == 1) {
402 #if ($mostrar_enlazar)
403 $('#iframe-show-link-$reserved-article-id.data').show();
404 #end
405 #if ($mostrar_atras)
406 $('.portlet-journal-content .iframe-controls-$reserved-article-id.data .back-link').show();
407 #end
408 }
409
410 numLoads++;
411 }
412
413 ##Obtener enlace permanente del iframe
414 #if ($mostrar_enlazar)
415 $('#iframe-show-link-$reserved-article-id.data').click(function (event) {
416 //Cuando le damos click no queremos que se quede el marco del foco
417 $('#iframe-show-link-$reserved-article-id.data').blur();
418
419 var input = $('#iframe-link-input-$reserved-article-id.data');
420
421 if (!$(input).is(':visible')) {
422 var iframeLocation = document.getElementById('iframe-$reserved-article-id.data').contentWindow.location;
423 var pageUrl = window.location.href;
424 var iframeParams = iframeLocation.href;
425
426 if (pageUrl.includes('?')) {
427 pageUrl = pageUrl.substring(0, pageUrl.indexOf('?'));
428 }
429
430 if (iframeParams.includes('?')) {
431 iframeParams = iframeParams.substring(iframeParams.indexOf('?')+1);
432 iframeParams = '&' + iframeParams.replace(/(&)?viewUrl=[^&]+/g, '');
433 } else {
434 iframeParams = '';
435 }
436
437 $(input).val(pageUrl + '?viewUrl${iframeId}=' + encodeURIComponent(iframeLocation.pathname) + iframeParams);
438 }
439 $(input).fadeToggle();
440 });
441 ##Para que funcione cuando le damos al enter
442 $('#iframe-show-link-$reserved-article-id.data').keyup(function(event){
443 if (event.keyCode == 13) {
444 event.preventDefault();
445 $('#iframe-show-link-$reserved-article-id.data').click();
446 }
447 });
448 #end
449
450 ##Imprimimos sólo el contenido del iframe
451 #if ($mostrar_imprimir)
452 $('#iframe-print-$reserved-article-id.data').click(function (event) {
453 var ifr = document.getElementById("iframe-$reserved-article-id.data");
454 ifr.contentWindow.focus();
455 ifr.contentWindow.print();
456 //Cuando le damos click no queremos que se quede el marco del foco
457 $('#iframe-print-$reserved-article-id.data').blur();
458 });
459
460 ##Para que funcione cuando le damos al enter
461 $('#iframe-print-$reserved-article-id.data').keyup(function(event){
462 if (event.keyCode == 13) {
463 event.preventDefault();
464 $('#iframe-print-$reserved-article-id.data').click();
465 }
466 });
467 #end
468
469 ##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
470 $("span[class='header-back-to']").find("a").attr("href", "javascript:window.history.back()");
471 });
472
473 ## Controlamos los click en el iframe para que si está desplegado el menu del portal, se esconda
474 var myConfObj = {
475 iframeMouseOver : false
476 }
477 window.addEventListener('blur',function(event){
478 if(myConfObj.iframeMouseOver){
479 // Ocultar menu desplegado cuando haces click en otro sitio distinto al menu
480 var $trigger = $(".horizontal .navegacion-superior .nav-menu .level-1 li, .sede .navegacion-superior .nav-menu .level-1 li");
481 $trigger.children('ul').slideUp(300);
482 }
483 });
484 document.getElementById('iframe-container-$reserved-article-id.data').addEventListener('mouseover',function(){
485 myConfObj.iframeMouseOver = true;
486 });
487 document.getElementById('iframe-container-$reserved-article-id.data').addEventListener('mouseout',function(){
488 myConfObj.iframeMouseOver = false;
489 });
490
491
492 </script>
493 #else
494 No se ha introduccido una URL de iframe.
495 #end