Noticias y eventos
Se ha producido un error al procesar la plantilla.
The string doesn't match the expected date/time/date-time format. The string to parse was: "". The expected format was: "yyyy-MM-dd".
The nested reason given follows:
Unparseable date: ""
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign fechaParseada = contentFecha?... [in template "10136#10174#153676948" at line 88, column 33]
----
1<#-- 7_listado-noticias-dinamico_AMLR-4005 -->
2<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
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
7
8
9<#assign groupFriendlyURL = themeDisplay.getScopeGroup().getFriendlyURL() />
10<#assign friendlyURL = themeDisplay.getScopeGroup().getPathFriendlyURL(false,themeDisplay) + groupFriendlyURL />
11<#assign actualURLFriendly = portalUtil.getHost(request) + friendlyURL />
12<#assign scopeGroupId = themeDisplay.getScopeGroupId() />
13
14<#assign PortalUtil = staticUtil["com.liferay.portal.kernel.util.PortalUtil"] />
15<#assign URLEncoder = staticUtil["java.net.URLEncoder"] />
16<#assign Normalizer = staticUtil["java.text.Normalizer"] />
17<#assign currentGroupSite = themeDisplay.getLayout().getGroup().getFriendlyURL() />
18<#if themeDisplay.getLayout().getPrivateLayout() == true >
19 <#assign state = themeDisplay.getPathFriendlyURLPrivateGroup()/>
20<#else>
21 <#assign state = themeDisplay.getPathFriendlyURLPublic()/>
22</#if>
23
24
25
26<#assign imagen = languageUtil.get(locale, "listado.noticia.imagen")>
27<#assign texto = languageUtil.get(locale, "listado.noticia.texto")>
28<#assign instanceId = themeDisplay.getPortletDisplay().getId()?replace("com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet_INSTANCE_", "")>
29<#assign originalInstanceId = themeDisplay.getPortletDisplay().getId()?replace("com_liferay_asset_publisher_web_portlet_AssetPublisherPortlet_INSTANCE_", "")>
30<#assign currentPageUrl = PortalUtil.getLayoutURL(themeDisplay.getLayout(),themeDisplay)>
31<#assign currentLayoutFriendlyUrl = themeDisplay.getLayoutFriendlyURL(themeDisplay.getLayout())>
32
33<#-- custom fields
34<#assign expandos = themeDisplay.getScopeGroup().getExpandoBridge().getAttributes()>
35<#list expandos?keys as key>
36 ${key}
37</#list>
38-->
39
40
41<#-- site_news_asset_publisher_instance_id name of the custom field for the asset publisher instance id of the site -->
42<#assign site_news_asset_publisher_instance_id = layout.getGroup().getExpandoBridge().getAttribute("site_news_asset_publisher_instance_id")>
43<#-- by default the main site asset publisher id -->
44<#assign site_news_asset_publisher_instance_id_default = layout.getGroup().getExpandoBridge().getAttributeDefault("site_news_asset_publisher_instance_id")>
45<#-- site_news_url name of the custom field url of the news page of the site -->
46<#assign site_news_url = themeDisplay.getScopeGroup().getExpandoBridge().getAttribute("site_news_url")>
47<#-- by default the main site news page -->
48<#assign site_news_url_default = themeDisplay.getScopeGroup().getExpandoBridge().getAttributeDefault("site_news_url")>
49
50
51<#-- get site_news_url custom field value for the site -->
52<#list site_news_url?keys as key>
53 <#if key == locale>
54 <#assign site_news_url_value = site_news_url?values[key?index]>
55 </#if>
56</#list>
57
58<#-- get site_news_url custom field default value-->
59<#list site_news_url_default?keys as key>
60 <#if key == locale>
61 <#assign site_news_url_default_value = site_news_url_default?values[key?index]>
62 </#if>
63</#list>
64
65<#-- assign the url if the site has custom field. Use the default value otherwise-->
66<#if site_news_url_value??>
67<#else>
68 <#if site_news_url_default_value??>
69 <#assign site_news_url_value = site_news_url_default_value>
70 </#if>
71</#if>
72
73<#-- assign the instance id if the site has custom field. Use the default value otherwise-->
74<#if site_news_asset_publisher_instance_id??>
75<#else>
76 <#if site_news_asset_publisher_instance_id_default??>
77 <#assign site_news_asset_publisher_instance_id = site_news_asset_publisher_instance_id_default>
78 </#if>
79</#if>
80
81
82<section class="unav-news-list">
83 <#if entries?has_content>
84 <#list entries as curEntry>
85 <#assign article = journalArticleLocalService.fetchLatestArticle(curEntry.getClassPK()) />
86 <#assign aArticleXML = saxReaderUtil.read(article.getContentByLocale(locale)) />
87 <#assign contentFecha = aArticleXML.valueOf("//dynamic-element[@name='Fecha_noticia']/dynamic-content/text()") />
88 <#assign fechaParseada = contentFecha?date("yyyy-MM-dd") />
89 <#assign contentFechaURLString = fechaParseada?string["dd/MM/yyyy"] />
90 <#assign contentFechaString = fechaParseada?string["dd | MM | yyyy"] />
91
92
93 <#assign tituloNoticia = aArticleXML.valueOf("//dynamic-element[@name='Titulo_noticia']/dynamic-content/text()") />
94 <#assign autorNombre = aArticleXML.valueOf("//dynamic-element[@name='Nombre_autor']/dynamic-content/text()") />
95 <#assign autorImagen = aArticleXML.valueOf("//dynamic-element[@name='Autor_imagen']/dynamic-content/text()") />
96 <#assign jsonObjectString = aArticleXML.valueOf("//dynamic-element[@name='Imagen']/dynamic-content/text()") />
97 <!-- jsonObjectString: ${jsonObjectString} -->
98
99 <#assign video = aArticleXML.valueOf("//dynamic-element[@name='Video_youtube']/dynamic-content/text()") />
100
101 <#assign friendlyContentURL = assetPublisherHelper.getAssetViewURL(portalUtil.getLiferayPortletRequest(renderRequest), portalUtil.getLiferayPortletResponse(renderResponse), curEntry,true) />
102
103 <#assign tituloNoticiaEncoded = friendlyUrlDecode(tituloNoticia)>
104
105 <#-- Asset publisher instance id in main domain -->
106 <#assign mainDomainInstanceId = "lovPblW1fC70">
107 <#-- Urls generated always the same page for unav requirements-->
108 <#-- In main domain, go to main news page and use that asset publisher id. Causes issues with other domains -->
109 <#-- TODO: remove once custom fields are created-->
110 <#assign urlNews = languageUtil.get(locale, "url.news.details", "/noticias")>
111 <#assign instanceId = mainDomainInstanceId>
112
113 <#-- Configure url and asset publisher instance id with customFields-->
114 <#-- By default configured with main domain news page and asset publisher id. Other domains have to configure it manually in the site configuration -->
115 <#if site_news_url_value??>
116 <#assign urlNews = site_news_url_value>
117 </#if>
118 <#if site_news_asset_publisher_instance_id??>
119 <#assign instanceId = site_news_asset_publisher_instance_id>
120 </#if>
121
122 <#-- WORKAROUND FOR TEMPORAL SITES GO LIVE -->
123 <#-- lfr.cloud domain urls work differently, redirection to site news has to be adapted for it-->
124 <#if actualURLFriendly?contains("lfr.cloud")>
125 <#-- 1. Site with default news page. if using the default value, redirect to main site and use mainDomainInstanceId.-->
126 <#if site_news_url_default_value == site_news_url_value>
127 <script>console.log("1. Site with default news page.");</script>
128 <#assign urlNews = site_news_url_value>
129 <#assign instanceId = mainDomainInstanceId>
130 <#else>
131 <#-- 2. Site with custom news page. if site site_news_url_value contains /web/site/, use site_news_url_value as is and use originalInstanceId to redirect within the site-->
132 <#if site_news_url_value?contains("/web"+groupFriendlyURL)>
133 <script>console.log(" 2. Site with custom news page.");</script>
134 <#assign urlNews = site_news_url_value>
135 <#assign instanceId = originalInstanceId>
136
137 <#-- 3. Site with custom domain and custom news page. if site site_news_url_value doesn't contain /web/site/ , prepend /web/site to it, to redirect within the site-->
138 <#else>
139 <script>console.log("3. Site with custom domain and custom news page");</script>
140 <#assign urlNews = "/web"+groupFriendlyURL + site_news_url_value>
141 <#assign instanceId = originalInstanceId>
142
143 </#if>
144 </#if>
145
146 </#if>
147 <script>console.log("urlNews: ${urlNews}");</script>
148 <#assign urlDetail = urlNews+"/-/contents/"+contentFechaURLString+"/"+tituloNoticiaEncoded+"/content/"+instanceId+"/"+curEntry.getEntryId()>
149
150 <script>console.log("urlDetail: ${urlDetail}");</script>
151
152<#assign foto = "" >
153 <a href="${urlDetail}" class="unav-news-list__item">
154 <!-- entryId: ${curEntry.getEntryId()}. attempt jsonObjectString -->
155 <#if jsonObjectString?? && jsonObjectString?has_content>
156 <!-- entryId: ${curEntry.getEntryId()}. attempt jsonObjectString?? passed -->
157 <#attempt>
158 <!-- entryId: ${curEntry.getEntryId()}. attempt jsonObjectString?? passed 1-->
159 <#assign jsonObject = jsonObjectString?eval>
160 <!-- entryId: ${curEntry.getEntryId()}. attempt jsonObjectString?? passed 2-->
161 <#assign entryUuid = jsonObject.uuid />
162 <#assign entryGroupId = getterUtil.getLong(jsonObject.groupId) />
163 <#assign dlFileEntry = dlFileEntryLocalService.getDLFileEntryByUuidAndGroupId(entryUuid, entryGroupId) />
164 <#assign assetEntry = assetEntryLocalService.getEntry("com.liferay.document.library.kernel.model.DLFileEntry", dlFileEntry.fileEntryId) />
165 <#assign assetRenderer = assetEntry.assetRenderer />
166 <#assign foto = assetRenderer.getURLDownload(themeDisplay) />
167
168 <div class="unav-news-list__img" style="background-image: url('${foto});"> </div>
169 <#recover>
170 <!-- entryId: ${curEntry.getEntryId()}. attempt jsonObjectString?? but recovered-->
171 </#attempt>
172 </#if>
173 <#if video?has_content>
174 <#if foto == "">
175
176 <div class="unav-news-list__img" style="background-image:url(http://img.youtube.com/vi/${video}/0.jpg)">
177 </div>
178 </#if>
179 </#if>
180
181 <div class="unav-news-list__container-txt">
182 <p class="unav__text__date">${contentFechaString}</p>
183
184 <p class="unav__text unav__text--m">${tituloNoticia}</p>
185
186 <div class="unav-news-list__info">
187 <#if autorNombre?has_content>
188 <p class="unav-writing__info-txt"><span class="unav-writing__info-bold">${texto}</span>${autorNombre}</p>
189 </#if>
190 <#if autorImagen?has_content>
191 <p class="unav-writing__info-txt"><span class="unav-writing__info-bold">${imagen}</span>${autorImagen}</p>
192 </#if>
193 </div>
194 </div>
195 </a>
196 </#list>
197 </#if>
198
199
200</section>
201
202<script>
203 $(document).ready( function() {
204 // Avoid lost focus when paginate
205 if ($('.lfr-pagination-buttons')) {
206 var paginationButtons = $('.lfr-pagination-buttons').children();
207 for (const paginationButton of paginationButtons) {
208 var link = $(paginationButton).children();
209 if(link) {
210 $(link).click(function(e){
211 e.preventDefault();
212 var url = $(this).attr('href');
213 console.log("url : "+url);
214 window.location.href = url + '#unav-news-list';
215 });
216 }
217 }
218 }
219 });
220</script>
221
222<#function friendlyUrlDecode title>
223
224 <#assign titleFriendly = title?replace("[^A-Za-z0-9À-ú ]", "", "r")?lower_case>
225 <#assign titleFriendly = titleFriendly?replace("á", "a", "r")>
226 <#assign titleFriendly = titleFriendly?replace("é", "e", "r")>
227 <#assign titleFriendly = titleFriendly?replace("í", "i", "r")>
228 <#assign titleFriendly = titleFriendly?replace("ó", "o", "r")>
229 <#assign titleFriendly = titleFriendly?replace("ú", "u", "r")>
230 <#assign titleFriendly = titleFriendly?replace("ñ", "n", "r")>
231 <#assign titleFriendly = URLEncoder.encode(titleFriendly)>
232 <#assign titleFriendly = titleFriendly?replace("\\+", "-","r")>
233 <#return titleFriendly>
234</#function>