Fondo nuove competenze seconda edizione: ulteriore chiarimento sui termini di realizzazione - ANPAL
Asset Publisher
An error occurred while processing the template.
The following has evaluated to null or missing: ==> dateArticleCurrent [in template "20099#20135#21363" at line 37, column 242] ---- Tip: If the failing expression is known to be 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: ${dateArticleCurrent} [in template "20099#20135#21363" at line 37, column 240] ----
1<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
2<#assign journalArticleId = .vars['reserved-article-id'].data/>
3<#assign article = journalArticleLocalService.getArticle(getterUtil.getLong(groupId), journalArticleId)>
4<#assign assetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
5<#assign asset = assetEntryLocalService.getEntry('com.liferay.journal.model.JournalArticle', article.resourcePrimKey) >
6<#assign categoriesArticleCurrent=asset.getCategories() />
7<#assign categoryIdsArticleCurrent=asset.getCategoryIds()/>
8
9<#assign urlCurrent = themeDisplay.getPortalURL() + themeDisplay.getURLCurrent() />
10<#function getUrlSocial themeDisplay socialType>
11 <#assign url = "#" />
12 <#if socialType == "facebook">
13 <#assign url = "https://www.facebook.com/sharer/sharer.php?u=${urlCurrent}" />
14 <#elseif socialType == "twitter">
15 <#assign url = "https://twitter.com/intent/tweet?text=${urlCurrent}" />
16 </#if>
17 <#return url>
18</#function>
19
20<#assign data_news_Data = getterUtil.getString(data_news.getData())>
21 <#if validator.isNotNull(data_news_Data)>
22 <#assign data_news_DateObj = dateUtil.parseDate("yyyy-MM-dd", data_news_Data, locale) />
23 <#assign dateArticleCurrent= dateUtil.getDate(data_news_DateObj, "dd.MM.yy", locale) />
24 </#if>
25
26<#if categoriesArticleCurrent?? && categoriesArticleCurrent?has_content>
27 <#assign categorieEntryCurrent=categoriesArticleCurrent[0] />
28</#if>
29
30<div class="container">
31 <div class="px-4 px-sm-0">
32 <div class="row">
33 <div class="col-12 col-md-6 mb-4 mb-sm-0">
34 <div class="card card-news">
35 <div class="card-body pl-1 pr-2 py-0">
36 <#if categorieEntryCurrent?? && categorieEntryCurrent?has_content>
37 <p class="text-primary text-14p text-spacing font-weight-bold mb-2"><span class="category uppercase"> ${categorieEntryCurrent.getTitle(locale)}</span> — ${dateArticleCurrent}</p>
38 <#else>
39 <p class="text-primary text-14p text-spacing font-weight-bold mb-2">${dateArticleCurrent}</p>
40 </#if>
41
42
43 <h2 class="p-0 text-40p line-h48p">${titolo_news.getData()}</h2>
44
45 <p class="text-28p line-h40p font-weight-600 mb-2">${asset.getSummaryCurrentValue()}</p>
46
47 <#if img_news.getData()!="">
48 <div class="img100x mb-2"><img src="${img_news.getData()}" alt="${img_descr.getData()}"/></div>
49 <#else>
50 <#if categorieEntryCurrent?? && categorieEntryCurrent?has_content>
51 <#assign imgDefault=categorieEntryCurrent.getName()?replace(" ","-")?lower_case/>
52 <#assign imgDefault=imgDefault+".JPG"/>
53 <#else>
54 <#assign imgDefault="default.JPG"/>
55 </#if>
56 <#assign imgUrl = "/documents/"+themeDisplay.getLayout().getGroupId()+"/"+586348+"/"+imgDefault />
57
58 <div class="img100x mb-2"><img src="${imgUrl}" alt="imagine ${titolo_news.getData()}"/></div>
59 </#if>
60
61 <p class="text-chambray font-lora mb-4">${corpo.getData()} </p>
62 </div>
63 </div>
64
65 <div class="pl-1 pl-sm-2">
66 <p class="text-24p text-primary"><strong>Condividi</strong>
67 <#assign socialUrl = getUrlSocial(themeDisplay,'facebook') />
68 <a href="${socialUrl}" aria-label="Condividi su Facebook" target="_blank" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');return false;" title="Facebook - Sito esterno" class="d-inline-block ml-3 mr-2"><span class="fab fa-facebook-square text-22p"></span></a>
69
70 <#assign socialUrl = getUrlSocial(themeDisplay,'twitter') />
71 <a href="${socialUrl}" aria-label="Condividi su Twitter" target="_blank" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=600');return false;"title="Twitter - Sito esterno" class="d-inline-block mx-2"><span class="fab fa-twitter text-20p"></span></a>
72 </p>
73 </div>
74
75 </div>
76
77
78 <#assign journalAssetLinkLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetLinkLocalService") />
79 <#assign journalArticleRelatedEntry = journalAssetLinkLocalService.getDirectLinks(asset.getEntryId()) />
80
81 <#if journalArticleRelatedEntry?has_content>
82 <div class="col-12 col-md-6 b-left">
83 <h3 class="pt-0 text-24p ml-2 mb-2">Notizie Correlate</h3>
84
85 <#list journalArticleRelatedEntry as relatedEntry>
86 <#assign relatedAssetEntryId = relatedEntry.getEntryId2() />
87 <#assign relatedAssetEntry = assetEntryLocalService.getEntry(relatedAssetEntryId ) />
88 <#assign relatedJournalArticle = journalArticleLocalService.getLatestArticle( relatedAssetEntry.getClassPK() ) />
89 <#assign renderer = relatedAssetEntry.getAssetRenderer() >
90 <#assign journalArticle = renderer.getArticle() >
91 <#assign document = saxReaderUtil.read(journalArticle.getContentByLocale(themeDisplayLocale)) >
92 <#assign rootElement = document.document.getRootElement() >
93
94
95 <#assign xPathSelectorTitoloNews = saxReaderUtil.createXPath("dynamic-element[@name='titolo_news']") >
96 <#if xPathSelectorTitoloNews.selectSingleNode(rootElement)?has_content>
97 <#assign titolo_news = xPathSelectorTitoloNews.selectSingleNode(rootElement).getStringValue() >
98 </#if>
99 <#assign xPathSelectorData= saxReaderUtil.createXPath("dynamic-element[@name='data_news']") >
100 <#if xPathSelectorData.selectSingleNode(rootElement)?has_content>
101 <#assign data_news = xPathSelectorData.selectSingleNode(rootElement).getStringValue() >
102 <#assign dateNewsObj = dateUtil.parseDate("yyyy-MM-dd", data_news?trim, locale)>
103 <#assign dateRelatedArticle= dateUtil.getDate(dateNewsObj, "dd.MM.yy", locale) />
104 </#if>
105 <#assign categories=relatedAssetEntry.getCategories()/>
106 <#if categories?? && categories?has_content>
107 <#assign categorieEntry=categories[0] />
108 </#if>
109
110 <#if categorieEntry?? && categorieEntry?has_content>
111 <#assign imgDefault=categorieEntry.getName()?replace(" ","-")?lower_case/>
112 <#assign imgDefault=imgDefault+".JPG"/>
113 <#else>
114 <#assign imgDefault="default.JPG"/>
115 </#if>
116 <#assign xPathSelectorImmagine = saxReaderUtil.createXPath("dynamic-element[@name='img_news']") >
117 <#assign imgUrl="">
118
119 <#if xPathSelectorImmagine.selectSingleNode(rootElement)?has_content>
120 <#assign img_news = xPathSelectorImmagine.selectSingleNode(rootElement).getStringValue() >
121 <#if img_news !="" && validator.isContent(img_news)>
122 <#assign jsonImmagine=jsonFactoryUtil.createJSONObject(img_news)>
123 <#assign groupId=jsonImmagine.getLong("groupId")>
124 <#assign uuId=jsonImmagine.getString("uuid")>
125 <#assign imgName=jsonImmagine.getString("title")>
126
127 <#assign imgUrl = "/documents/"+groupId+"/"+0+"/"+imgName+"/"+uuId />
128 <#else>
129 <#assign imgUrl = "/documents/"+themeDisplay.getLayout().getGroupId()+"/"+586348+"/"+imgDefault />
130 </#if>
131 </#if>
132
133
134 <div class="row card-news mb-4">
135 <div class="col-12 col-sm-4">
136 <div><img alt="${titolo_news}" src="${imgUrl}" class=" w-100 ml-sm-2 mb-2"></div>
137 </div>
138 <div class="col-12 col-sm-8">
139 <#if categories?? && categories?has_content>
140 <#assign categorieEntry=categories[0] />
141 <p class="text-primary text-14p text-spacing font-weight-bold mb-2"><span class="category uppercase"> ${categorieEntry.getTitle(locale)}</span> — ${dateRelatedArticle}</p>
142 <#else>
143 <p class="text-primary text-14p text-spacing font-weight-bold mb-2">${dateRelatedArticle}</p>
144 </#if>
145 <p class="text-28p line-h40p font-weight-600 mb-2">${titolo_news}</p>
146 <p class="text-chambray font-lora line-h24p mb-4">${relatedAssetEntry.getSummaryCurrentValue()}</p>
147 <a href="${relatedJournalArticle.getUrlTitle()}" class="text-14p font-weight-bold">
148 Leggi di più
149 <span aria-hidden="true">→</span>
150 <span class="sr-only">
151 Riguardo ${titolo_news}
152 </span>
153 </a>
154 </div>
155 </div>
156 </#list>
157 </div>
158 <#elseif (categoryIdsArticleCurrent??) && (categoryIdsArticleCurrent?has_content)>
159 <#assign assetEntryQuery = objectUtil('com.liferay.asset.kernel.service.persistence.AssetEntryQuery')>
160
161 <#assign search = assetEntryQuery.setClassName("com.liferay.journal.model.JournalArticle")>
162
163 <#assign search = assetEntryQuery.setAllCategoryIds(categoryIdsArticleCurrent)>
164
165 <#assign search = assetEntryQuery.setOrderByCol1("publishDate")>
166
167 <#assign entries = assetEntryLocalService.getEntries(assetEntryQuery)>
168
169 <div class="col-12 col-md-6 b-left">
170 <h3 class="pt-0 text-24p ml-2 mb-2">Notizie correlate per categoria</h3>
171 <#list entries as relatedEntry>
172 <#assign relatedJournalArticle = journalArticleLocalService.getLatestArticle( relatedEntry.getClassPK() ) />
173 <#assign renderer = relatedEntry.getAssetRenderer() >
174 <#assign journalArticle = renderer.getArticle() >
175
176 <#if (relatedEntry.getEntryId()!=asset.getEntryId()) && (article.getDDMStructureKey()==journalArticle.getDDMStructureKey())>
177 <#if ((relatedEntry?index)<6)>
178 <#assign document = saxReaderUtil.read(journalArticle.getContentByLocale(themeDisplayLocale)) >
179 <#assign rootElement = document.document.getRootElement() >
180 <#assign createDate = dateUtil.getDate(journalArticle.createDate, "dd/MM/yyyy", locale) >
181
182 <#assign xPathSelectorTitoloNews = saxReaderUtil.createXPath("dynamic-element[@name='titolo_news']") >
183 <#if xPathSelectorTitoloNews.selectSingleNode(rootElement)?has_content>
184 <#assign titolo_news = xPathSelectorTitoloNews.selectSingleNode(rootElement).getStringValue() >
185 </#if>
186 <#assign xPathSelectorData= saxReaderUtil.createXPath("dynamic-element[@name='data_news']") >
187 <#if xPathSelectorData.selectSingleNode(rootElement)?has_content>
188 <#assign data_news = xPathSelectorData.selectSingleNode(rootElement).getStringValue() >
189 <#assign dateNewsObj = dateUtil.parseDate("yyyy-MM-dd", data_news?trim, locale)>
190 <#assign dateRelatedArticle= dateUtil.getDate(dateNewsObj, "dd.MM.yy", locale) />
191 </#if>
192 <#assign categories=relatedEntry.getCategories()/>
193
194 <#if categories?? && categories?has_content>
195 <#assign categorieEntry=categories[0] />
196 </#if>
197
198 <#if categorieEntry?? && categorieEntry?has_content>
199 <#assign imgDefault=categorieEntry.getName()?replace(" ","-")?lower_case/>
200 <#assign imgDefault=imgDefault+".JPG"/>
201 <#else>
202 <#assign imgDefault="default.JPG"/>
203 </#if>
204 <#assign xPathSelectorImmagine = saxReaderUtil.createXPath("dynamic-element[@name='img_news']") >
205 <#assign imgUrl="">
206
207 <#if xPathSelectorImmagine.selectSingleNode(rootElement)?has_content>
208 <#assign img_news = xPathSelectorImmagine.selectSingleNode(rootElement).getStringValue() >
209 <#if img_news !="" && validator.isContent(img_news)>
210 <#assign jsonImmagine=jsonFactoryUtil.createJSONObject(img_news)>
211 <#assign groupId=jsonImmagine.getLong("groupId")>
212 <#assign uuId=jsonImmagine.getString("uuid")>
213 <#assign imgName=jsonImmagine.getString("title")>
214
215 <#assign imgUrl = "/documents/"+groupId+"/"+0+"/"+imgName+"/"+uuId />
216 <#else>
217 <#assign imgUrl = "/documents/"+themeDisplay.getLayout().getGroupId()+"/"+586348+"/"+imgDefault />
218 </#if>
219 </#if>
220
221 <#assign categories=relatedEntry.getCategories() />
222
223 <div class="row card-news mb-4">
224 <div class="col-12 col-sm-4">
225 <div ><img alt="${titolo_news}" src="${imgUrl}" class=" w-100 ml-sm-2 mb-2"></div>
226 </div>
227 <div class="col-12 col-sm-8">
228 <#if categories?? && categories?has_content>
229 <#assign categorieEntry=categories[0] />
230 <p class="text-primary text-14p text-spacing font-weight-bold mb-2"><span class="category uppercase"> ${categorieEntry.getTitle(locale)}</span> — ${dateRelatedArticle}</p>
231 <#else>
232 <p class="text-primary text-14p text-spacing font-weight-bold mb-2">${dateRelatedArticle}</p>
233 </#if>
234 <p class="text-28p line-h40p font-weight-600 mb-2">${titolo_news}</p>
235 <p class="text-chambray font-lora line-h24p mb-4">${relatedEntry.getSummaryCurrentValue()}</p>
236 <a href="${relatedJournalArticle.getUrlTitle()}" class="text-14p font-weight-bold">
237 Leggi di più
238 <span aria-hidden="true">→</span>
239 <span class="sr-only">
240 Riguardo ${titolo_news}
241 </span>
242 </a>
243 </div>
244 </div>
245 </#if>
246 </#if>
247
248 </#list>
249 </div>
250 </#if>
251 </div>
252 </div>
253</div>