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