X
O uso deste material é autorizado apenas para fins editoriais.
X
Um erro ocorreu enquanto processava o modelo.
The following has evaluated to null or missing: ==> newsInfoList [in template "20099#20135#10832144" at line 957, column 8] ---- 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: #list newsInfoList as newsInfo [in template "20099#20135#10832144" at line 957, column 1] ----
1<#-- Conteúdo Web -> Templates: Site de Crise - Include de templates-->
2<#-- include "${templatesPath}/1975602" -->
3
4
5<#-- Conteúdo Web -> Templates: Site de Crise - Funções gerais-->
6<#include "${templatesPath}/1975398" />
7
8<#-- Conteúdo Web -> Templates: Site de Crise - Notícia - Extrair dados de Notícias -->
9<#--include "${templatesPath}/7762031" -->
10
11<#-- Conteúdo Web -> Templates: Site de Crise - Notícia - Título -->
12<#-- include "${templatesPath}/7761976" -->
13
14<#-- Conteúdo Web -> Templates: Site de Crise - Notícia - Redes sociais e data de publicação -->
15<#--include "${templatesPath}/7762069" -->
16
17<#-- Conteúdo Web -> Templates: Site de Crise - Notícia - Áudios do conteúdo da notícia -->
18<#-- include "${templatesPath}/7761972" -->
19
20<#-- Nome das midias adaptativas de imagem para desktop e mobile -->
21<#assign adaptativeMediaDesktopResolutionName = "Preview-1000x0" />
22<#assign adaptativeMediaMobileResolutionName = "Thumbnail-300x300" />
23
24<#function getNodesByLabel fieldList parentNode label>
25 <#assign result = []/>
26 <#attempt>
27 <#assign groupId = getIdFromFieldName(fieldList, label) />
28 <#assign xSeletorCaminho = saxReaderUtil.createXPath("dynamic-element[@name='${groupId}' ]") />
29 <#assign result = xSeletorCaminho.selectNodes(parentNode) />
30 <#return result />
31 <#recover>
32 <#return result />
33 </#attempt>
34</#function>
35
36<#function extractPublishDateNew journalArticle>
37 <#assign lastPublishDate = journalArticle.getModifiedDate()>
38 <#if journalArticle.getLastPublishDate()??>
39 <#assign lastPublishDate = journalArticle.getLastPublishDate()>
40 <#else>
41 <#assign lastPublishDate = journalArticle.getModifiedDate()>
42 </#if>
43 <#return lastPublishDate />
44</#function>
45
46<#function normalizeRichText richText>
47 <#return richText
48 ?replace('&[a-z]+;', ' ', 'r') <#-- Remove entidades HTML -->
49 ?replace('<[^>]+>', '', 'r') <#-- Remove tags HTML -->
50 ?replace('[\n\r]+', ' ', 'r') <#-- Normaliza quebras de linha -->
51 ?replace('[“”‘’]', '"', 'r') <#-- Escapa espas curvas -->
52 ?replace('\\\\', '\\\\', 'r') <#-- Escapa barras invertidas -->
53 ?trim <#-- Remove espaços no ínicio/fim -->
54 ?json_string <#-- Escapa o rstante da string para um JSON válido -->
55 >
56</#function>
57
58<#function findVocabulary vocabularyName vocabularies>
59 <#assign vocabularyNameLowerCase = vocabularyName?lower_case>
60 <#list vocabularies as vocabulary>
61 <#if vocabulary.name?lower_case == vocabularyNameLowerCase>
62 <#return vocabulary>
63 </#if>
64 </#list>
65 <#return {}>
66</#function>
67
68<#-- ############# Conteúdo Web -> Templates: Site de Crise - Include de templates #################################### -->
69<#function getSiteUrl>
70 <#assign portalUtil = staticUtil["com.liferay.portal.kernel.util.PortalUtil"]>
71 <#if layout?? && layout?has_content>
72 <#return portalUtil.getLayoutFriendlyURL(layout, themeDisplay)?replace(layout.getFriendlyURL(), "")>
73 </#if>
74 <#return portalUtil.getLayoutFriendlyURL(layout, themeDisplay)>
75</#function>
76
77<#function getSiteName>
78 <#return layout.getGroup().getDescriptiveName(locale)>
79</#function>
80
81<#function mountUrlToPage targetPage>
82 <#return getSiteUrl()+ "/" + targetPage>
83</#function>
84
85
86<#function getCategories journalArticle vocabularyId assetCategoryLocalService>
87 <#assign categories = []>
88 <#assign categoriesFromJournalArticleList = assetCategoryLocalService.getCategories("com.liferay.journal.model.JournalArticle", journalArticle.getResourcePrimKey()) />
89 <#list categoriesFromJournalArticleList as cat>
90 <#if cat.getVocabularyId() == vocabularyId>
91 <#assign categories += [cat]>
92 </#if>
93 </#list>
94 <#return categories>
95</#function>
96<#-- ################################################################################################################## -->
97
98
99<#assign
100journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService")
101assetVocabularyService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyLocalService")
102categoryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService")
103vocabularies = assetVocabularyService.getGroupVocabularies(groupId)
104tagsLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetTagLocalService")
105tagVocabulary = findVocabulary("Tag", vocabularies)
106editoriaVocabulary = findVocabulary("Editorial", vocabularies)
107tagCategoryTitles = extractVocabularyTitles(tagVocabulary)
108editoriaCategoryTitles = extractVocabularyTitles(editoriaVocabulary)
109assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService")
110fileEntryService = staticUtil["com.liferay.document.library.kernel.service.DLFileEntryLocalServiceUtil"]
111layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService")
112/>
113
114<#assign newsJournalArticle = "">
115<#assign assetEntry = getAssetEntryFromRequest(assetEntryLocalService)>
116<#if assetEntry?? && assetEntry?has_content>
117 <#assign newsJournalArticle = journalArticleService.fetchLatestArticle(assetEntry.classPK)/>
118</#if>
119
120<#function getSingleNode name root>
121 <#attempt>
122 <#assign xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='${name}']/dynamic-content[@language-id='${locale}']") />
123 <#return xPathSelector.selectSingleNode( root ) />
124 <#recover>
125 <#assign xPathSelector = saxReaderUtil.createXPath("dynamic-element[@name='${name}']") />
126 <#return xPathSelector.selectSingleNode( root ) />
127 </#attempt>
128</#function>
129
130
131<#-- <#list vocabularies as voc>
132 <h1>${voc.getTitle(locale)}</h1>
133 <#list voc.getCategories() as cat>
134 <h4>${cat.getTitle(locale)}</h4>
135 </#list>
136 </#list>
137
138-->
139<#assign cssRoot = "banner_" + randomNumber(5) />
140
141<#if entries?has_content>
142 <#assign newsInfoList = [] />
143 <#list entries as curEntry>
144 <#attempt >
145 <#assign newsJournalArticle = journalArticleService.fetchLatestArticle(curEntry.classPK)/>
146 <#assign
147 articleId = curEntry.classPK
148 ddmStructure = newsJournalArticle.getDDMStructure()
149 fieldList = getFieldListByStructure(ddmStructure)
150 xmlArticle = newsJournalArticle.getDocument().getRootElement()
151 />
152
153 <#assign
154 <#-- Título principal da notícia -->
155 mainHeadlineOfTheNews = newsJournalArticle.getTitle(locale, true)
156 <#-- Título de destaque da notícia -->
157 featuredNewsHeadline = extractFeaturedNewsHeadline(fieldList, xmlArticle)
158 />
159
160
161 <#-- Flag da notícia ---------------------------------------------------------------------------------->
162 <#assign journalArticleEditoriaCategories = getCategories(newsJournalArticle, editoriaVocabulary.getVocabularyId(), categoryLocalService) />
163 <#--list journalArticleEditoriaCategories as jCat>
164 <h2>Jcat: ${jCat.getTitle(locale)}</h2>
165 </#list -->
166
167 <#-- Url amigável da notícia para visualização em DisplayPage ----------------------------------------->
168 <#assign newsJournalArticleFriendlyUrl = "/">
169 <#if themeDisplay.getPortalURL()?contains("webserver")>
170 <#assign newsJournalArticleFriendlyUrl = themeDisplay.getPortalURL() + themeDisplay.getPathFriendlyURLPublic() + layout.getGroup().friendlyURL + "/w/" + newsJournalArticle.getUrlTitle()>
171 <#else>
172 <#assign newsJournalArticleFriendlyUrl = "/w/" + newsJournalArticle.getUrlTitle()>
173 </#if>
174
175 <#assign editoriaCategory = ""/>
176 <#--list journalArticleEditoriaCategories as cat>
177 <p>${cat.getTitle(locale)}</p>
178 </#list -->
179 <#if journalArticleEditoriaCategories?size gt 0>
180 <#assign editoriaCategory = journalArticleEditoriaCategories[0].getTitle(locale)/>
181 </#if>
182
183
184 <#assign newsInfoList = newsInfoList + [{
185 "articleId": articleId,
186 "mainHeadlineOfTheNews": mainHeadlineOfTheNews,
187 "featuredNewsHeadline" : featuredNewsHeadline,
188 "newsImageFieldSet": extractNewsImage(fieldList, xmlArticle, fileEntryService),
189 "editoriaCategory": editoriaCategory,
190 "url": newsJournalArticleFriendlyUrl
191 } ] />
192 <#recover>
193 </#attempt>
194 </#list>
195
196 <#-- Adiciona dados estruturados notícias - banner ao head ----------------------------------------->
197 <@liferay_util["html-top"]>
198 <script type="application/ld+json">
199 {
200 "@context": "https://schema.org",
201 "@type": "ItemList",
202 "name": "${(locale?lower_case == 'pt_br')?then('Notícias em destaque', 'Headline news')}",
203 "numberOfItems": ${entries?size!0},
204 "itemListElement": [
205 <#list entries as entryForStructuredData>
206 <#assign newsJournalArticle = journalArticleService.fetchLatestArticle(entryForStructuredData.classPK) />
207 <#assign
208 articleId = entryForStructuredData.classPK
209 ddmStructure = newsJournalArticle.getDDMStructure()
210 fieldList = getFieldListByStructure(ddmStructure)
211 xmlArticle = newsJournalArticle.getDocument().getRootElement()
212 />
213
214 <#assign
215 mainHeadlineOfTheNews = newsJournalArticle.getTitle(locale, true)
216 featuredNewsHeadline = extractFeaturedNewsHeadline(fieldList, xmlArticle)
217 newsImageFieldSet = extractNewsImage(fieldList, xmlArticle, fileEntryService)
218 summary = getFieldValue(fieldList, xmlArticle, "Resumo da notícia")
219 createDate = newsJournalArticle.getCreateDate()
220 lastPublishDate = extractPublishDateNew(newsJournalArticle)
221 />
222
223 <#assign newsJournalArticleFriendlyUrl = "/" />
224 <#if themeDisplay.getPortalURL()?contains("webserver")>
225 <#assign newsJournalArticleFriendlyUrl =
226 themeDisplay.getPortalURL()
227 + themeDisplay.getPathFriendlyURLPublic()
228 + layout.getGroup().friendlyURL
229 + "/w/"
230 + newsJournalArticle.getUrlTitle()
231 />
232 <#else>
233 <#assign newsJournalArticleFriendlyUrl = "/w/" + newsJournalArticle.getUrlTitle() />
234 </#if>
235
236 <#assign datePublished = createDate?string('yyyy-MM-ddHH:mm:ss-03:00') />
237 <#assign datePublishedISOFormat = datePublished?substring(0, 10) + "T" + datePublished?substring(10) />
238 <#assign dateModified = lastPublishDate?string('yyyy-MM-ddHH:mm:ss-03:00') />
239 <#assign dateModifiedISOFormat = dateModified?substring(0, 10) + "T" + dateModified?substring(10) />
240
241 {
242 "@type": "ListItem",
243 "position": ${entryForStructuredData_index + 1},
244 "item": {
245 "@type": "Article",
246 "headline": "${normalizeRichText(mainHeadlineOfTheNews)}",
247 "alternativeHeadline": "${normalizeRichText(featuredNewsHeadline)}",
248 "image": "${themeDisplay.getPortalURL()}${newsImageFieldSet.newsImage.url}",
249 "author": {
250 "@type": "Organization",
251 "name": "Petrobras",
252 "url": "${themeDisplay.getPortalURL()}/autor"
253 },
254 "publisher": {
255 "@type": "Organization",
256 "name": "Petrobras",
257 "logo": {
258 "@type": "ImageObject",
259 "url": "https://petrobras.com.br/documents/d/f3a44542-113e-11ee-be56-0242ac120002/logo-petrobras-png"
260 }
261 },
262 "datePublished": "${datePublishedISOFormat}",
263 "dateModified": "${dateModifiedISOFormat}",
264 "mainEntityOfPage": "${newsJournalArticleFriendlyUrl}",
265 "description": "${normalizeRichText(summary)}"
266 }
267 }
268 <#if entryForStructuredData_index lt entries?size - 1>,</#if>
269 </#list>
270 ]
271 }
272 </script>
273 </@>
274<#-- Adiciona dados estruturados notícias - banner ao head - fim ----------------------------------------->
275
276 <#if newsInfoList?size gt 0>
277 <#assign firstNewsInfo = newsInfoList[0] />
278 <#assign hashC = "css_" + randomNumber(5) />
279
280 <div class="${cssRoot} ">
281 <div class="breakpoint">
282 <div class="banner-container col-1-12 md-col-1-8 sm-col-1-4">
283 <div article-id="${firstNewsInfo.articleId}" class="card first ">
284
285 <div class="big ${hashC}">
286 <picture >
287 <source media="(max-width:767px)" srcset="/o/adaptive-media/image/${firstNewsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaMobileResolutionName}/image">
288 <img class="card-news-image background" loading="lazy" src="/o/adaptive-media/image/${firstNewsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaDesktopResolutionName}/image" alt="YouTube Thumbnail"/>
289 </picture>
290 <div class="overlay-filter"></div>
291 <div class="editoria">${firstNewsInfo.editoriaCategory}</div>
292 <h1 class="title">${firstNewsInfo.featuredNewsHeadline}</h1>
293 <div class="bar"></div>
294 <div class="link-container">
295 <a class="link home-banner-btn-link" href="${firstNewsInfo.url}">
296 <#if locale == "pt_BR"> Ler notícia <#else> Read news</#if>
297 <svg viewBox="0 0 46 28" fill="none" xmlns="http://www.w3.org/2000/svg" style="pointer-events: none">
298 <path d="M36.5303 14.5303C36.8232 14.2374 36.8232 13.7626 36.5303 13.4697L31.7574 8.6967C31.4645 8.40381 30.9896 8.40381 30.6967 8.6967C30.4038 8.9896 30.4038 9.46447 30.6967 9.75736L34.9393 14L30.6967 18.2426C30.4038 18.5355 30.4038 19.0104 30.6967 19.3033C30.9896 19.5962 31.4645 19.5962 31.7574 19.3033L36.5303 14.5303ZM-6.34173e-08 14.75L36 14.75L36 13.25L6.34173e-08 13.25L-6.34173e-08 14.75Z" fill="white"/>
299 </svg>
300 </a>
301 </div>
302 </div>
303 </div>
304 <div class="right">
305 <#list newsInfoList as newsInfo>
306 <#if newsInfo?index gt 0>
307 <div article-id="${newsInfo.articleId}" class="card">
308 <#if newsInfo.newsImageFieldSet.newsImage.url != "" >
309 <picture >
310 <source media="(max-width:767px)" srcset="/o/adaptive-media/image/${newsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaMobileResolutionName}/image">
311 <img loading="lazy" src="/o/adaptive-media/image/${newsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaDesktopResolutionName}/image" alt="${newsInfo.newsImageFieldSet.newsImage.alt}" />
312 </picture>
313 </#if>
314 <div>
315 <div class="editoria">${newsInfo.editoriaCategory}</div>
316 <a class="link title home-banner-card-link" href="${newsInfo.url}">${newsInfo.featuredNewsHeadline}</a>
317 </div>
318 </div>
319 </#if>
320 </#list>
321 </div>
322 </div>
323
324 </div>
325 </div>
326 </#if>
327
328 <style>
329 .${cssRoot} .breakpoint * {
330 margin: 0;
331 padding: 0;
332 }
333
334 .${cssRoot} .breakpoint {
335 row-gap: var(--space-xl, 40px);
336 }
337
338
339 .${cssRoot} .breakpoint .banner-container {
340 display: flex;
341 gap: 32px;
342 }
343
344 .${cssRoot} .card:hover {
345 box-shadow: var(--box-shadow-neutral);
346 transition: box-shadow 300ms ease-in-out;
347 }
348
349 .${cssRoot} .card {
350 border-radius: var(--border-radius-md);
351 border: 1px solid var(--color-neutral-500, #D7D7D7);
352 background: var(--color-neutral-100, #FFF);
353 box-shadow: none;
354 position: relative;
355 overflow: hidden;
356 }
357
358 .${cssRoot} .bar {
359 width: 40px;
360 height: 4px;
361 min-height: 4px;
362 min-width: 40px;
363 background-color: var(--color-secondary-solid-to-bright-200, #FDC82F);
364 position: relative;
365 }
366
367 .${cssRoot} .card.first >div {
368 padding: 0 var(--size-xxl, 48px);
369 display: flex;
370 flex-direction: column;
371 justify-content: flex-end;
372 height: 100%;
373 gap: var(--size-xs, 16px);
374 border-radius: var(--border-radius-md, 8px);
375 padding-bottom: 22px;
376 }
377
378 .${cssRoot} .card.first img.background {
379 position: absolute;
380 top: 0;
381 left: 0;
382 width: 100%;
383 height: 100%;
384 pointer-events: none;
385 object-fit: cover;
386 }
387
388 .${cssRoot} .card.first .overlay-filter {
389 width: 100%;
390 height: 100%;
391 background: var(--color-opacity-dark-level-02);
392 position: absolute;
393 top: 0;
394 left: 0;
395 border-radius: var(--border-radius-md, 8px);
396 }
397
398 .${cssRoot} .card.first .link-container {
399 border-radius: 100px;
400 background: var(--color-opacity-level-03, rgba(255, 255, 255, 0.48));
401 box-shadow: 0 var(--size-micro,4px) var(--size-xs,16px) 0 rgba(0, 0, 0, 0.16);
402 backdrop-filter: blur(8px);
403 max-width: 296px;
404 padding: var(--font-size-xs, 18px) var(--font-size-xl, 32px);
405 }
406
407 .${cssRoot} .card.first .link-container .link {
408 display: flex;
409 flex-direction: row;
410 gap: var(--space-sm, 16px);
411 align-items: center;
412 justify-content: space-between;
413 color: var(--color-neutral-100, #FFF);
414 font-family: var(--font-family-base);
415 font-size: var(--size-xs, 18px);
416 font-style: var(--font-style-normal, normal);;
417 font-weight: var(--font-weight-bold, 700);
418 line-height: var(--line-height-lg, 144%); /* 25.92px */
419 }
420
421 .${cssRoot} .card.first .link-container .hidden-text {
422 position: absolute;
423 opacity: 0;
424 pointer-events: none;
425 }
426
427 .${cssRoot} .card.first .link-container .link svg {
428 width: 46px;
429 height: 28px;
430 }
431
432 .${cssRoot} .card.first .editoria {
433 color: var(--color-neutral-100, #FFF);
434 font-family: var(--font-family-base);
435 font-size: var(--font-size-xxs, 16px);
436 font-style: var(--font-style-normal, normal);;
437 font-weight: var(--font-weight-regular, 400);
438 line-height: var(--line-height-xl, 160%); /* 25.6px */
439 position: relative;
440 }
441
442 .${cssRoot} .card .editoria {
443 color: var(--color-neutral-800, #373737);
444
445 font-family: var(--font-family-base);
446 font-size: var(--font-size-xxxs, 14px);
447 font-style: var(--font-style-normal, normal);;
448 font-weight: var(--font-weight-regular, 400);
449 line-height: var(--line-height-xl, 160%); /* 22.4px */
450 }
451
452 .${cssRoot} .card .title{
453 color: var(--color-neutral-100, #FFF);
454 font-family: var(--font-family-base);
455 font-size: var(--font-size-xxl, 38px);
456 font-style: var(--font-style-normal, normal);
457 font-weight: var(--font-weight-bold, 700);
458 line-height: var(--line-height-xs, 100%);
459 padding-bottom: var(--space-sm, 16px);
460 position: relative;
461 }
462
463 .${cssRoot} .right {
464 display: flex;
465 gap: var(--space-md, 24px);
466 flex-direction: column;
467 width: 452px;
468 flex-shrink: 0;
469 }
470
471 .${cssRoot} .right .card {
472 overflow: hidden;
473 display: flex;
474 max-height: 136px;
475 }
476 .${cssRoot} .right .card >div{
477 border-radius: 0 var(--border-radius-md) var(--border-radius-md) 0;
478 padding: var(--space-sm, 16px);
479 display: flex;
480 flex-direction: column;
481 gap: var(--space-xxs, 8px);
482 background: var(--color-background-card);
483 width: 100%;
484 }
485 .${cssRoot} .right .card .title {
486 overflow: hidden;
487 color: var(--color-neutral-800, #373737);
488 text-overflow: ellipsis;
489 font-family: var(--font-family-base);
490 font-size: var(--font-size-xs, 18px);
491 font-style: var(--font-style-normal, normal);;
492 font-weight: var(--font-weight-bold, 700);
493 line-height: var(--line-height-md, 132%);
494 }
495
496 .${cssRoot} .right .card .title {
497 display: flex;
498 flex-direction: column;
499 gap: var(--space-xxs, 8px);
500 }
501
502 .${cssRoot} .right .card img {
503 width: 154px;
504 height: 134px;
505 border-radius: var(--size-xxxs, 8px) 0 0 var(--size-xxxs, 8px);
506 object-fit: cover;
507 }
508
509
510 @media screen and (max-width: ${MAX_TABLET_WIDTH}px) {
511 .${cssRoot} .card.first >div {
512 padding: var(--space-xxl, 56px) var(--space-lg, 32px) 22px;
513 }
514
515 .${cssRoot} .card .title {
516 font-size: var(--font-size-xl, 32px);
517 line-height: var(--line-height-sm, 120%);
518 padding-bottom: var(--space-md, 24px);
519 }
520
521 .${cssRoot} .card.first .link-container {
522 margin-top: var(--space-md, 24px);
523 }
524
525 .${cssRoot} .card.first .editoria {
526 color: var(--color-neutral-100, #FFF);
527 font-family: var(--font-family-base);
528 font-size: var(--font-size-xxxs, 14px);
529 font-style: var(--font-style-normal, normal);;
530 font-weight: var(--font-weight-regular, 400);
531 line-height: var(--line-height-xl, 160%);
532 }
533
534 .${cssRoot} .card.first >div {
535 gap: var(--space-xxs, 8px);
536 }
537
538 .${cssRoot} .bar {
539 min-width: 32px;
540 }
541 }
542
543 @media screen and (max-width: 1024px) {
544 .${cssRoot} .breakpoint .banner-container {
545 flex-direction: column;
546 }
547
548 .${cssRoot} .breakpoint .banner-container .right {
549 width: 100%;
550 }
551 }
552
553
554 @media screen and (max-width: ${MAX_MOBILE_WIDTH}px) {
555 header.cadmin.portlet-topper {
556 display: none !important;
557 }
558 }
559 </style>
560 <script>
561 const highlightCardTitle = document.querySelector('.${cssRoot} .card.first .title');
562 const highlightCardLink = document.querySelector('.${cssRoot} .card.first .link-container a.home-banner-btn-link');
563
564 const GTMLinkSpan = document.createElement('span');
565 GTMLinkSpan.textContent = highlightCardTitle.textContent;
566 GTMLinkSpan.classList.add('hidden-text');
567 highlightCardLink.appendChild(GTMLinkSpan);
568 </script>
569</#if>
570
571
572<#-- ############# Site de Crise - Notícia - Extrair dados de Notícias ################################################ -->
573<#--
574Add elements from the sidebar to define your template. Type "${" to use the
575autocomplete feature.
576-->
577<#function extractFeaturedNewsHeadline fieldList xmlArticle>
578 <#return getFieldValue(fieldList, xmlArticle, "Título de destaque da notícia")>
579</#function>
580
581<#function extractNewsSummary fieldList xmlArticle>
582 <#return getFieldValue(fieldList, xmlArticle, "Subtítulo")>
583</#function>
584
585<#function extractPublishDate journalArticle>
586 <#--assign lastPublishDate = journalArticle.getModifiedDate()>
587 <#if journalArticle.getLastPublishDate()??>
588 <#assign lastPublishDate = journalArticle.getLastPublishDate()>
589 <#else>
590 <#assign lastPublishDate = journalArticle.getModifiedDate()>
591 </#if>
592 <#return lastPublishDate -->
593 <#return journalArticle.getDisplayDate() />
594</#function>
595
596
597<#function getFlagColor flag>
598 <#attempt >
599 <#list getFlagsCategoriesAndProperties() as catProps>
600 <#if catProps.name == flag>
601 <#return catProps.color>
602 </#if>
603 </#list>
604 <#recover >
605 </#attempt>
606 <#return "">
607</#function>
608
609<#-- Seção da imagem de destaque ---------------------------------------------------------------------->
610<#function extractNewsImage fieldList xmlArticle fileEntryService>
611 <#assign
612 <#-- Grupo da imagem de destaque -->
613 newsImageGroupList = getNodes("Fieldset71035101", newsJournalArticle.getDocument().getRootElement())
614 <#-- Url e descrição da imagem de destaque -->
615 newsImage = {"url": "--", "alt": "--", "mimeType" :"image/jpg"}
616 <#-- Créditos da imagem de destaque -->
617 newsImageCredits = ""
618 <#-- Legenda da imagem de destaque -->
619 newsImageLegend = ""
620 <#-- Texto do link para download -->
621 downloadLinkTitle = ""
622 >
623
624 <#list newsImageGroupList as newsImageGroup>
625 <#assign newsImage = getFileFromXML("Image05319221", newsImageGroup, fileEntryService) />
626 <#-- Grupo com as informações de crédito e legenda da imagem de destaque -->
627 <#assign labelGroupList = getNodes("Fieldset43702900", newsImageGroup) />
628 <#list labelGroupList as labelGroup>
629 <#-- Investigar do porquê não está funcionando o getFieldValue
630 <#assign
631 newsImageCredits = getFieldValue(fieldList, labelGroup, "Crédito da imagem de destaque da notícia")
632 newsImageLegend = getFieldValue(fieldList, labelGroup, "Legenda da imagem de destaque da notícia")
633 downloadLinkTitle = getFieldValue(fieldList, labelGroup, "Texto do link para download")
634 />
635 -->
636 <#assign
637 newsImageCredits = getSingleNodeString("Text47590088", labelGroup)
638 newsImageLegend = getSingleNodeString("Text03239077", labelGroup)
639 downloadLinkTitle = getSingleNodeString("Text48804898", labelGroup) />
640 </#list>
641 </#list>
642
643 <#return {"newsImage": newsImage,
644 "credits": newsImageCredits,
645 "legend": newsImageLegend,
646 "linkTitle" : downloadLinkTitle
647 }/>
648</#function>
649
650<#function featureNewsVideo xmlArticle fileEntryService>
651<#-- Seção do video de destaque ----------------------------------------------------------------------->
652 <#assign
653 youtubeId = ""
654 internalVideoUrl = ""
655 featureNewsVideoGroup = getNodes("Fieldset09746751", xmlArticle)
656 >
657 <#list featureNewsVideoGroup as newsImageFieldSet>
658 <#assign
659 youtubeId = getFieldValue(fieldList,featureNewsVideoGroup, "ID do vídeo do YouTube do vídeo de destaque")
660 internalVideoUrl = getFileFromXML("DocumentLibrary80545771", featureNewsVideoGroup, fileEntryService)
661 >
662 </#list>
663
664 <#return {"youtube": youtubeId, "internalVideoUrl" : internalVideoUrl}>
665</#function>
666
667
668
669<#function extractInfo journalArticle editoriaCategoryTitles fileEntryService categoryLocalService layoutLocalService>
670 <#attempt >
671 <#assign
672 ddmStructure = journalArticle.getDDMStructure()
673 fieldList = getFieldListByStructure(ddmStructure)
674 xmlArticle = journalArticle.getDocument().getRootElement()
675 >
676
677 <#assign
678 <#-- Título principal da notícia -->
679 mainHeadlineOfTheNews = journalArticle.getTitle(locale, true)
680 <#-- Título de destaque da notícia -->
681 featuredNewsHeadline = extractFeaturedNewsHeadline(fieldList, xmlArticle)
682 <#-- Sumário da notícia -->
683 newsSummary = extractNewsSummary(fieldList, xmlArticle)
684 <#-- Data de publicação da notícia -->
685 lastPublishDate = extractPublishDate(journalArticle)
686 <#-- Data de criação da notícia -->
687 createDate = journalArticle.getCreateDate()
688 >
689
690
691 <#-- Flag da notícia ---------------------------------------------------------------------------------->
692 <#assign flag = getFirstCategoryTitle(journalArticle, editoriaCategoryTitles, categoryLocalService)>
693 <#assign flagColor = getFlagColor(flag)>
694
695 <#-- Url amigável da notícia para visualização em DisplayPage ----------------------------------------->
696 <#assign journalArticleFriendlyUrl = themeDisplay.getPortalURL() + themeDisplay.getPathFriendlyURLPublic() + layout.getGroup().friendlyURL + "/w/" + journalArticle.getUrlTitle()>
697 <#assign journalArticleFriendlyUrl = "/">
698 <#if themeDisplay.getPortalURL()?contains("webserver")>
699 <#assign journalArticleFriendlyUrl = themeDisplay.getPortalURL() + themeDisplay.getPathFriendlyURLPublic() + layout.getGroup().friendlyURL + "/w/" + journalArticle.getUrlTitle()>
700 <#else>
701 <#assign journalArticleFriendlyUrl = "/w/" + journalArticle.getUrlTitle()>
702 </#if>
703
704 <#-- Conteúdo da notícia ------------------------------------------------------------------------------>
705 <#assign newsContent = getFieldValue(fieldList, xmlArticle, "Corpo da notícia")>
706
707 <#-- Seção do áudio para o conteúdo da notícia -------------------------------------------------------->
708 <#assign audios = []
709 audioIdentifierFieldSetList = getNodes("Fieldset65862311", xmlArticle)
710 >
711 <#list audioIdentifierFieldSetList as audioIdentifierFieldSet>
712 <#assign
713 <#-- Grupo com as informações de url e legenda do áudio -->
714 audioInfoFieldSet = getGroupNode("Fieldset24035689",audioIdentifierFieldSet)>
715 <#assign
716 externalAudioUrl = getFieldValue(fieldList, audioInfoFieldSet, "URL externa do áudio")
717 internalAudioUrl = getFileFromXML("DocumentLibrary24170668", audioInfoFieldSet, fileEntryService)
718 audioLegend = getFieldValue(fieldList, audioInfoFieldSet, "Legenda do áudio")>
719
720 <#if externalAudioUrl?has_content || internalAudioUrl.url?has_content >
721 <#assign audios += [{
722 "id": getFieldValue(fieldList, audioIdentifierFieldSet, "Identificador de Áudio"),
723 "externalUrl" : externalAudioUrl,
724 "internalUrl" : internalAudioUrl,
725 "legend" : audioLegend
726 }]>
727 </#if>
728 </#list>
729
730 <#-- Seção de vídeo para o conteúdo da notícia -------------------------------------------------------->
731 <#assign videos = []
732 videoIdentifierFieldSetList = getNodes("Fieldset24460782", xmlArticle)
733 >
734 <#list videoIdentifierFieldSetList as videoIdentifierFieldSet>
735 <#assign
736 <#-- Grupo com as informações de url e legenda do áudio -->
737 videoInfoFieldSet = getGroupNode("Fieldset51040010",videoIdentifierFieldSet)
738
739 videos += [{
740 "id": getFieldValue(fieldList,videoIdentifierFieldSet, "Identificador de Vídeo"),
741 "youtubeID" : getFieldValue(fieldList, videoInfoFieldSet, "ID do vídeo do YouTube"),
742 "internalUrl" : getFileFromXML("DocumentLibrary15265409", videoInfoFieldSet, fileEntryService),
743 "legend" : getFieldValue(fieldList, videoInfoFieldSet, "Legenda do vídeo")
744 }]
745 >
746 </#list>
747
748
749 <#-- Seção de links para o conteúdo da notícia -------------------------------------------------------->
750 <#assign
751 links = []
752 linksFieldSetList = getNodes("Fieldset37770113", xmlArticle)
753 >
754 <#list linksFieldSetList as linksFieldSet>
755 <#assign linkFieldSetList = getNodes("Fieldset10524367", linksFieldSet)>
756
757 <#list linkFieldSetList as linkFieldSet>
758 <#assign
759 linkId = getFieldValue(fieldList, linkFieldSet, "Identificador do link")
760
761 <#-- Grupo com as informações de url e legenda do áudio -->
762 linkInfoFieldSeet = getGroupNode("Fieldset86037074", linkFieldSet)
763
764 iconType = getFieldValue(fieldList, linkInfoFieldSeet, "Ícone do link")
765 links += [{
766 "id": linkId,
767 "externalLink" : getFieldValue(fieldList, linkInfoFieldSeet, "Link externo"),
768 "pageLink" : getPageLayoutLinkFromXML("LinkToLayout77941175", linkInfoFieldSeet, layoutLocalService),
769 "file" : getFileFromXML("DocumentLibrary34820760", linkInfoFieldSeet, fileEntryService),
770 "title" : getFieldValue(fieldList, linkInfoFieldSeet, "Título do link"),
771 "iconType" : iconType
772 }]
773 >
774 </#list>
775 </#list>
776
777
778
779 <#-- Seção de imagens da galeria para o conteúdo da notícia ------------------------------------------->
780 <#assign galleries = []
781 carouselIdentifierFieldSetList = getNodes("Fieldset39804431", xmlArticle)
782 >
783 <#list carouselIdentifierFieldSetList as carouselIdentifierFieldSet>
784 <#assign
785 galleryId = getFieldValue(fieldList,carouselIdentifierFieldSet, "Identificador de Galeria")
786
787 <#-- Grupo com as informações de url e legenda da galeria -->
788 carouselImgFieldSetList = getNodes("Fieldset23271674",carouselIdentifierFieldSet)
789 >
790
791 <#assign galleryItems = []>
792 <#list carouselImgFieldSetList as carouselImgFieldSet>
793 <#assign galleryItems += [{
794 "img" : getFileFromXML("Image44073821", carouselImgFieldSet, fileEntryService),
795 "externalLink" : getFieldValue(fieldList, carouselImgFieldSet, "Associar imagem a link externo"),
796 "title": getFieldValue(fieldList, carouselImgFieldSet, "Título do item da galeria"),
797 "legend": getFieldValue(fieldList, carouselImgFieldSet, "Legenda da imagem")
798 }
799 ]>
800 </#list>
801 <#assign galleries += [{"id": galleryId, "items": galleryItems}]>
802 </#list>
803
804 <#assign mediaGroupList = getNodes(getIdFromFieldName(fieldList, "Galeria de multimídia"), xmlArticle) />
805 <#assign galleryItems = []/>
806
807 <#list mediaGroupList as mediaGroup >
808 <#assign nodeId = getIdFromFieldName(fieldList, "Selecione o Conteúdo Web da mídia") />
809 <#assign nodes = getNodes(nodeId, mediaGroup) />
810 <#list nodes as node>
811 <#assign medJson = jsonFactoryUtil.createJSONObject(node.getStringValue()) />
812 <#assign mediaJournalArticle = journalArticleService.fetchLatestArticle(medJson.classPK?number)/>
813 <#assign mediaDdmStructure = mediaJournalArticle.getDDMStructure()/>
814 <#assign fieldListMedia = getFieldListByStructure(mediaDdmStructure)/>
815 <#assign xmlArticleMedia = mediaJournalArticle.getDocument().getRootElement() />
816
817 <#assign cardTitle = getFieldValue(fieldListMedia, xmlArticleMedia, "Título Home")/>
818 <#assign subtitle = getFieldValue(fieldListMedia, xmlArticleMedia, "Legenda")/>
819 <#assign author = getFieldValue(fieldListMedia, xmlArticleMedia, "Autor")/>
820 <#assign thumbnailImage = getMediaInfo(fieldListMedia, xmlArticleMedia, "Imagem de thumbnail", fileEntryService) />
821
822 <#assign originalFileGroup = getGroupNode(getIdFromFieldName(fieldListMedia, "Arquivo original"), xmlArticleMedia) />
823
824 <#assign originalFile = getMediaInfo(fieldListMedia, originalFileGroup, "Arquivo selecionado", fileEntryService) />
825 <#assign originalFileExternalUrl = getFieldValue(fieldListMedia, originalFileGroup, "URL externa") />
826
827 <#assign galleryItems += [{"cardTitle": cardTitle,
828 "subtitle" : subtitle,
829 "author": author,
830 "thumbnailImage": thumbnailImage,
831 "originalFile": originalFile,
832 "originalFileExternalUrl": originalFileExternalUrl
833 }] />
834
835 </#list>
836 </#list>
837
838 <#return {
839 "mainHeadlineOfTheNews": mainHeadlineOfTheNews,
840 "featuredNewsHeadline" : featuredNewsHeadline,
841 "displayDate" : formatDate(createDate),
842 "createDate": createDate,
843 "newsSummary" : newsSummary,
844 "newsImageFieldSet": extractNewsImage(fieldList, xmlArticle, fileEntryService),
845 "featureNewsVideo" : featureNewsVideo(xmlArticle, fileEntryService),
846 "lastPublishDate": lastPublishDate,
847 "flag": flag,
848 "flagColor": flagColor,
849 "url": journalArticleFriendlyUrl,
850 "newsContent": newsContent,
851 "audios": audios,
852 "videos": videos,
853 "galleryItems": galleryItems,
854 "links": links
855 }>
856
857 <#recover>
858 <#return "">
859 </#attempt>
860
861</#function>
862
863<#function extractNewsInfoForCard curEntry editoriaCategoryTitles journalArticleService fileEntryService categoryLocalService>
864 <#if !curEntry?? >
865 <#return {}>
866 </#if>
867
868 <#assign article = journalArticleService.getLatestArticle(curEntry.getClassPK()) />
869 <#if !article??>
870 <#return {}>
871 </#if>
872
873 <#assign ddmStructure = article.getDDMStructure()>
874 <#if !ddmStructure??>
875 <#return {}>
876 </#if>
877
878 <#assign fieldList = getFieldListByStructure(ddmStructure) />
879 <#assign xmlArticle = article.getDocument().getRootElement() />
880
881 <#assign mainHeadlineOfTheNews = article.getTitle(locale, true)>
882 <#assign featuredNewsHeadline = getFieldValue(fieldList, xmlArticle, "Título de destaque da notícia")>
883 <#assign newsSummary = getFieldValue(fieldList, xmlArticle, "Subtítulo")>
884 <#assign createDate = article.getCreateDate()>
885
886 <#assign lastPublishDate = extractPublishDate(article)>
887
888 <#assign newsImageFieldSetGroup = getNodes( "Fieldset79335573",xmlArticle)>
889 <#assign newsImage = {"url": "", "alt": ""}>
890 <#list newsImageFieldSetGroup as newsImageFieldSet>
891 <#assign newsImage = getFileFromXML("Image51357996", newsImageFieldSet, fileEntryService)>
892 </#list>
893
894 <#assign youtubeId = "">
895 <#assign internalVideoUrl = "">
896 <#assign featureNewsVideoGroup = getNodes("Fieldset09746751", xmlArticle)>
897 <#list featureNewsVideoGroup as newsImageFieldSet>
898 <#assign youtubeId = getFieldValue(fieldList,featureNewsVideoGroup, "ID do vídeo do YouTube do vídeo de destaque")>
899 <#assign internalVideoUrl = getFileFromXML("DocumentLibrary80545771", featureNewsVideoGroup, fileEntryService)>
900 </#list>
901
902
903 <#assign flag = getFirstCategoryTitle(article, editoriaCategoryTitles, categoryLocalService)>
904 <#assign flagColor = getFlagColor(flag)>
905
906 <#assign url = "/">
907 <#if themeDisplay.getPortalURL()?contains("webserver")>
908 <#assign url = themeDisplay.getPortalURL() + themeDisplay.getPathFriendlyURLPublic() + layout.getGroup().friendlyURL + "/w/" + article.getUrlTitle()>
909 <#else>
910 <#assign url = "/w/" + article.getUrlTitle()>
911 </#if>
912
913 <#return {
914 "mainHeadlineOfTheNews": mainHeadlineOfTheNews,
915 "featuredNewsHeadline" : featuredNewsHeadline,
916 "displayDate" : formatDate(createDate),
917 "createDate" : createDate,
918 "newsSummary" : newsSummary,
919 "newsImage": newsImage,
920 "featureNewsVideo" : {"youtube": youtubeId, "videoUrl" : internalVideoUrl},
921 "lastPublishDate": lastPublishDate,
922 "flag": flag,
923 "flagColor": flagColor,
924 "url": url
925 }>
926
927</#function>
928
929<#-- ################################################################################################################## -->
930
931
932<#-- Dados Estruturados - Imagens -->
933
934<#assign imagesList = [] />
935
936<#-- Imagem Destaque -->
937<#if firstNewsInfo?? && firstNewsInfo.newsImageFieldSet.newsImage??>
938 <#assign imageObject = {
939 "@context": "https://schema.org",
940 "@type": "ImageObject",
941 "url": "/o/adaptive-media/image/${firstNewsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaDesktopResolutionName}/image",
942 "contentUrl": "/o/adaptive-media/image/${firstNewsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaDesktopResolutionName}/image",
943 "name": firstNewsInfo.featuredNewsHeadline?js_string,
944 "caption": (firstNewsInfo.newsImageFieldSet.newsImage.alt?? && firstNewsInfo.newsImageFieldSet.newsImage.alt?has_content)?then(firstNewsInfo.newsImageFieldSet.newsImage.alt?js_string, ""),
945 "description": (firstNewsInfo.newsImageFieldSet.legend?? && firstNewsInfo.newsImageFieldSet.legend?has_content)?then(firstNewsInfo.newsImageFieldSet.legend?js_string, ""),
946 "encodingFormat": "image/jpeg",
947 "author": {
948 "@type": "Organization",
949 "name": "Petrobras"
950 },
951 "license": "https://creativecommons.org/licenses/by/4.0/"
952 } />
953 <#assign imagesList += [imageObject] />
954</#if>
955
956<#-- 3 Demais Imagens -->
957<#list newsInfoList as newsInfo>
958 <#if newsInfo?index gt 0 && newsInfo.newsImageFieldSet.newsImage??>
959 <#assign imageObject = {
960 "@context": "https://schema.org",
961 "@type": "ImageObject",
962 "url": "/o/adaptive-media/image/${newsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaDesktopResolutionName}/image",
963 "contentUrl": "/o/adaptive-media/image/${newsInfo.newsImageFieldSet.newsImage.fileEntryId}/${adaptativeMediaDesktopResolutionName}/image",
964 "name": newsInfo.featuredNewsHeadline?js_string,
965 "caption": (newsInfo.newsImageFieldSet.newsImage.alt?? && newsInfo.newsImageFieldSet.newsImage.alt?has_content)?then(newsInfo.newsImageFieldSet.newsImage.alt?js_string, ""),
966 "description": (newsInfo.newsImageFieldSet.legend?? && newsInfo.newsImageFieldSet.legend?has_content)?then(newsInfo.newsImageFieldSet.legend?js_string, ""),
967 "encodingFormat": "image/jpeg",
968 "author": {
969 "@type": "Organization",
970 "name": "Petrobras"
971 },
972 "license": "https://creativecommons.org/licenses/by/4.0/"
973 } />
974 <#assign imagesList += [imageObject] />
975 </#if>
976</#list>
977
978<#if imagesList?size gt 0>
979 <@liferay_util["html-top"]>
980 <script type="application/ld+json">
981 ${jsonFactoryUtil.looseSerialize(imagesList)}
982 </script>
983 </@>
984</#if>
985
986<#-- ################################################################################################################## -->
Mais recentes
Mais lidos
Navegue por editoria
Inovação
Institucional
Negócio
Regionais
Seleção de Jornalismo
Sustentabilidade
Navegue nas Seções:
Escolha um Canal:
Acessibilidade
Idioma:
Selecione um idioma: