CURSO PROSERVIDOR - Unidade Cível - Escola Judicial
An error occurred while processing the template.
The following has evaluated to null or missing: ==> smallImageId [in template "10132#10165#16116444" at line 46, column 73] ---- Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${smallImageId} [in template "10132#10165#16116444" at line 46, column 71] ----
1#macro(showThumb $imagem $imagemLegenda $imagemAlign $imagemId)
2 ## service and image ids from selected URL in image field
3 #set ( $imageService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService") )
4 #set ( $imageUuid = $httpUtil.getParameter($imagem, 'uuid', false) )
5 #set ( $imageGroupId = $httpUtil.getParameter($imagem, 'groupId', false) )
6
7 ## retrieve all kind of image id from it's URL for compatibility
8 #set ( $imageId = $httpUtil.getParameter($imagem, 'fileEntryId', false) )
9 #if ( $imageUuid.empty && $imageGroupId.empty && $imageId.empty )
10 #set ($imageId = $httpUtil.getParameter($imagem, 'image_id', false) )
11 #if ( $imageId.empty )
12 #set ( $imageId = $httpUtil.getParameter($imagem, 'img_id', false) )
13 #if ( $imageId.empty )
14 #set ( $imageId = $httpUtil.getParameter($imagem, 'i_id', false) )
15 #end
16 #end
17 #end
18
19 ## retrieve the image file object
20 #if( !$imageId.empty || ( !$imageUuid.empty && !$imageGroupId.empty ) )
21 #if( !$imageId.empty )
22 #set ( $dlFileEntry = $imageService.getFileEntry($getterUtil.getLong($imageId)) )
23
24 #elseif( !$imageUuid.empty && !$imageGroupId.empty )
25 #set ( $dlFileEntry = $imageService.getFileEntryByUuidAndGroupId($imageUuid, $getterUtil.getLong($imageGroupId)) )
26 #end
27
28 ## test if image was found
29 #if ( $dlFileEntry )
30 ## get specific service to retrieve image custom sizes for compatibility
31 ## try to get big image if available (750px) - quality requirement
32 #set ( $smallImageId = $dlFileEntry.getCustom2ImageId() )
33 #if( $smallImageId <= 0 )
34 ## try to get medium image if available (450px) - quality requirement
35 #set ( $smallImageId = $dlFileEntry.getCustom1ImageId() )
36 #if( $smallImageId <= 0 )
37 ##get smallest image - thumbnail (150px)
38 #set ( $smallImageId = $dlFileEntry.getSmallImageId() )
39 #end
40 #end
41 #if ( $smallImageId > 0 )
42 #set ( $imageService = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLAppLocalService") )
43 #set ( $fileEntry = $imageService.getFileEntry($dlFileEntry.getFileEntryId()) )
44 ## method invoked to generate custom thumbnails if it doesn't exists
45 #set ( $imagem = $dlUtil.getImagePreviewURL($fileEntry, $themeDisplay) )
46 #set ( $imagem = "/image/image_gallery?img_id=${smallImageId}&t=${webServerToken.getToken($smallImageId)}" )
47 #end
48 #else
49 #set ( $imagem = "" )
50 #end
51
52 #elseif( !$imagem.empty )
53 #set ( $imagem = $imagem + $imagemSize )
54 #end
55
56 #if( !$imagem.empty )
57 <a id="$imagemId" class="thumbnail $imagemAlign" href="$imagem" title="$imagemLegenda">
58 <img alt="$imagemLegenda" src="$imagem" />
59 <span>$imagemLegenda</span>
60 </a>
61 #end
62#end
63
64## get first structure fields
65#set ( $imagem = $Texto.getChildren().get(1).getData() )
66#set ( $imagemSize = '&imageThumbnail=3' )
67#set ( $imagemAlign = $Texto.getChildren().get(0).getData() )
68#set ( $imagemLegenda = "" )
69#if( $Texto.getChildren().get(1).getChildren().size() > 0 )
70 #set ( $imagemLegenda = $Texto.getChildren().get(1).getChildren().get(0).getData() )
71#end
72
73#if( $imagemAlign == "Esquerda" )
74 #set ( $imagemAlign = 'pull-left' )
75#elseif($imagemAlign == "Direita")
76 #set ( $imagemAlign = 'pull-right' )
77#else
78 #set ( $imagemAlign = 'text-center' )
79#end
80
81<div id="modelo_noticia" class="row-fluid">
82 <div class="row-fluid">
83 #showThumb("$imagem" "$imagemLegenda" "$imagemAlign" "imagem_corpo")
84 $Texto.getData()
85 </div>
86 <div class="row-fluid">
87 <ul class="thumbnails" >
88 #foreach( $imagemQuadro in $TituloImagens.getChildren().get(0).getSiblings() )
89 #set ( $imagem = $imagemQuadro.getData() )
90 #set ( $imagemLegenda = "" )
91 #if( $imagemQuadro.getChildren().size() > 0 )
92 #set ( $imagemLegenda = $imagemQuadro.getChildren().get(0).getData() )
93 #end
94 #if( !$imagem.empty )
95 <li id="imagem_galeria" class="span4">
96 #showThumb("$imagem" "$imagemLegenda" "" "imagem_galeria")
97 </li>
98 #end
99 #end
100 </ul>
101 </div>
102</div>
103
104<script type="text/javascript">
105 AUI().ready('aui-image-viewer-gallery', function(A) {
106 var viewportRegion = A.getDoc().get('viewportRegion');
107 var maxHeight = (viewportRegion.height);
108 var maxWidth = (viewportRegion.width);
109 var imageGallery1 = new A.ImageGallery({
110 links : '.thumbnail',
111 caption : 'Imagens',
112 autoPlay : true,
113 paginator : {},
114 maxHeight : maxHeight,
115 maxWidth : maxWidth,
116 delay : 5000
117 }).render();
118 });
119</script>
120
121<style>
122 #imagem_corpo {
123 margin-left: 5px;
124 max-width: 450px;
125 }
126
127 #imagem_galeria {
128 margin-left: 5px;
129 min-height: 200px;
130 }
131
132 #imagem_galeria img {
133 max-height: 200px;
134 }
135
136 @media (max-width: 679px) {
137 #imagem_corpo {
138 max-width: 100%;
139 }
140
141 #imagem_galeria {
142 margin-left: 3px;
143 }
144
145 #imagem_galeria img {
146 max-height: 100%;
147 }
148 }
149</style>