Últimas Notícias
Conteúdo com Regiões Administrativas (Global) .
Um erro ocorreu enquanto processava o modelo.
Java method "com.sun.proxy.$Proxy101.getEntry(long, String)" threw an exception when invoked on com.sun.proxy.$Proxy101 object "com.liferay.asset.internal.service.AssetEntryAssetCategoryRelAssetEntryLocalServiceWrapper@2ed8f0ea"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #local assetEntry = assetEntryLocalSe... [in template "10136#10174#23634068" in function "getImageUrl" at line 90, column 5] - Reached through: ${getImageUrl(xmlValue)} [in template "10136#10174#23634068" in macro "newsListItem" at line 142, column 69] - Reached through: @newsListItem curEntry=curEntry [in template "10136#10174#23634068" at line 56, column 9] ----
1<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") />
2<#assign assetVocabularyLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService") />
3<#assign dlFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService") />
4<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
5
6<#setting time_zone = "GMT-03" />
7<#assign assetCategoryName = layout.getName(locale) />
8<#assign assetCategoryId = paramUtil.getLong(request, "p_r_p_categoryId") />
9<#assign alternativeCategory = "Notícia"/>
10
11<#if assetCategoryId?? && assetCategoryId != 0>
12 <#assign assetCategory = AssetCategoryLocalService.getCategory(assetCategoryId) />
13 <#assign assetCategoryName = assetCategory.getName() />
14</#if>
15
16<h2 class="text-center mb-40">${assetCategoryName}</h2>
17
18<#if entries?has_content>
19 <#if (entries?size > 2)>
20 <div class="row last-news mb-80">
21 <#list entries[0..1] as curEntry>
22 <#assign assetRenderer = curEntry.getAssetRenderer() />
23 <#assign docXml = saxReaderUtil.read(assetRenderer.getArticle().getContent()) />
24 <#assign xmlValue = docXml.valueOf("//dynamic-element[@name='Foto']/dynamic-content[@language-id='pt_BR']/text()") />
25 <#assign viewURL = "/-/${assetRenderer.getUrlTitle()}" />
26 <#assign categories = curEntry.getCategories() />
27
28 <div class="col-lg-6">
29 <a class="card card-horizontal h-100 p-0"href="${viewURL}" title="${curEntry.getTitle(locale)}">
30 <div class="d-flex align-items-end image-wrapper">
31 <div class="aspect-ratio aspect-ratio-3-to-2 bg-grey w-100">
32 <#attempt>
33 <#if xmlValue?has_content>
34 <img alt="thumbnail" class="aspect-ratio-item-fluid" src="${getImageUrl(xmlValue)}" />
35 <#else>
36 <span class="aspect-ratio-item-fluid"></span>
37 </#if>
38 <#recover>
39 <span class="aspect-ratio-item-fluid"></span>
40 </#attempt>
41 </div>
42 </div>
43 <div class="card-body p-3">
44 <span class="category text-uppercase">${categoryTema(curEntry.getCategories(), "Notícias")}</span>
45 <h3 class="title mb-0">${curEntry.getTitle(locale)}</h2>
46 <span class="subtitle">${curEntry.getPublishDate()?datetime?string["dd/MM/yyyy HH:mm"]}</span>
47 </div>
48 </a>
49 <@getEditIcon />
50 </div>
51 </#list>
52 </div>
53
54 <ul class="last-news list-unstyled">
55 <#list entries[2..] as curEntry>
56 <@newsListItem curEntry=curEntry />
57 </#list>
58 </ul>
59 <#else>
60 <ul class="last-news list-unstyled">
61 <#list entries as curEntry>
62 <@newsListItem curEntry=curEntry />
63 </#list>
64 </ul>
65 </#if>
66<#else>
67 <p class="text-center">Não há notícias para esta página no momento.</p>
68</#if>
69
70<style>
71 .news-item .title {
72 font-size: 1.375rem !important;
73 }
74</style>
75
76<#if assetCategoryName?has_content>
77 <style>
78 .taglib-categorization-filter {
79 display: none;
80 }
81 </style>
82 <script>$(".breadcrumb-item:last-child").html('<span class="active breadcrumb-text-truncate">${assetCategoryName}</span>');</script>
83</#if>
84
85<#function getImageUrl xmlValue>
86 <#if xmlValue?has_content>
87 <#local JSONFactoryUtil = staticUtil["com.liferay.portal.kernel.json.JSONFactoryUtil"] />
88 <#local assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
89 <#local imgJson = JSONFactoryUtil.createJSONObject(xmlValue) />
90 <#local assetEntry = assetEntryLocalService.getEntry(getterUtil.getLong(imgJson.groupId), imgJson.uuid) />
91 <#local assetRenderer = assetEntry.assetRenderer />
92 <#return assetRenderer.getURLDownload(themeDisplay) + "&imageThumbnail=2" />
93 <#else>
94 <#return "" />
95 </#if>
96</#function>
97
98<#-- FUNÇÃO: RETORNAR A CATEGORIA DO TEMA -->
99<#function categoryTema categories alternativeCategory>
100 <#local category_retranca = [] />
101 <#local category_temas = [] />
102 <#local categories_list = [] />
103
104 <#if categories?has_content>
105 <#list categories as category>
106 <#local vocabularyId = category.getVocabularyId() />
107 <#local vocabulary = assetVocabularyLocalService.getVocabulary(vocabularyId) />
108
109 <#if (category.getName() != assetCategoryName)>
110 <#if vocabulary.getName()?lower_case == "temas">
111 <#local category_temas = category_temas + [category]>
112 <#elseif vocabulary.getName()?lower_case == "retranca">
113 <#local category_retranca = category_retranca + [category]>
114 </#if>
115 </#if>
116 </#list>
117 </#if>
118
119 <#local categories_list = category_retranca + category_temas />
120
121 <#if categories_list?has_content>
122 <#return categories_list?first.getName() />
123 <#else>
124 <#return alternativeCategory />
125 </#if>
126</#function>
127
128<#-- MACRO:ITEM DE NOTÍCIA DO TIPO LISTA -->
129<#macro newsListItem curEntry>
130 <#assign assetRenderer = curEntry.getAssetRenderer() />
131 <#assign docXml = saxReaderUtil.read(assetRenderer.getArticle().getContent()) />
132 <#assign xmlValue = docXml.valueOf("//dynamic-element[@name='Foto']/dynamic-content[@language-id='pt_BR']/text()") />
133 <#assign sutia = docXml.valueOf("//dynamic-element[@name='Chamada']/dynamic-content[@language-id='pt_BR']/text()") />
134 <#assign texto = docXml.valueOf("//dynamic-element[@name='Texto']/dynamic-content[@language-id='pt_BR']/text()")?replace('<[^>]+>','','r') />
135 <#assign viewURL = "/-/${assetRenderer.getUrlTitle()}" />
136 <#assign categories = curEntry.getCategories() />
137
138 <li class="news-item relative row align-items-center">
139 <#if xmlValue?has_content>
140 <a class="col-md-3"href="${viewURL}" title="${curEntry.getTitle(locale)}">
141 <div class="aspect-ratio aspect-ratio-3-to-2 bg-grey d-block img-shadow">
142 <img alt="thumbnail" class="aspect-ratio-item-fluid" src="${getImageUrl(xmlValue)}"/>
143 </div>
144 </a>
145 </#if>
146
147 <a class="col-md-9 ${xmlValue?has_content?then('col-md-9','col-md-12')}" href="${viewURL}" title="${curEntry.getTitle(locale)}">
148 <span class="category text-uppercase">${categoryTema(curEntry.getCategories(), "Notícia")}</span>
149 <h5 class="title"><b>${curEntry.getTitle(locale)}</b></h5>
150 <#if sutia?has_content && sutia != "">
151 <h6>${sutia}</h6>
152 <#else>
153 <#if (texto?length > 160)>
154 <h6>${texto?substring(0, 160)}...</h6>
155 <#else>
156 <h6>${texto}</h6>
157 </#if>
158 </#if>
159 <span class="subtitle">${curEntry.getPublishDate()?datetime?string["dd/MM/yyyy HH:mm"]}</span>
160 </a>
161 <@getEditIcon />
162 </li>
163</#macro>
164
165<#-- MACRO: BOTÃO PARA EDITAR O CONTEÚDO -->
166<#macro getEditIcon>
167 <#if assetRenderer.hasEditPermission(themeDisplay.getPermissionChecker())>
168 <#assign editPortletURL = assetRenderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("NORMAL"), themeDisplay.getURLCurrent())!"" />
169 <#if validator.isNotNull(editPortletURL)>
170 <@liferay_ui["icon"] cssClass="icon-monospaced visible-interaction" iconCssClass="las la-edit" message="Editar" target="_blank" url=editPortletURL.toString()/>
171 </#if>
172 </#if>
173</#macro>
— 10 Itens por página