Encerrados
An error occurred while processing the template.
Java method "com.liferay.portal.kernel.util.DateUtil_IW.parseDate(String, String, Locale)" threw an exception when invoked on com.liferay.portal.kernel.util.DateUtil_IW object "com.liferay.portal.kernel.util.DateUtil_IW@5b496c60"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign displayDate = dateUtil.parseD... [in template "57149678738875#20119#8573035" at line 10, column 1] ----
1<#-- SERVIÇOS -->
2<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
3<#assign AssetCategoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") />
4
5<#-- VARIÁVEIS -->
6<#assign groupId = themeDisplay.getCompanyGroupId() />
7<#assign currentArticle = JournalArticleLocalService.getArticle(articleGroupId, .vars['reserved-article-id'].data) />
8<#assign classPK = currentArticle.getResourcePrimKey() />
9<#assign categories = AssetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle", classPK) />
10<#assign displayDate = dateUtil.parseDate("EEE, d MMM yyyy HH:mm:ss Z", .vars['reserved-article-create-date'].data, locale)?string("dd/MM/yyyy ' às ' HH'h'mm") />
11<#assign modifiedDate = dateUtil.parseDate("EEE, d MMM yyyy HH:mm:ss Z", .vars['reserved-article-modified-date'].data, locale)?string("dd/MM/yyyy ' às ' HH'h'mm") />
12<#assign images = news_images.getSiblings()?filter(imagem -> (imagem.getData())?? && imagem.getData() != "") />
13<#assign viewFullURL = themeDisplay.getPortalURL() + themeDisplay.getURLCurrent() />
14<#assign hasArquivados = false />
15
16<div class="noticia-gdf row">
17<#assign fromCategoryPage = .vars['fromCategoryPage']?default('false') == 'true' />
18
19<#assign categories = AssetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle", classPK) />
20
21<#-- Verifique se a categoria "Arquivados" está presente -->
22<#assign hasArquivados = false />
23<#list categories as category>
24 <#if category.getName()?lower_case == "arquivados">
25 <#assign hasArquivados = true />
26 </#if>
27</#list>
28
29<#-- Exibe a categoria "Arquivados" apenas se a página de origem contiver '/category/' -->
30<#if hasArquivados>
31 <span data-category-url="/web/guest/category/arquivados"
32 id="journalCategory"
33 data-category-name="Arquivados"></span>
34<#else>
35 <#-- Se não tiver "Arquivados" ou não for uma página de categoria, exibe as demais categorias -->
36 <#list categories as category>
37 <#assign vocabulary = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService").getVocabulary(category.getVocabularyId()) />
38
39 <#assign categoryUrlMapping = {
40 "noticia": "noticias",
41 "destaque": "modulo-carrossel-de-destaques-principais",
42 "Serviços para o beneficiário": "servicos-para-o-beneficiario-2",
43 "Perfil dos Diretores": "/o-iprev/perfil-dos-diretores",
44 "MODULO-15-BOTOES": "servicos-mais-procurados"
45 } />
46
47 <#assign urlPrefix = "/web/guest/category/" />
48
49 <#assign categoryUrl = urlPrefix + (categoryUrlMapping[category.getName()?lower_case]!category.getName()?lower_case?replace(' ', '-')) />
50
51 <span data-category-url="${categoryUrl}"
52 id="journalCategory"
53 data-category-id="${category.getCategoryId()}"
54 data-category-name="${category.getName()}"></span>
55 </#list>
56</#if>
57
58<div class="container">
59<div class="col-md-9 col-md-offset-1">
60 <h3>${.vars['reserved-article-title'].data}</h3>
61
62 <#if author.getData()?has_content>
63 <p class="autor-text">${author.getData()}</p>
64 </#if>
65
66 <#if images?has_content>
67 <#if images?size == 1>
68 <#list images as cur_news_image>
69 <#if cur_news_image.getData()?? && cur_news_image.getData() != "">
70 <img class="d-block w-100" src="${cur_news_image.getData()}" />
71 <#if cur_news_image.attributes.alt??>
72 <p class="text-center mt-2 mb-5"><em>${cur_news_image.attributes.alt}</em></p>
73 </#if>
74 </#if>
75 </#list>
76 <#else>
77 <div id="carousel-${randomNamespace}" class="carousel slide mb-4" data-ride="carousel" data-interval="false">
78 <div class="carousel-inner">
79 <#list images as cur_news_image>
80 <div class="carousel-item ${cur_news_image?is_first?then('active', '')}">
81 <img class="d-block w-100" src="${cur_news_image.getData()}" />
82 <#if cur_news_image.attributes.alt??>
83 <p class="text-center mt-2 mb-5"><em>${cur_news_image.attributes.alt}</em></p>
84 </#if>
85 </div>
86 </#list>
87 </div>
88 <a class="carousel-control-prev" href="#carousel-${randomNamespace}" role="button" data-slide="prev">
89 <span class="carousel-control-prev-icon" aria-hidden="true"></span>
90 <span class="sr-only">Previous</span>
91 </a>
92 <a class="carousel-control-next" href="#carousel-${randomNamespace}" role="button" data-slide="next">
93 <span class="carousel-control-next-icon" aria-hidden="true"></span>
94 <span class="sr-only">Next</span>
95 </a>
96 </div>
97 </#if>
98 </#if>
99
100
101 <div class="materia">${content.getData()}</div>
102
103 <#if news_documents.getSiblings()?has_content && news_documents.getSiblings()?first.getData() != "">
104 <h4 class="mt-4">Anexos</h4>
105 <ul class="list-unstyled">
106 <#list news_documents.getSiblings() as cur_news_document>
107 <#assign title = cur_news_document.getData()?keep_before_last("?")?split('/')[4] />
108 <a href="${cur_news_document.getData()?keep_before_last('/')}" target="_blank" class="d-block news-document">
109 ${title}
110 </a>
111 </#list>
112 </ul>
113 <script>
114 document.querySelectorAll(".news-document").forEach(function(element) {
115 element.textContent = decodeURI(element.textContent);
116 });
117 </script>
118 </#if>
119</div>
120</div>
121
122<#-- MACRO: COMPARTILHAR -->
123<#macro share>
124 <div class="share">
125 <a class="facebook" href="https://www.facebook.com/sharer.php?u=${viewFullURL}" target="_blank">Facebook</a>
126 <a class="twitter" href="http://twitter.com/intent/tweet?text=${.vars['reserved-article-title'].data}%0AVeja%20mais%20em:&url=${viewFullURL}" target="_blank">Twitter</a>
127 </div>
128</#macro>
129
130<script>
131 Liferay.on('allPortletsReady', function() {
132 function getPreviousPageUrl() {
133 return document.referrer || '';
134 }
135
136 function checkPreviousPage() {
137 var previousPageUrl = getPreviousPageUrl();
138 var fromCategoryPage = previousPageUrl.includes('/category/') ? 'true' : 'false';
139
140 // Defina a variável de contexto para o FreeMarker
141 var meta = document.createElement('meta');
142 meta.name = 'fromCategoryPage';
143 meta.content = fromCategoryPage;
144 document.head.appendChild(meta);
145 }
146
147 checkPreviousPage();
148
149 var breadcrumbList = document.querySelector(".breadcrumb");
150 var hasArquivados = false;
151
152 // Verifica se o breadcrumb já contém "Arquivados"
153 if (breadcrumbList) {
154 var breadcrumbItems = breadcrumbList.querySelectorAll(".breadcrumb-item");
155 breadcrumbItems.forEach(function(item) {
156 if (item.textContent.trim().toLowerCase() === "arquivados") {
157 hasArquivados = true;
158 }
159 });
160 }
161
162 // Se "Arquivados" não estiver presente, adicione a categoria "Arquivados"
163if (!hasArquivados) {
164 var categorySpan = document.getElementById("journalCategory");
165 if (categorySpan) {
166 var categoryName = categorySpan.getAttribute("data-category-name");
167 var categoryUrl = categorySpan.getAttribute("data-category-url");
168
169 var newBreadcrumbItem = document.createElement("li");
170 newBreadcrumbItem.className = "breadcrumb-item";
171 newBreadcrumbItem.style.fontSize = "13px";
172
173 if (categoryUrl) {
174 var categoryLink = document.createElement("a");
175 categoryLink.href = categoryUrl;
176 categoryLink.textContent = categoryName;
177 categoryLink.style.paddingLeft = "8px";
178 categoryLink.className = "breadcrumb-link 1";
179 newBreadcrumbItem.appendChild(categoryLink);
180 } else {
181 newBreadcrumbItem.textContent = categoryName;
182 }
183
184 if (breadcrumbList && breadcrumbList.lastElementChild) {
185 breadcrumbList.insertBefore(newBreadcrumbItem, breadcrumbList.lastElementChild);
186 }
187 }
188}
189
190 // Atualiza o iframe existente
191 var oldIframe = document.querySelector('iframe');
192 if (oldIframe) {
193 var parentElement = oldIframe.parentNode;
194 var newIframe = oldIframe.cloneNode(true);
195
196 newIframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
197 newIframe.setAttribute('src', oldIframe.getAttribute('src'));
198 newIframe.setAttribute('allowfullscreen', oldIframe.hasAttribute('allowfullscreen'));
199 newIframe.setAttribute('frameborder', oldIframe.getAttribute('frameborder'));
200 newIframe.setAttribute('height', oldIframe.getAttribute('height'));
201 newIframe.setAttribute('width', oldIframe.getAttribute('width'));
202 newIframe.setAttribute('title', oldIframe.getAttribute('title'));
203
204 parentElement.replaceChild(newIframe, oldIframe);
205 }
206 });
207</script>
208</div>