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