Fehler bei der Verarbeitung der Vorlage.
Error while invoking the "replace-content" JSP custom tag; see cause exception

----
FTL stack trace ("~" means nesting-related):
	- Failed at: @ait_contentreplacer["replace-content"]  [in template "20116#20152#BKS-NEWSEINTRAG" at line 9, column 1]
----
1<#assign 
2	ait_contentreplacer = taglibLiferayHash["/META-INF/ait-contentreplacer.tld"] 
3 
4	DLFileEntryService = serviceLocator.findService('com.liferay.document.library.kernel.service.DLFileEntryService') 
5	DLAppService = serviceLocator.findService('com.liferay.document.library.kernel.service.DLAppService') 
6	DLUtil = serviceLocator.findService('com.liferay.document.library.kernel.util.DLUtil') 
7/> 
8 
9<@ait_contentreplacer["replace-content"]> 
10 
11	<#assign 
12		labelDownloads = "Downloads" 
13		defaultDateFormat = "dd.MM.yyyy" 
14 
15		displaydate = .vars['reserved-article-display-date'].data 
16	/> 
17 
18	<#if VideoPreview??> 
19		<#assign 
20			videoPreview = VideoPreview 
21		/> 
22	<#else> 
23		<#assign videoPreview = '' /> 
24	</#if> 
25 
26	<div class="portlet-boundary portlet-borderless portlet-journal-content"> 
27		<div class="portlet"> 
28			<div class="portlet-content"> 
29				<div class=" portlet-content-container"> 
30					<div class="portlet-body"> 
31						<div class="journal-content-article"> 
32							<div class="content-large"> 
33								<#if HeadingDetail??> 
34                                    ${HeadingDetail.getData()} 
35								<#else> 
36                                    <#if Heading.getType() != "text"> 
37                                        ${Heading.getData()} 
38                                    <#else> 
39										<h1>${Heading.getData()}</h1> 
40                                    </#if> 
41								</#if> 
42								<p>${formatDate(displaydate, defaultDateFormat)}</p> 
43								<p>${Summary.getData()}</p> 
44							</div> 
45						</div> 
46					</div> 
47				</div> 
48			</div> 
49		</div> 
50	</div> 
51 
52	<div class="portlet-boundary portlet-bordered portlet-journal-content"> 
53		<div class="portlet"> 
54			<div class="portlet-content panel"> 
55				<div class="portlet-content-container"> 
56					<div class="portlet-body"> 
57						<div class="journal-content-article"> 
58							<@initMediaValues/> 
59							<#assign mediaData = getMediaTypeData(Video VideoFileEntry Image) /> 
60							<#if mediaData['hasMedia']> 
61								<figure class="content-media-element media-element-left ${mediaData['mediaCssClass']}"> 
62									<@renderMedia Video VideoFileEntry Image mediaData videoPreview/> 
63 
64									<#if Caption.getData()?? && Caption.getData() != ""> 
65										<figcaption class="media-element-caption">${Caption.getData()}</figcaption> 
66									</#if> 
67								</figure> 
68							</#if> 
69							${Content.getData()} 
70						</div> 
71					</div> 
72				</div> 
73			</div> 
74		</div> 
75	</div> 
76 
77	<#if Document.getSiblings()?has_content && Document.getSiblings()?first.getData()?? && Document.getSiblings()?first.getData() != ""> 
78		<div class="portlet-boundary portlet-decorate portlet-small portlet-journal-content"> 
79			<div class="portlet"> 
80				<div class="portlet-content panel"> 
81					<div class="panel-heading portlet-title-container"> 
82						<h2 class="panel-title"><span class="portlet-title-text">${labelDownloads}</span></h2> 
83					</div> 
84					<div class="panel-body"> 
85						<div class=" portlet-content-container"> 
86							<div class="portlet-body"> 
87								<div class="journal-content-article"> 
88									<ul class="unstyled link-list"> 
89										<#list Document.getSiblings() as cur_Document> 
90											<#if cur_Document.getData()?? && cur_Document.getData() != ""> 
91												<li> 
92													<@getDocumentDownloadLink cur_Document/> 
93												</li> 
94											</#if> 
95										</#list> 
96									</ul> 
97								</div> 
98							</div> 
99						</div> 
100					</div> 
101				</div> 
102			</div> 
103		</div> 
104	</#if> 
105 
106	<#macro getDocumentDownloadLink cur_Document> 
107		<#assign 
108			linkText = '' 
109			linkTitle = '' 
110			linkSubText = '' 
111 
112			linkUrl = cur_Document.getData() 
113			linkParams = 'target="_blank"' 
114			linkClass= 'link-download' 
115		/> 
116 
117		<#assign file = getDLFileEntry(cur_Document)> 
118 
119		<#assign 
120			linkText = file.getTitle() 
121			linkTitle = languageUtil.format(locale, "download-x", linkText, false) 
122			linkSubText = ' <span class="file-info">(' + file.getExtension()?upper_case + ' - ' + formatFilesize(file.getSize())  + ')</span>' 
123		/> 
124 
125		<a class="link-icon ${linkClass}" href="${linkUrl}" title="${linkTitle}" ${linkParams}>${linkText} ${linkSubText}</a> 
126	</#macro> 
127 
128	<#function getDLFileEntryAltText Image> 
129		<#if Image.getAttribute("id")?? && Image.getAttribute("id") != ""> 
130			<#return ""> 
131		<#else> 
132			<#assign dlFileEntry = getDLFileEntry(Image) > 
133			<#return dlFileEntry.getDescription()/> 
134		</#if> 
135	</#function> 
136 
137	<#function getDLFileEntry fileEntry> 
138		<#assign dlFileEntry = ''> 
139		<#if fileEntry.getAttribute("fileEntryId")?? && fileEntry.getAttribute("fileEntryId") != ""> 
140			<#assign 
141			dlFileEntry = DLFileEntryService.getFileEntry(fileEntry.getAttribute("fileEntryId")?number) 
142			/> 
143		<#else> 
144			<#assign 
145			dlFileEntry = getDLFileEntryFromUrl(fileEntry.getData()) 
146			/> 
147		</#if> 
148		<#return dlFileEntry> 
149	</#function> 
150 
151	<#function getDLFileEntryFromUrl fileUrl> 
152		<#assign counter = 0 > 
153		<#list "${fileUrl}"?split("/") as pathSegemtent> 
154			<#if counter == 2> 
155				<#assign groupId = pathSegemtent?number > 
156			</#if> 
157			<#if counter == 5> 
158				<#assign subCounter = 0 > 
159				<#list "${pathSegemtent}"?split("?") as subSegemtent> 
160					<#if subCounter == 0> 
161						<#assign uuId = subSegemtent > 
162					</#if> 
163					<#assign subCounter = subCounter+1 > 
164				</#list> 
165			</#if> 
166			<#assign counter = counter+1 > 
167		</#list> 
168 
169		<#assign dlFileEntry = DLFileEntryService.getFileEntryByUuidAndGroupId(uuId,groupId) > 
170 
171		<#return dlFileEntry> 
172	</#function> 
173 
174	<#function formatFilesize fileSize> 
175		<#assign GB = 1000000000 /> 
176		<#assign MB = 1000000 /> 
177		<#assign KB = 1000 /> 
178 
179		<#if fileSize < MB > 
180			<#assign val = fileSize / 1000 /> 
181			<#return val?string("###,##0.#")+'KB' > 
182		<#elseif fileSize < GB > 
183			<#assign val = fileSize / 1000000 /> 
184			<#return val?string("###,##0.#")+'MB' > 
185		<#else> 
186			<#assign val = fileSize /> 
187			<#return val?string("###,##0.#")+'B' > 
188		</#if> 
189	</#function> 
190 
191	<#function formatDate dateString dateTimeFormat> 
192		<#-- Expects dateString to be RFC-822 date-time formatted--> 
193		<#assign dateStringPattern = "EEE, dd MMM yyyy HH:mm:ss Z"/> 
194 
195		<#assign dateItem = dateUtil.parseDate(dateStringPattern, dateString, localeUtil.getDefault())> 
196 
197		<#assign formatDateString = dateUtil.getDate(dateItem, dateTimeFormat, locale, timeZone)> 
198 
199		<#return formatDateString /> 
200	</#function> 
201 
202	<#macro initMediaValues> 
203	<#-- If either one of the needed Media Types is not present create the Variable with an empty string --> 
204	<#-- needed since some Articles might not have them --> 
205		<#if !Video??> 
206			<#assign Video = ''/> 
207		</#if> 
208		<#if !VideoFiles??> 
209			<#assign VideoFileEntry = ''/> 
210		<#else> 
211			<#assign 
212			VideoFileEntry = VideoFiles.VideoFileEntry 
213			/> 
214		</#if> 
215		<#if !Image??> 
216			<#assign Image = ''/> 
217		</#if> 
218	</#macro> 
219 
220	<#macro renderYoutubeVideo videoId> 
221		<iframe 
222				data-name="youtube" 
223				data-src="https://www.youtube-nocookie.com/embed/${videoId}?color=white&amp;controls=2&amp;hl=${locale.getLanguage()}&amp;iv_load_policy=3&amp;modestbranding=1&amp;rel=0&amp;showinfo=0" 
224				frameborder="0" 
225				allow="autoplay; encrypted-media" 
226				allowfullscreen 
227		></iframe> 
228	</#macro> 
229 
230	<#macro renderVideoPlayer videoFiles videoPreview videoPlayerId=randomNamespace> 
231		<#assign 
232		previewImage = '' 
233 
234		theme_path = themeDisplay.getPathThemeCss() 
235 
236		videojsCssPath = theme_path + '/theme/video-js/video-js.min.css' 
237		/> 
238 
239		<#if !videoPreview?is_string > 
240			<#if videoPreview.getData()?? && videoPreview.getData() != ''> 
241				<#assign 
242				previewImage = videoPreview.getData() 
243				/> 
244			</#if> 
245		</#if> 
246 
247		<video id="media_teaser_video_${videoPlayerId}" class="video-js vjs-fluid vjs-big-play-centered video-js-bks"> 
248			<#list videoFiles.getSiblings() as videoFile> 
249				<#if videoFile.getData()?? && videoFile.getData() != ''> 
250					<#assign 
251					videoFileEntry = getFileEntryFromUrl(videoFile.getData()) 
252					mimeType = videoFileEntry.getMimeType() 
253					/> 
254					<#if previewImage == ''> 
255						<#assign 
256						previewImage = DLUtil.getImagePreviewURL(videoFileEntry, videoFileEntry.getFileVersion(), themeDisplay) 
257						/> 
258					</#if> 
259					<source src="${videoFile.getData()}" type="${mimeType}"> 
260				</#if> 
261			</#list> 
262			<p class="vjs-no-js">Um dieses Video anzusehen, aktivieren Sie bitte JavaScript, und verwenden Sie einen Browser der <a href="http://videojs.com/html5-video-support/" target="_blank">Videos im HTML5 Standard unterstützt.</a></p> 
263		</video> 
264 
265		<script> 
266			Liferay.Loader.require([ 
267						"bks-main-theme-js-modules@2.0.0/video-js/video.min" 
268					], 
269					function(videojs) { 
270						var allCssElements=document.getElementsByTagName("link"); 
271						var cssAlreadyExists = false; 
272 
273						for (var i=allCssElements.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove 
274							if (allCssElements[i] && allCssElements[i].getAttribute("href")!=null && allCssElements[i].getAttribute("href").indexOf("${videojsCssPath}")!=-1){ 
275								cssAlreadyExists = true; 
276
277
278 
279						if (!cssAlreadyExists) { 
280							var newCssFile=document.createElement("link"); 
281							newCssFile.setAttribute("rel", "stylesheet"); 
282							newCssFile.setAttribute("type", "text/css"); 
283							newCssFile.setAttribute("href", "${videojsCssPath}"); 
284 
285							document.getElementsByTagName('head')[0].appendChild(newCssFile); 
286
287 
288						videojs('media_teaser_video_${videoPlayerId}', { 
289							controls: true, 
290							autoplay: false, 
291							preload: 'auto', 
292							aspectRatio: "16:9", 
293							fluid: 1, 
294							language: "${locale.getLanguage()}", 
295							poster: "${previewImage}" 
296						}); 
297 
298						Liferay.on('startNavigate', function() { 
299							videojs('media_teaser_video_${videoPlayerId}').dispose(); 
300						}); 
301					}, 
302					function(error) { 
303						console.error(error); 
304
305			); 
306		</script> 
307	</#macro> 
308 
309	<#-- Get FileEntry NOT DlFileEntry!!! --> 
310	<#function getFileEntryFromUrl fileUrl> 
311		<#assign counter = 0 > 
312		<#list "${fileUrl}"?split("/") as pathSegemtent> 
313			<#if counter == 2> 
314				<#assign groupId = pathSegemtent?number > 
315			</#if> 
316			<#if counter == 5> 
317				<#assign subCounter = 0 > 
318				<#list "${pathSegemtent}"?split("?") as subSegemtent> 
319					<#if subCounter == 0> 
320						<#assign uuId = subSegemtent > 
321					</#if> 
322					<#assign subCounter = subCounter+1 > 
323				</#list> 
324			</#if> 
325			<#assign counter = counter+1 > 
326		</#list> 
327 
328		<#assign fileEntry = DLAppService.getFileEntryByUuidAndGroupId(uuId,groupId) > 
329 
330		<#return fileEntry> 
331	</#function> 
332 
333	<#function getYoutubeIdFromUrl url> 
334		<#assign pathSegments = "${url}"?split("/") > 
335		<#return pathSegments?last> 
336	</#function> 
337 
338	<#function getMediaTypeData Video VideoFileEntries Image> 
339		<#assign 
340		mediaTypeData = { 
341		"hasMedia" : false, 
342		"mediaType" : "", 
343		"mediaCssClass" : "" 
344
345		/> 
346		<#if Video?? && Video?has_content && Video.getData()?contains("youtube") || Video.getData()?contains("youtu.be")> 
347			<#assign 
348			mediaTypeData = { 
349			"hasMedia" : true, 
350			"mediaType" : "youtube", 
351			"mediaCssClass" : "media-element-fixed-width" 
352
353			/> 
354		<#elseif VideoFileEntries?? && VideoFileEntries?has_content && VideoFileEntries.getSiblings()?has_content> 
355			<#list VideoFileEntries.getSiblings() as videoFileEntryItem> 
356				<#if videoFileEntryItem.getData()?? && videoFileEntryItem.getData() != ''> 
357					<#assign 
358					mediaTypeData = { 
359					"hasMedia" : true, 
360					"mediaType" : "videofile", 
361					"mediaCssClass" : "media-element-fixed-width" 
362
363					/> 
364				</#if> 
365			</#list> 
366		</#if> 
367		<#if !mediaTypeData['hasMedia'] && Image?? && Image?has_content && Image.getData()?? && Image.getData() != ""> 
368			<#assign 
369			mediaTypeData = { 
370			"hasMedia" : true, 
371			"mediaType" : "image", 
372			"mediaCssClass" : "" 
373
374			/> 
375		</#if> 
376		<#return mediaTypeData/> 
377	</#function> 
378 
379	<#macro renderMedia Video VideoFileEntries Image mediaTypeData VideoPreview mediaId=randomNamespace> 
380		<#switch mediaTypeData['mediaType']> 
381			<#case 'youtube'> 
382				<#assign youtubeId = getYoutubeIdFromUrl(Video.getData()) /> 
383				<div class="aspect-ratio aspect-ratio-16-to-9"> 
384					<@renderYoutubeVideo youtubeId/> 
385				</div> 
386				<#break> 
387			<#case 'videofile'> 
388				<@renderVideoPlayer VideoFileEntries VideoPreview mediaId/> 
389				<#break> 
390			<#case 'image'> 
391				<#assign 
392				altText = Image.getAttribute("alt") 
393				/> 
394				<#if !Image.getAttribute("alt")?? || Image.getAttribute("alt") == ""> 
395					<#assign 
396					altText = getDLFileEntryAltText(Image) 
397					/> 
398				</#if> 
399				<img data-fileentryid="${Image.getAttribute("fileEntryId")}" alt="${altText}" src="${Image.getData()}" /> 
400				<#break> 
401		</#switch> 
402	</#macro> 
403 
404</@>