Kategorie

Jahr

Fehler bei der Verarbeitung der Vorlage.
?substring(...) argument #2 had invalid value: The index must be at least 0, but was -1.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #local lResult = lResult?substring(0,...  [in template "10155#10193#6634869" in function "getShortTitle" at line 147, column 9]
	- Reached through: #assign lShortTitle = getShortTitle(l...  [in template "10155#10193#6634869" in macro "archiveDisplay" at line 93, column 9]
	- Reached through: @archiveDisplay  [in template "10155#10193#6634869" at line 25, column 57]
----
1<#setting url_escaping_charset='ISO-8859-1'> 
2<#assign liferay_ui = taglibLiferayHash["/META-INF/liferay-ui.tld"] /> 
3<#assign redirectURL = renderResponse.createRenderURL() /> 
4<#assign backLink = currentURL?url/> 
5<#assign lBiImage = "/documents/804663/804682/bi-img/b3ae601e-5ecc-422a-9527-2a556bbd36da?t=1427875520771" /> 
6<#assign lBiType = "BI" /> 
7<#assign lBiStructureId = 769975/> 
8<#global assetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryService")> 
9<#global assetVocabularyService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetVocabularyService")>  		 
10<#global lClassNameLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.ClassNameLocalService")>  	 
11<#global lDDMStructureLocalService = serviceLocator.findService("com.liferay.dynamic.data.mapping.service.DDMStructureLocalService")> 		 
12<#assign lClassId = lClassNameLocalService.getClassNameId("com.liferay.journal.model.JournalArticle") /> 
13<#global DLFileEntryLocalService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService") /> 
14<#if entries?has_content> 
15	<section class="section-communications"> 
16		<#list entries as entry> 
17			<article class="communication-item grid__row"> 
18				<#assign lChapo = "" /> 
19				<#assign entry = entry /> 
20				<#assign className = lClassNameLocalService.getClassName(entry.getClassNameId()).getValue() > 
21				<#if className == "com.liferay.journal.model.JournalArticle" > 
22					<#if entry.getAssetRenderer()??> 
23						<#assign renderer = entry.getAssetRenderer() > 
24						<#if renderer.getArticle()??> 
25							<@archiveDisplay/> 
26						</#if>	 
27					</#if> 
28				</#if> 
29				<#if renderer.hasEditPermission(themeDisplay.getPermissionChecker())> 
30					<div class="lfr-meta-actions" style="float: right;"><@getEditIcon /></div> 
31				</#if> 
32			</article> 
33			 
34		</#list> 
35	</section> 
36</#if> 
37 
38<#macro archiveDisplay> 
39	<#assign journalArticle = renderer.getArticle() > 
40	<#assign viewURL = "/web/communication/detail?groupId=${entry.getGroupId()}&articleId=${journalArticle.getArticleId()}&redirect=${backLink}" /> 
41	<#assign lStructureId = journalArticle.getStructureId() /> 
42	<#assign lStructure = lDDMStructureLocalService.getStructure(themeDisplay.getCompanyGroupId(),lClassId,lStructureId?string) /> 
43	<#assign lStructureName = lStructure.getName()?trim /> 
44	<#assign rootElement = getContentXml(entry) /> 
45	<#if lStructure.getStructureId() == lBiStructureId> 
46		<#assign image = lBiImage /> 
47	<#else> 
48		<#assign image = "" > 
49		<p></p> 
50		<#assign image = getStructureValue2("Image",rootElement) /> 
51		<#if image??> 
52			<#if image == "" > 
53				<#assign image = "noImage" > 
54 
55			</#if> 
56		<#else> 
57			<#assign image = "noImage" > 
58		</#if> 
59	</#if> 
60 
61	<#assign lChapoNode =  getNodes("Lead", rootElement) /> 
62 
63	<#if lChapoNode?size!=0> 
64		<#assign lChapo = getStructureValue(lChapoNode[0], "fr_FR")/> 
65	</#if> 
66	<#if image != "noImage"> 
67		 
68		<#local curImage = jsonFactoryUtil.createJSONObject(image) /> 
69		 
70		<#local imgFileEntry = DLFileEntryLocalService.getFileEntryByUuidAndGroupId(curImage.uuid, getterUtil.getLong(curImage.groupId)) /> 
71	 
72		<#local comImg = "/documents/"+ curImage.groupId +"/" +imgFileEntry.getFolderId() +"/"+ curImage.title+"/"+curImage.uuid /> 
73		 
74		<div class="grid__col-xxs--12 grid__col-m--5"> 
75			<figure class="communication-img"> 
76				<a class="loading" href="${viewURL}"> 
77					<img src="${comImg}?imagePreview=1" alt="" class="js-lazy is-loaded"> 
78					<span>Lire la suite</span> 
79					<i class="icon icon_arrow-right"> 
80						<svg viewBox="0 0 37.1 12" class="svg_arrow-right"> 
81							<use xlink:href="/documents/10181/2591868/sprite.svg#svg-arrow-right"></use> 
82							<use xlink:href="#svg-arrow-right"></use> 
83						</svg> 
84					</i> 
85				</a> 
86			</figure>	 
87		</div> 
88		  
89		 
90	</#if>	 
91	 
92	<#assign lTitle = entry.getTitle(locale) /> 
93	<#assign lShortTitle = getShortTitle(lTitle) /> 
94	<#assign eSummary = entry.getSummary(locale, true) /> 
95	<#assign eSummary = stringUtil.shorten(eSummary, 230) /> 
96	 
97	<#if image != "noImage"> 
98		<div class="grid__col-xxs--12 grid__col-m--7"> 
99	<#else> 
100		<div class="grid__col-xxs--12"> 
101			<div class="grid__col-m--12 col-xs-no-gutter col-n-gutter"> 
102	</#if> 
103		<div class="communication-info"> 
104			<@entryLinkCreator linkText="" entry=entry type="title" /> 
105		</div> 
106 
107		<h3 class="communication-title"><a href="${viewURL}">${lShortTitle}</a></h3> 
108		<p class="communication-desc">${eSummary}</p> 
109		<p class="communication-cat"><@getPouvoir entry=entry /></p> 
110		 
111		 
112		 
113	<#if image != "noImage"> 
114		</div> 
115	<#else> 
116			</div> 
117			 
118		</div> 
119	</#if> 
120	 
121		 
122	<a class="communication-link" href="${viewURL}" ></a> 
123 
124		 
125		 
126		<#-- 
127		<#if lChapo??> 
128			<#if lChapo!=""> 
129				${lChapo} 
130			</#if> 
131		</#if> 
132		 
133		<#if eSummary?has_content> 
134			<#if eSummary!=lTitle> 
135				<br/> 
136			</#if> 
137		</#if> 
138		--> 
139		 
140</#macro>  
141 
142<#function getShortTitle pTitle=''> 
143    <#local lResult = pTitle?trim /> 
144    <#-- Test if last 22 chars is a timestamp --> 
145    <#local lMatch = lResult?matches("^.*([01][0-9]|2[0-3]):[0-5]\\d:[0-5]\\d$") /> 
146    <#if lMatch> 
147        <#local lResult = lResult?substring(0,lResult?length-22) /> 
148    </#if> 
149    <#return lResult /> 
150</#function> 
151 
152<#macro getCategoryDate entry> 
153    <#assign lTypologie = "" /> 
154    <#assign lPouvoir = "" /> 
155    <#assign dateFormat = "dd.MM.yyyy" /> 
156	<#assign categories = entry.getCategories()> 
157	 
158	<#list categories as category> 
159 
160		<#assign vocabulary = assetVocabularyService.getVocabulary(category.vocabularyId) /> 
161		<#if vocabulary.name = "020 Typologies"> 
162			<#assign lCategory = category.getDescription(locale)?trim /> 
163			<#if lCategory=="" > 
164				<#assign lCategory = category.getDescription(locale)?trim /> 
165			</#if> 
166			<#assign lTypologie = lTypologie+" | "+lCategory /> 
167		</#if> 
168		<#if vocabulary.name = "010 Pouvoirs"> 
169			<#assign lCategory = category.getDescription(themeDisplay.getLocale())?trim /> 
170			<#if lCategory=="" > 
171				<#assign lCategory = category.getDescription(locale)?trim /> 
172			</#if> 
173			<#assign lPouvoir = lPouvoir+" | "+lCategory /> 
174		</#if> 
175	</#list> 
176	${dateUtil.getDate(entry.getPublishDate(), dateFormat, locale)} 
177 
178	<#if lTypologie??> 
179		${lTypologie} 
180	</#if> 
181 
182</#macro> 
183 
184<#macro getPouvoir entry> 
185     
186    <#assign lPouvoir = "" /> 
187   
188	<#assign categories = entry.getCategories()> 
189	 
190	<#list categories as category> 
191 
192		<#assign vocabulary = assetVocabularyService.getVocabulary(category.vocabularyId) /> 
193		<#if vocabulary.name = "010 Pouvoirs"> 
194			<#assign lCategory = category.getDescription(themeDisplay.getLocale())?trim /> 
195			<#if lCategory=="" > 
196				<#assign lCategory = category.getTitle(themeDisplay.getLocale())?trim /> 
197			</#if> 
198			<#assign lPouvoir = lCategory /> 
199		</#if> 
200	</#list> 
201	 
202	<#if lPouvoir??> 
203		${lPouvoir} 
204	</#if> 
205</#macro> 
206  
207<#macro entryLinkCreator entry linkText type> 
208	<#assign entryRenderURL = renderResponse.createRenderURL() /> 
209	${entryRenderURL.setParameter("struts_action", "/asset_publisher/view_content")} 
210	${entryRenderURL.setParameter("assetEntryId", entry.getEntryId()?string)} 
211	${entryRenderURL.setParameter("redirect", renderResponse.encodeURL("${currentURL}"))} 
212	${entryRenderURL.setParameter("portlet_id", "test")} 
213	${entryRenderURL.setWindowState("maximized")} 
214	${entryRenderURL.setParameter("type", entry.getAssetRendererFactory().getType())} 
215	<#if type == "title"> 
216		    <@getCategoryDate entry/> 
217	<#else> 
218		    ${linkText} 
219	</#if> 
220</#macro> 
221 
222 
223<#function getNodes pElementName pXmlContent> 
224    <#assign lElementXPath = "dynamic-element[@name='"+pElementName+"']"/> 
225    <#assign lXPathSelector = saxReaderUtil.createXPath(lElementXPath) /> 
226    <#assign lResult = lXPathSelector.selectNodes(pXmlContent) /> 
227    <#return  lResult/> 
228</#function> 
229 
230<#function getStructureValue pNode pDefaultLanguage> 
231    <#assign lResult = "" /> 
232    <#assign lCurElementXPath = "dynamic-content[@language-id='" + locale + "']" /> 
233    <#assign lXPathSelector = saxReaderUtil.createXPath(lCurElementXPath) /> 
234    <#if lXPathSelector.selectSingleNode(pNode)??> 
235        <#assign lValue = lXPathSelector.selectSingleNode(pNode) /> 
236        <#assign lResult = lValue.getStringValue() />  
237    <#else> 
238        <#assign lCurElementXPath = "dynamic-content[@language-id='fr_FR']" /> 
239        <#assign lXPathSelector = saxReaderUtil.createXPath(lCurElementXPath) /> 
240        <#if lXPathSelector.selectSingleNode(pNode)?? > 
241            <#assign lValue = lXPathSelector.selectSingleNode(pNode) /> 
242            <#assign lResult = lValue.getStringValue() /> 
243        <#else> 
244            <#assign lCurElementXPath = "dynamic-content[@language-id='" + pDefaultLanguage + "']" /> 
245            <#assign lXPathSelector = saxReaderUtil.createXPath(lCurElementXPath) /> 
246            <#assign lValue = lXPathSelector.selectSingleNode(pNode) /> 
247            <#assign lResult = lValue.getStringValue() /> 
248        </#if> 
249    </#if> 
250    <#return lResult?string />                    
251</#function> 
252 
253<#function getContentXml entry> 
254    <#assign renderer = entry.getAssetRenderer() /> 
255    <#assign className = renderer.getClassName() /> 
256    <#if className == "com.liferay.journal.model.JournalArticle"> 
257        <#assign journalArticle = renderer.getArticle() /> 
258        <#assign document = saxReaderUtil.read(journalArticle.getContent())/>  
259        <#assign rootElement = document.getRootElement() /> 
260        <#return rootElement/> 
261    </#if> 
262    <#return "noJournalArticle"/> 
263</#function> 
264 
265<#function getStructureValue2 elementName xmlContent> 
266    <#assign availableLanguagesXPathSelector = saxReaderUtil.createXPath("/*/@available-locales") /> 
267     <#assign available = "" /> 
268    <#if availableLanguagesXPathSelector.selectSingleNode(xmlContent)?? > 
269        <#assign available = availableLanguagesXPathSelector.selectSingleNode(xmlContent) /> 
270    </#if> 
271    <#if available?contains(locale.toString())> 
272        <#assign curElementXPath = "dynamic-element[@name='"+elementName+"']/dynamic-content[@language-id='" + locale + "']" />  
273    <#elseif available?contains("fr_FR")> 
274        <#assign curElementXPath = "dynamic-element[@name='"+elementName+"']/dynamic-content[@language-id='fr_FR']" /> 
275    <#else> 
276        <#assign curElementXPath = "dynamic-element[@name='"+elementName+"']/dynamic-content[@language-id='" + entry.getDefaultLanguageId() + "']" /> 
277    </#if> 
278    <#assign xPathSelector = saxReaderUtil.createXPath(curElementXPath) /> 
279    <#if xPathSelector.selectSingleNode(xmlContent)?? > 
280        <#assign structureValue = xPathSelector.selectSingleNode(xmlContent).getStringValue() /> 
281    <#else> 
282        <#assign structureValue = "" /> 
283    </#if> 
284    <#return structureValue/>                    
285</#function> 
286 
287<#macro getEditIcon> 
288	<#local redirectURL = renderResponse.createRenderURL() /> 
289 
290	${redirectURL.setParameter("struts_action", "/asset_publisher/add_asset_redirect")} 
291	${redirectURL.setWindowState("pop_up")} 
292 
293	<#local editPortletURL = renderer.getURLEdit(renderRequest, renderResponse, windowStateFactory.getWindowState("pop_up"), redirectURL) /> 
294 
295	<#if validator.isNotNull(editPortletURL)> 
296		<#local title = languageUtil.get(locale, "edit") /> 
297 
298		<@liferay_ui["icon"] 
299			iconCssClass="icon-pencil" 
300			message=title 
301			url="javascript:Liferay.Util.openWindow({dialog: {width: 960}, id:'" + renderResponse.getNamespace() + "editAsset', title: '" + title + "', uri:'" + htmlUtil.escapeURL(editPortletURL.toString()) + "'});" 
302		/> 
303	</#if> 
304</#macro>