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