Navigation Menu

Asset Publisher

An error occurred while processing the template.
?substring(...) argument #1 had invalid value: The index must be at least 0, but was -1.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign journalArticleId = themeDispl...  [in template "20099#20125#42411" at line 4, column 1]
----
1<#assign url = themeDisplay.getURLCurrent() 
2index = 0/> 
3 
4<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(themeDisplay.getURLCurrent()?index_of("id="))+3/> 
5 
6 
7<#assign indexInizio = themeDisplay.getURLCurrent()?index_of("id=")+3> 
8<#assign indexFine= themeDisplay.getURLCurrent()?index_of("&from=")> 
9  
10<#assign journalArticleId = themeDisplay.getURLCurrent()?substring(indexInizio, indexFine)/> 
11 
12<!--NEWS --> 
13<#if journalArticleId?has_content> 
14 
15<#if entries?has_content> 
16	<#list entries as curEntry> 
17	  <#if curEntry.getEntryId() == journalArticleId?number> 
18 
19<#assign 
20		assetRenderer = curEntry.getAssetRenderer() 
21		entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) 
22		docXml = saxReaderUtil.read(assetRenderer.getArticle().getContent()) 
23		dataCreazione = curEntry.getCreateDate()  
24		/> 
25<!--		 
26<#assign 
27titolo = (docXml.valueOf("//dynamic-element[@name='Testo75401736']/dynamic-content/text()")) 
28descrizione = (docXml.valueOf("//dynamic-element[@name='Rtf99292418']/dynamic-content/text()")) 
29dataPubblicazione = docXml.valueOf("//dynamic-element[@name='dattero71153105']/dynamic-content/text()") 
30dataAggiornamento = docXml.valueOf("//dynamic-element[@name='dattero48916691']/dynamic-content/text()") 
31 
32image = docXml.valueOf("//dynamic-element[@name='immagine94658621']/dynamic-content/text()") 
33imageObj = jsonFactoryUtil.createJSONObject(image) 
34/>--> 
35	<#assign fields = assetRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues()/> 
36								<#list fields as currentField> 
37												<#if currentField.getDDMFormField().getFieldReference()=='titolo'> 
38													<#assign titolo=currentField.getValue().getString(themeDisplay.getLocale()) /> 
39												</#if> 
40												<#if currentField.getDDMFormField().getFieldReference()=='areaDiTesto'> 
41													<#assign descrizione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
42												</#if> 
43												<#if currentField.getDDMFormField().getFieldReference()=='dataPubblicazione'> 
44													<#assign dataPubblicazione=currentField.getValue().getString(themeDisplay.getLocale()) /> 
45												</#if> 
46												<#if currentField.getDDMFormField().getFieldReference()=='immagine'> 
47													<#assign image=currentField.getValue().getString(themeDisplay.getLocale()) /> 
48													<#assign imageObj = jsonFactoryUtil.createJSONObject(image) /> 
49												</#if> 
50												<#if currentField.getDDMFormField().getFieldReference()=='dataAggiornamento'> 
51													<#assign dataAggiornamento=currentField.getValue().getString(themeDisplay.getLocale()) /> 
52												</#if> 
53									  
54								</#list> 
55<#assign contacts = docXml.getRootElement()/> 
56<#assign categories =curEntry.getCategories()/> 
57 
58       <main class="container ct-main"> 
59            <span class="subtitle"><img src="/o/CSIRTTema/images/svg/calendar.svg" alt="calendario"> ${dataPubblicazione?datetime("yyyy-MM-dd")?string("dd MMMM yyyy")}</span> 
60            <h1 class="title">${titolo}</h1> 
61            <div id="ctNormativa"> 
62                <div class="cropped img-wrapper"> 
63                    <img src="/documents/${imageObj.getString('groupId')}/${imageObj.getString('uuid')}" alt="">   
64                </div> 
65 
66                <div class="date-wrapper"> 
67                    <span class="subtitle"><img src="/o/CSIRTTema/images/svg/calendar.svg" alt="calendario"> data di aggiornamento:</span> 
68                    <span class="subtitle subtitle--date"> ${dataAggiornamento?datetime("yyyy-MM-dd")?string("dd MMMM yyyy")}</span> 
69                </div> 
70 
71                <div class="text-wrapper"> 
72                    <p>${descrizione}</p> 
73 
74                      <div class="tags-wrap"> 
75					    <#list categories as category>     
76                           <div class="tag">${category.name}</div> 
77						</#list> 
78                    </div> 
79							 
80<!-- 
81<#attempt> 
82  <#list contacts.elements("dynamic-element") as subfield> 
83	<#if subfield.attributeValue("name") == "caricare74699384" > 
84	    <#assign imgOb = jsonFactoryUtil.createJSONObject(subfield.element("dynamic-content").getText())/> 
85			<#if imgOb != "{}"> 
86		<div class="link-wrapper"> 
87		<a href="${imgOb.getString('url')}" title="${imgOb.getString('title')}" target="blank" aria-label="${languageUtil.get(locale, "label.vaiallink")}"  
88		class="link">${imgOb.getString('title')} 
89                            <img src="/o/CSIRTTema/images/svg/icon-link.svg" alt="link"> 
90        </a>		 
91        </div>		 
92    </#if> 
93		</#if> 
94  </#list>        
95<#recover> 
96</#attempt> 
97--> 
98<#attempt> 
99											<#assign fieldsAllegati = assetRenderer.getDDMFormValuesReader().getDDMFormValues().getDDMFormFieldValues()/> 
100											<#list fieldsAllegati as currentFieldAllegati> 
101													<#if currentFieldAllegati.getDDMFormField().getFieldReference()=='allegati'> 
102														<#assign imgObjAllegati = jsonFactoryUtil.createJSONObject(currentFieldAllegati.getValue().getString(themeDisplay.getLocale()))/> 
103														 <#if imgObjAllegati != "{}"> 
104																<div class="link-wrapper"> 
105																	 <a href="/documents/${imgObjAllegati.getString('groupId')}/${imgObjAllegati.getString('uuid')}"  
106																	 title="${imgObjAllegati.getString('title')}"  
107																			 target="blank" aria-label="${languageUtil.get(locale, "label.vaiallink")}"  
108																			 class="link">${imgObjAllegati.getString('title')} 
109																				<img src="/o/CSIRTTema/images/svg/icon-link.svg" alt="link"> 
110																		</a> 
111															</div> 
112														</#if> 
113												</#if> 
114											</#list> 
115										 <#recover> 
116									</#attempt> 
117                </div> 
118            </div> 
119        </main> 
120 
121				<#break> 
122</#if> 
123	</#list> 
124</#if> 
125</#if>