COMPARTILHAR
テンプレート処理中にエラーが発生しました。
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@5d63dd5c"; see cause exception in the Java stack trace. ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign displayDate = dateUtil.parseD... [in template "57149678738875#20119#36588" 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 <span class="time-text">${displayDate} - Atualizado em ${modifiedDate}</span>
61 <h3>${.vars['reserved-article-title'].data}</h3>
62
63 <#if !getterUtil.getBoolean(networks_share.getData())>
64 <p class="compartilhar">COMPARTILHAR</p>
65 <@share />
66 </#if>
67
68 <#if call.getData()?has_content>
69 <p class="sutia chamada-text"><em>${call.getData()}</em></p>
70 </#if>
71
72 <#if author.getData()?has_content>
73 <p class="autor-text">${author.getData()}</p>
74 </#if>
75
76 <#if images?has_content>
77 <#if images?size == 1>
78 <#list images as cur_news_image>
79 <#if cur_news_image.getData()?? && cur_news_image.getData() != "">
80 <img class="d-block w-100" src="${cur_news_image.getData()}" />
81 <#if cur_news_image.attributes.alt??>
82 <p class="text-center mt-2 mb-5"><em>${cur_news_image.attributes.alt}</em></p>
83 </#if>
84 </#if>
85 </#list>
86 <#else>
87 <div id="carousel-${randomNamespace}" class="carousel slide mb-4" data-ride="carousel" data-interval="false">
88 <div class="carousel-inner">
89 <#list images as cur_news_image>
90 <div class="carousel-item ${cur_news_image?is_first?then('active', '')}">
91 <img class="d-block w-100" src="${cur_news_image.getData()}" />
92 <#if cur_news_image.attributes.alt??>
93 <p class="text-center mt-2 mb-5"><em>${cur_news_image.attributes.alt}</em></p>
94 </#if>
95 </div>
96 </#list>
97 </div>
98 <a class="carousel-control-prev" href="#carousel-${randomNamespace}" role="button" data-slide="prev">
99 <span class="carousel-control-prev-icon" aria-hidden="true"></span>
100 <span class="sr-only">Previous</span>
101 </a>
102 <a class="carousel-control-next" href="#carousel-${randomNamespace}" role="button" data-slide="next">
103 <span class="carousel-control-next-icon" aria-hidden="true"></span>
104 <span class="sr-only">Next</span>
105 </a>
106 </div>
107 </#if>
108 </#if>
109
110
111 <div class="materia">${content.getData()}</div>
112
113 <#if news_documents.getSiblings()?has_content && news_documents.getSiblings()?first.getData() != "">
114 <h4 class="mt-4">Anexos</h4>
115 <ul class="list-unstyled">
116 <#list news_documents.getSiblings() as cur_news_document>
117 <#assign title = cur_news_document.getData()?keep_before_last("?")?split('/')[4] />
118 <a href="${cur_news_document.getData()?keep_before_last('/')}" target="_blank" class="d-block news-document">
119 ${title}
120 </a>
121 </#list>
122 </ul>
123 <script>
124 document.querySelectorAll(".news-document").forEach(function(element) {
125 element.textContent = decodeURI(element.textContent);
126 });
127 </script>
128 </#if>
129</div>
130</div>
131
132<#-- MACRO: COMPARTILHAR -->
133<#macro share>
134 <div class="share">
135 <a class="facebook" href="https://www.facebook.com/sharer.php?u=${viewFullURL}" target="_blank">Facebook</a>
136 <a class="twitter" href="http://twitter.com/intent/tweet?text=${.vars['reserved-article-title'].data}%0AVeja%20mais%20em:&url=${viewFullURL}" target="_blank">Twitter</a>
137 </div>
138</#macro>
139
140<script>
141 Liferay.on('allPortletsReady', function() {
142 function getPreviousPageUrl() {
143 return document.referrer || '';
144 }
145
146 function checkPreviousPage() {
147 var previousPageUrl = getPreviousPageUrl();
148 var fromCategoryPage = previousPageUrl.includes('/category/') ? 'true' : 'false';
149
150 // Defina a variável de contexto para o FreeMarker
151 var meta = document.createElement('meta');
152 meta.name = 'fromCategoryPage';
153 meta.content = fromCategoryPage;
154 document.head.appendChild(meta);
155 }
156
157 checkPreviousPage();
158
159 var breadcrumbList = document.querySelector(".breadcrumb");
160 var hasArquivados = false;
161
162 // Verifica se o breadcrumb já contém "Arquivados"
163 if (breadcrumbList) {
164 var breadcrumbItems = breadcrumbList.querySelectorAll(".breadcrumb-item");
165 breadcrumbItems.forEach(function(item) {
166 if (item.textContent.trim().toLowerCase() === "arquivados") {
167 hasArquivados = true;
168 }
169 });
170 }
171
172 // Se "Arquivados" não estiver presente, adicione a categoria "Arquivados"
173if (!hasArquivados) {
174 var categorySpan = document.getElementById("journalCategory");
175 if (categorySpan) {
176 var categoryName = categorySpan.getAttribute("data-category-name");
177 var categoryUrl = categorySpan.getAttribute("data-category-url");
178
179 var newBreadcrumbItem = document.createElement("li");
180 newBreadcrumbItem.className = "breadcrumb-item";
181 newBreadcrumbItem.style.fontSize = "13px";
182
183 if (categoryUrl) {
184 var categoryLink = document.createElement("a");
185 categoryLink.href = categoryUrl;
186 categoryLink.textContent = categoryName;
187 categoryLink.style.paddingLeft = "8px";
188 categoryLink.className = "breadcrumb-link 1";
189 newBreadcrumbItem.appendChild(categoryLink);
190 } else {
191 newBreadcrumbItem.textContent = categoryName;
192 }
193
194 if (breadcrumbList && breadcrumbList.lastElementChild) {
195 breadcrumbList.insertBefore(newBreadcrumbItem, breadcrumbList.lastElementChild);
196 }
197 }
198}
199
200 // Atualiza o iframe existente
201 var oldIframe = document.querySelector('iframe');
202 if (oldIframe) {
203 var parentElement = oldIframe.parentNode;
204 var newIframe = oldIframe.cloneNode(true);
205
206 newIframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
207 newIframe.setAttribute('src', oldIframe.getAttribute('src'));
208 newIframe.setAttribute('allowfullscreen', oldIframe.hasAttribute('allowfullscreen'));
209 newIframe.setAttribute('frameborder', oldIframe.getAttribute('frameborder'));
210 newIframe.setAttribute('height', oldIframe.getAttribute('height'));
211 newIframe.setAttribute('width', oldIframe.getAttribute('width'));
212 newIframe.setAttribute('title', oldIframe.getAttribute('title'));
213
214 parentElement.replaceChild(newIframe, oldIframe);
215 }
216 });
217</script>
218</div>