1<#include "${fullTemplatesPath}/functions/relatedContentUtil.ftl" />
2<#-- bezieht sich auf WCS Publikation -->
3<#assign JournalArticleLocalService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") />
4<#assign AssetEntryLocalService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetEntryLocalService") />
5
6<#assign articleId = .vars['reserved-article-id'].data />
7<#assign articleTitle = .vars['reserved-article-title'].data />
8
9<#-- get link from frontend service -->
10<#assign contentUrl = "/404" >
11<#assign journalArticle = JournalArticleLocalService.getArticle(groupId, articleId) />
12<#if journalArticle?has_content>
13 <#assign className = "com.liferay.journal.model.JournalArticle">
14 <#assign resourcePrimKey = journalArticle.getResourcePrimKey()!"">
15 <#assign assetEntry = AssetEntryLocalService.getEntry(className, resourcePrimKey) />
16
17 <#if assetEntry?has_content>
18 <#assign classPK = assetEntry.getClassPK()!"" >
19 <#assign contentUrl = FrontendService.article.getFriendlyUrl(classPK, themeDisplay.getLocale(), themeDisplay.getScopeGroupId()) >
20 </#if>
21</#if>
22
23<#function getJournalArticle referenceStructure >
24 <#local journalArticle = "" >
25
26 <#attempt>
27 <#local data = FrontendService.json.parseAsJson(referenceStructure.getData()) >
28 <#if data?is_hash>
29 <#local classPK = data['classPK'] >
30 <#local className = data['className'] >
31 <#local entry = AssetEntryLocalService.getEntry(className, classPK?number)! >
32 <#if entry??>
33 <#local assetRenderer = entry.getAssetRenderer() />
34 <#local journalArticle = (assetRenderer.getArticle())! />
35 </#if>
36 </#if>
37 <#recover>
38 <#-- catch block -->
39 </#attempt>
40
41 <#return journalArticle >
42
43</#function>
44
45<#function getSaxReaderDocument dataObj >
46 <#local document = "" >
47
48 <#local journalArticle = getJournalArticle(dataObj) >
49 <#if journalArticle?has_content>
50 <#local document = (saxReaderUtil.read(journalArticle.getContentByLocale(locale.toString())))!"" />
51 </#if>
52
53 <#return document >
54
55</#function>
56
57<#-- Quelle macro
58------------------------------------------------------------------------------------------------------------------------>
59<#macro mediaReference groupId uuid >
60 <#local mediaObj = FrontendService.media.getDMTJsonObject(groupId, uuid, locale)!"" >
61
62 <#if mediaObj?has_content && (mediaObj.quelle)?has_content >
63 <#local source = mediaObj.quelle?substring(1, (mediaObj.quelle?length - 1))>
64 <#if source?has_content>
65 <span class="o-imagesource">${source}</span>
66 </#if>
67 </#if>
68</#macro>
69
70 <#-- PERSON macro
71 ------------------------------------------------------------------------------------------------------------------------>
72 <#macro personName document >
73 <#if document?has_content>
74 <#local anredetitel = "">
75 <#local vorname = "">
76 <#local nachname = "">
77
78 <#if document.selectSingleNode("/root/dynamic-element[@name='anredetitel']/dynamic-content")??>
79 <#local node = document.selectSingleNode("/root/dynamic-element[@name='anredetitel']/dynamic-content") />
80 <#local nodeText = node.getText() />
81 <#if nodeText?has_content >
82 <#local anredetitel = nodeText >
83 </#if>
84 </#if>
85
86 <#if document.selectSingleNode("/root/dynamic-element[@name='vorname']/dynamic-content")??>
87 <#local node = document.selectSingleNode("/root/dynamic-element[@name='vorname']/dynamic-content") />
88 <#local nodeText = node.getText() />
89 <#if nodeText?has_content >
90 <#local vorname = nodeText >
91 </#if>
92 </#if>
93
94 <#if document.selectSingleNode("/root/dynamic-element[@name='nachname']/dynamic-content")??>
95 <#local node = document.selectSingleNode("/root/dynamic-element[@name='nachname']/dynamic-content") />
96 <#local nodeText = node.getText() />
97 <#if nodeText?has_content >
98 <#local nachname = nodeText >
99 </#if>
100 </#if>
101
102 </#if>
103
104 <#if anredetitel?has_content || vorname?has_content || nachname?has_content >
105 <span class="o-metadata o-metadata--author">
106 von ${anredetitel} ${vorname} ${nachname}
107 </span>
108 </#if>
109 </#macro>
110
111<a class="c-teaserlist-item__content o-link-bare" href="${contentUrl}">
112
113 <#-- Artikel Cover -->
114 <#assign bg = "/o/kas-de-debattenblog-theme/images/generic-fallback.png">
115 <#assign linkToDMT = bg>
116 <#if (coverDMTKASDEMEDIUM.getData())?has_content>
117 <#assign bg = coverDMTKASDEMEDIUM.getData() >
118 <#assign mediumData = coverDMTKASDEMEDIUM.data!""?eval />
119 <#assign linkToDMT = FrontendService.media.getImageURLForAMConfiguration('hd-resolution', mediumData["groupId"]?number, mediumData["uuid"]) /> <#-- Cover -->
120 </#if>
121
122 <#if isDPMColorSchemeNEW()>
123 <div class="c-teaserlist-item__left">
124 </#if>
125
126 <div class="c-teaserlist-item__media" style="background-image: url('${linkToDMT}')">
127 <#if mediumData?has_content>
128 <@mediaReference mediumData["groupId"]?number mediumData["uuid"] />
129 </#if>
130 </div>
131
132 <#if isDPMColorSchemeNEW()>
133
134 <#-- Laufendenummer -->
135 <#assign verbundJournalArticle = FrontendService.publication.getVerbundToPublikation(journalArticle)!"" >
136 <#if verbundJournalArticle?has_content>
137 <#assign document = (saxReaderUtil.read(verbundJournalArticle.getContentByLocale(locale.toString())))!"" />
138 <#if document?has_content>
139
140 <#if document.selectSingleNode("/root/dynamic-element[@name='laufendenummer']/dynamic-content")??>
141 <#assign node = document.selectSingleNode("/root/dynamic-element[@name='laufendenummer']/dynamic-content") />
142 <#assign laufendenummer = node.getText() />
143 <#if laufendenummer?has_content >
144 <span class="o-metadata o-metadata--hash"><@liferay.language key="ausgabe" /> ${laufendenummer}</span>
145 </#if>
146 </#if>
147 </#if>
148 </#if>
149
150 <#-- Erscheinungsdatum -->
151 <#assign erscheinungsdatum_Data = getterUtil.getString(erscheinungsdatum.getData())>
152
153 <#if validator.isNotNull(erscheinungsdatum_Data)>
154 <#assign erscheinungsdatum_DateObj = dateUtil.parseDate("yyyy-MM-dd", erscheinungsdatum_Data, locale)>
155 <span class="o-metadata o-metadata--date">
156 ${dateUtil.getDate(erscheinungsdatum_DateObj, "dd. MMMM yyyy", locale)}
157 </span>
158 </#if>
159 </#if>
160
161 <#-- Titel -->
162 <h4 class="c-teaserlist-item__headline">
163 ${articleTitle!""}
164 </h4>
165
166 <#-- Untertitel -->
167 <p class="c-teaserlist-item__description">
168 ${untertitel.getData()}
169 </p>
170
171 <#if isDPMColorSchemeNEW()>
172 <#if autorenWCSKASDEPERSON.getSiblings()?has_content>
173 <#list autorenWCSKASDEPERSON.getSiblings() as cur_autorenWCSKASDEPERSON>
174 <#assign document = getSaxReaderDocument(cur_autorenWCSKASDEPERSON) >
175 <#-- <span class="o-metadata o-metadata--author"> -->
176 <@personName document />
177 <#-- </span> -->
178 </#list>
179 </span>
180 </#if>
181 </#if>
182
183 <#if isDPMColorSchemeNEW()>
184 </div>
185 <div class="c-teaserlist-item__right">
186 </#if>
187
188 <button class="o-cta c-teaserlist-item__cta">
189 <#if !isDPMColorSchemeNEW()>
190 <@liferay.language key="jetzt.lesen" />
191 </#if>
192 <#if isDPMColorSchemeNEW()>
193 <@liferay.language key="artikel.lesen" />
194 </#if>
195 </button>
196
197 <#if isDPMColorSchemeNEW()>
198 </div>
199 </#if>
200</a>