1<#assign liferay_ui = taglibLiferayHash["/META-INF/liferay-ui.tld"] />
2
3<#-- ---------- UPV/EHU -------- -->
4<#-- Identificador de contenido dentro del publicador. Por defecto empieza en 0, excepto si hay filtrado por categoria o si se ignora el parametro compartido "categoryId", lo que supone no destacar el primer contenido del listado -->
5<#assign itemNumber = 0 />
6
7<#assign journalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
8
9<ul class="asset-list asset-list-summary">
10<#-- ---------- UPV/EHU - UPV/EHU ---------- -->
11 <#list entries as entry>
12
13 <#assign entry = entry />
14
15 <#assign assetRenderer = entry.getAssetRenderer() />
16
17 <#assign entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) />
18
19 <#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry) />
20
21 <#--- UPV/EHU - UPV/EHU --->
22 <#--- Si el contenido web tiene página de visualización (página detalle) se hará uso de la friendly URL--->
23 <#if assetRenderer?has_content && assetRenderer.getArticle??>
24 <#assign journalArticle = assetRenderer.getArticle() />
25 <#if journalArticle?has_content>
26 <#assign layoutUuid = journalArticle.getLayoutUuid() />
27 <#if layoutUuid?has_content >
28 <#assign urlViewContext = assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL) />
29 <#assign viewURL = urlViewContext />
30 </#if>
31 </#if>
32 </#if>
33
34
35
36 <#-- ---------- UPV/EHU -------- -->
37 <#-- Si la URL para mostrar el contenido completo es de la parte publica del sitio web guest se quita de la URL -->
38 <#assign guestPublicSiteURL = "/web/guest" />
39 <#if viewURL?contains(guestPublicSiteURL) >
40 <#assign viewURL = viewURL?replace(guestPublicSiteURL, "") />
41 </#if>
42
43 <li class="asset-summary item-${itemNumber}">
44 <div class="lfr-meta-actions asset-actions">
45 <@getEditIcon />
46 </div>
47
48 <#-- ---------- UPV/EHU -------- -->
49 <#-- Si el publicador muestra solo contenidos, se muestra cada contenido con la plantilla summary correspondiente al tipo del contenido si existe dicha plantilla, sino aparece mensaje de error -->
50
51 <#assign journalArticleClass = "com.liferay.journal.model.JournalArticle" />
52 <#assign ddmTemplateKey = 0 />
53
54 <#if assetRenderer.getClassName() == journalArticleClass >
55 <#assign journalArticle = assetRenderer.getArticle() />
56 <#assign structureIdStr = journalArticle.getDDMStructureKey() />
57 <#assign globalGroupId = themeDisplay.getCompanyGroupId() />
58 <#assign localGroupId = themeDisplay.getSiteGroupId() />
59 <#assign classNameId = portalUtil.getClassNameId(journalArticleClass)/>
60 <#assign ddmStructureLocalService = serviceLocator.findService("com.liferay.dynamic.data.mapping.service.DDMStructureLocalService") />
61
62 <#-- se controla la excepcion que puede producirse al intentar recuperar una estructura que no está en global, forzando así, que en este caso, se ejecute la recuperación de la estructura en el site local -->
63 <#-- Si existe la estructura/tipo de contenido en el ambito Global -->
64 <#if ddmStructureLocalService.fetchStructure(globalGroupId,classNameId,structureIdStr)?? >
65 <#assign ddmStructure = ddmStructureLocalService.fetchStructure(globalGroupId,classNameId,structureIdStr) />
66 </#if>
67
68 <#-- Si existe la estructura/tipo de contenido en el ambito Local -->
69 <#-- Si existe la estructura/tipo de contenido en el ambito Local -->
70 <#if !ddmStructure?? && ddmStructureLocalService.fetchStructure(localGroupId,classNameId,structureIdStr)??>
71 <#assign ddmStructure = ddmStructureLocalService.fetchStructure(localGroupId,classNameId,structureIdStr) />
72 </#if>
73
74 <#-- Si existe la estructura/tipo de contenido -->
75 <#if ddmStructure?? >
76 <#assign templateName = "Summary" />
77 <#assign ddmTemplates = ddmStructure.getTemplates() />
78 <#-- ---------- Si la estructura/tipo de contenido tiene asociadas plantillas/visualizaciones -->
79 <#assign isCall = false />
80 <#assign isOutStanding = false />
81 <#assign isHelp = false />
82 <#if (ddmTemplates??)>
83 <#list ddmTemplates as ddmTemplate>
84 <#-- Si la plantilla/visualizacion es de tipo resumen -->
85 <#if ddmTemplate.getName()?contains("Summary") || ddmTemplate.getName()?contains("Laburpena") || ddmTemplate.getName()?contains("Resumen") >
86 <#assign ddmTemplateKeyStr = ddmTemplate.getTemplateKey()/>
87 <#assign ddmTemplateKey = getterUtil.getLongStrict(ddmTemplateKeyStr)/>
88 </#if>
89 <#if ddmStructure.getName()?contains("Call")>
90 <#assign isCall = true />
91 <#elseif ddmStructure.getName()?contains("Outstanding")>
92 <#assign isOutStanding = true />
93 <#elseif ddmStructure.getName()?contains("Subvention")>
94 <#assign isHelp = true />
95 </#if>
96 </#list>
97 </#if>
98
99 <#-- Si existe la plantilla de nombre Summary -->
100 <#if (ddmTemplateKey != 0)>
101 <#if isCall>
102
103 <#assign infoStateUrl = '' />
104 <#assign provisionalStateUrl = '' />
105 <#assign finalStateUrl = '' />
106 <#assign ref = '' />
107
108 <#assign
109 ddmFieldLocalServiceUtil = serviceLocator.findService("com.liferay.dynamic.data.mapping.service.DDMFieldLocalService")
110 />
111
112 <#assign ddmStructure = journalArticle.getDDMStructure() />
113
114 <#assign ddmFormValues = ddmFieldLocalServiceUtil.getDDMFormValues(ddmStructure.getDDMForm(), journalArticle.getId())/>
115
116 <#assign ddmFormFieldValuesMap = ddmFormValues.getDDMFormFieldValuesMap(true)>
117
118
119 <#list ddmFormFieldValuesMap as key,ddmFormFieldValues>
120
121 <#list ddmFormFieldValues as ddmFormFieldValue>
122
123 <#if ddmFormFieldValue.getName()=="ehuinfostateurl" && ddmFormFieldValue.getValue()?? && ddmFormFieldValue.getValue().getString(locale)?has_content>
124 <#assign infoStateUrl = ddmFormFieldValue.getValue().getString(locale) />
125 </#if>
126
127 <#if ddmFormFieldValue.getName()=="ehuprovisionalstateurl" && ddmFormFieldValue.getValue()?? && ddmFormFieldValue.getValue().getString(locale)?has_content>
128 <#assign provisionalStateUrl = ddmFormFieldValue.getValue().getString(locale) />
129 </#if>
130
131 <#if ddmFormFieldValue.getName()=="ehufinalstateurl" && ddmFormFieldValue.getValue()?? && ddmFormFieldValue.getValue().getString(locale)?has_content>
132 <#assign finalStateUrl = ddmFormFieldValue.getValue().getString(locale) />
133 </#if>
134
135 </#list>
136 </#list>
137
138
139 <#if infoStateUrl?? && !validator.isBlank(infoStateUrl)>
140 <#assign ref = infoStateUrl />
141 </#if><#-- infoUrl -->
142 <#if provisionalStateUrl?? && !validator.isBlank(provisionalStateUrl)>
143 <#assign ref = provisionalStateUrl />
144 </#if><#-- provisionalUrl -->
145 <#if finalStateUrl?? && !validator.isBlank(finalStateUrl)>
146 <#assign ref = finalStateUrl />
147 </#if><#-- finalUrl -->
148
149 <#assign protocol = "http">
150 <#if request?? && request?contains("https")>
151 <#assign protocol = "https">
152 </#if>
153 <#assign refProtocol = "http">
154 <#if ref?? && ref?contains("https")>
155 <#assign refProtocol = "https">
156 </#if>
157 <#if ref?? && !validator.isBlank( ref )>
158 <#if refProtocol??>
159 <#if ref?contains( refProtocol )>
160 <#assign viewURL = ref/>
161 <#else>
162 <#assign viewURL = refProtocol + "://" + ref/>
163 </#if>
164 <#else>
165 <#assign viewURL = protocol + "://" + ref/>
166 </#if>
167 </#if>
168
169 </#if><#-- if call -->
170
171 <#assign assetObject = assetRenderer.getAssetObject()/>
172 <#if !isOutStanding >
173 <a href="${viewURL}">
174 </#if>
175
176
177
178 <#assign articleContent = journalArticleLocalService.getArticleContent(assetObject, ddmTemplateKeyStr,"VIEW", locale, null, themeDisplay) >
179
180 <#-- Se controla que exista el article -->
181 <#if journalArticleLocalService.fetchDisplayArticle(assetObject.getGroupId(),journalArticle.getArticleId())?? >
182
183
184 <#-- Cambio para que el nombre del link en el publicador no sea demasiado grande y salte error de accesibilidad en informe del ministerio.
185 En los contenidos Ayuda pintamos ahora solo el título para no pintar un texto demasiado largo en el link. El resto lo pintamos tras cerrar el link -->
186 <#if isHelp>
187 <#assign document = saxReaderUtil.read(journalArticle.getContentByLocale(locale)) />
188 <#assign fieldEhutitle = "//dynamic-element[@name='ehutitle']" />
189 <#assign ehutitle = document.valueOf( fieldEhutitle + "/dynamic-content/text()" ) />
190 ${ehutitle}
191
192
193 <#else>
194 ${articleContent}
195 </#if>
196
197 </#if>
198
199 <#if !isOutStanding >
200 </a>
201 <#if isHelp>
202 ${articleContent}
203 </#if>
204 </#if>
205
206 <#-- Si NO existe la plantilla de nombre Summary mensaje de error -->
207 <#else>
208 <div class="alert alert-error"> ${ddmStructure.getNameCurrentValue()} <@liferay.language key="ehu.error.structure-has-no-summary-template-select-another-template" /></div>
209 </#if>
210
211 <@getMetadataField fieldName="tags" />
212
213 <@getMetadataField fieldName="create-date" />
214
215 <@getMetadataField fieldName="view-count" />
216
217 <@getMetadataField fieldName="author" />
218
219 <@getRatings />
220
221 <@getRelatedAssets />
222
223 <@getDiscussion />
224 </#if>
225 <#assign itemNumber = itemNumber + 1 />
226
227 <#-- ---------- UPV/EHU - UPV/EHU ---------- -->
228 <#else>
229 <h3 class="asset-title">
230 <#if assetRenderer?has_content && assetRenderer.getIconPath?has_content>
231 <a href="${viewURL}"><img alt="" src="${assetRenderer.getIconPath(renderRequest)}" />${entryTitle}</a>
232 </#if>
233 </h3>
234
235 <@getMetadataField fieldName="tags" />
236
237 <@getMetadataField fieldName="create-date" />
238
239 <@getMetadataField fieldName="view-count" />
240
241 <div class="asset-content">
242 <@getSocialBookmarks />
243
244 <div class="asset-summary">
245 <@getMetadataField fieldName="author" />
246
247
248 ${htmlUtil.escape(assetRenderer.getSummary(renderRequest, renderResponse))}
249
250 <a href="${viewURL}"><@liferay.language key="read-more" /><span class="sr-only"><@liferay.language key="about" />${entryTitle}</span> »</a>
251 </div>
252
253 <@getRatings />
254
255 <@getRelatedAssets />
256
257 <@getDiscussion />
258 </div>
259 </#if>
260
261 </li>
262 </#list>
263</ul>
264
265<#macro getDiscussion >
266 <#if enableComments??>
267 <#if assetRenderer?? && assetRenderer.getDiscussionPath()?? && (enableComments == "true")>
268 <br />
269
270 <#assign discussionURL = renderResponse.createActionURL() />
271
272 ${discussionURL.setParameter("struts_action", "/asset_publisher/" + assetRenderer.getDiscussionPath())}
273
274 <@liferay_ui["discussion"]
275 className=entry.getClassName()
276 classPK=entry.getClassPK()
277 formAction=discussionURL?string
278 formName="fm" + entry.getClassPK()
279 ratingsEnabled=enableCommentRatings == "true"
280 redirect=portalUtil.getCurrentURL(request)
281 userId=assetRenderer.getUserId()
282 />
283 </#if>
284 </#if>
285</#macro>
286
287<#macro getEditIcon>
288 <#if assetRenderer.hasEditPermission(themeDisplay.getPermissionChecker())>
289 <#assign editPortletURL = assetRenderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("NORMAL"), themeDisplay.getURLCurrent())!"" />
290
291 <#if validator.isNotNull(editPortletURL)>
292 <#assign title = languageUtil.format(locale, "edit-x", entryTitle) />
293
294 <@liferay_ui["icon"]
295 image="edit"
296 message=title
297 url=editPortletURL.toString()
298 />
299 </#if>
300 </#if>
301</#macro>
302
303<#macro getFlagsIcon>
304 <#if enableFlags??>
305 <#if enableFlags == "true">
306 <@liferay_ui["flags"]
307 className=entry.getClassName()
308 classPK=entry.getClassPK()
309 contentTitle=entry.getTitle(locale)
310 label=false
311 reportedUserId=entry.getUserId()
312 />
313 </#if>
314 </#if>
315</#macro>
316
317<#macro getMetadataField
318 fieldName
319>
320 <#if stringUtil.split(metadataFields)?seq_contains(fieldName)>
321 <span class="metadata-entry metadata-${fieldName}">
322 <#assign dateFormat = "dd MMM yyyy - HH:mm:ss" />
323
324 <#if fieldName == "author">
325 ${portalUtil.getUserName(assetRenderer.getUserId(), assetRenderer.getUserName())}
326 <#elseif fieldName == "categories">
327 <@liferay_ui["asset-categories-summary"]
328 className=entry.getClassName()
329 classPK=entry.getClassPK()
330 portletURL=renderResponse.createRenderURL()
331 />
332 <#elseif fieldName == "create-date">
333 ${dateUtil.getDate(entry.getCreateDate(), dateFormat, locale)}
334 <#elseif fieldName == "expiration-date">
335 ${dateUtil.getDate(entry.getExpirationDate(), dateFormat, locale)}
336 <#elseif fieldName == "modified-date">
337 ${dateUtil.getDate(entry.getModifiedDate(), dateFormat, locale)}
338 <#elseif fieldName == "priority">
339 ${entry.getPriority()}
340 <#elseif fieldName == "publish-date">
341 ${dateUtil.getDate(entry.getPublishDate(), dateFormat, locale)}
342 <#elseif fieldName == "tags">
343 <@liferay_ui["asset-tags-summary"]
344 className=entry.getClassName()
345 classPK=entry.getClassPK()
346 portletURL=renderResponse.createRenderURL()
347 />
348 <#elseif fieldName == "view-count">
349 <@liferay_ui["icon"]
350 image="history"
351 />
352
353 ${entry.getViewCount()} <@liferay.language key="views" />
354 </#if>
355 </span>
356 </#if>
357</#macro>
358
359<#macro getPrintIcon>
360 <#if enablePrint??>
361 <#if enablePrint == "true" >
362 <#assign printURL = renderResponse.createRenderURL() />
363
364 ${printURL.setParameter("struts_action", "/asset_publisher/view_content")}
365 ${printURL.setParameter("assetEntryId", entry.getEntryId()?string)}
366 ${printURL.setParameter("viewMode", "print")}
367 ${printURL.setParameter("type", entry.getAssetRendererFactory().getType())}
368
369 <#if (validator.isNotNull(assetRenderer.getUrlTitle()))>
370 <#if (assetRenderer.getGroupId() != themeDisplay.getScopeGroupId())>
371 ${printURL.setParameter("groupId", assetRenderer.getGroupId()?string)}
372 </#if>
373
374 ${printURL.setParameter("urlTitle", assetRenderer.getUrlTitle())}
375 </#if>
376
377 ${printURL.setWindowState("pop_up")}
378
379 <@liferay_ui["icon"]
380 image="print"
381 message="print"
382 url="javascript:Liferay.Util.openWindow({id:'" + renderResponse.getNamespace() + "printAsset', title: '" + languageUtil.format(locale, "print-x-x", ["sr-only", entryTitle]) + "', uri: '" + htmlUtil.escapeURL(printURL.toString()) + "'});"
383 />
384 </#if>
385 </#if>
386</#macro>
387
388<#macro getRatings>
389 <#if enableRatings??>
390 <#if (enableRatings == "true")>
391 <div class="asset-ratings">
392 <@liferay_ui["ratings"]
393 className=entry.getClassName()
394 classPK=entry.getClassPK()
395 />
396 </div>
397 </#if>
398 </#if>
399</#macro>
400
401<#macro getRelatedAssets>
402 <#if enableRelatedAssets??>
403 <#if assetEntry?? && enableRelatedAssets == "true">
404 <@liferay_ui["asset-links"]
405 assetEntryId=entry.getEntryId()/>
406 </#if>
407 </#if>
408</#macro>
409
410<#macro getSocialBookmarks>
411 <#if enableSocialBookmarks??>
412 <#if enableSocialBookmarks?has_content && enableSocialBookmarks == "true">
413 <@liferay_ui["social-bookmarks"]
414 displayStyle="${socialBookmarksDisplayStyle}"
415 target="_blank"
416 title=entry.getTitle(locale)
417 url=viewURL
418 />
419 </#if>
420 </#if>
421</#macro>