Continguts amb l'etiqueta:

S'ha produït un error mentre es processava la plantilla.
Expression dynamicElement.attributeValue("name") is undefined on line 36, column 30 in 20155#20195#224308.
1<#-- 
2Application display templates can be used to modify the look of a 
3specific application. 
4 
5Please use the left panel to quickly add commonly used variables. 
6Autocomplete is also available and can be invoked by typing "${". 
7--> 
8 
9<section class="search-results"> 
10<#assign assetCategoryPropertyLocalService = serviceLocator.findService("com.liferay.portlet.asset.service.AssetCategoryPropertyLocalService")> 
11<#assign layoutLocalService = serviceLocator.findService("com.liferay.portal.service.LayoutLocalService")> 
12<#assign assetLinkLocalService = serviceLocator.findService("com.liferay.portlet.asset.service.AssetLinkLocalService")> 
13<#assign assetEntryLocalService  = serviceLocator.findService("com.liferay.portlet.asset.service.AssetEntryLocalService")> 
14 
15<#if entries?has_content> 
16	<#list entries as entry> 
17		<#assign autorComplete =""> 
18        <#assign autorShow=""> 
19        <#assign viewURL=""> 
20        <#assign friendlyUrl=""> 
21        <#assign otro=""> 
22        <#assign onclick=""> 
23	    <!-- assets --> 
24    	<#assign assetRenderer = entry.getAssetRenderer() > 
25    	<#assign viewURL = assetPublisherHelper.getAssetViewURL(renderRequest, renderResponse, entry)> 
26        <#assign viewURL = assetRenderer.getURLViewInContext(renderRequest, renderResponse, viewURL)> 
27        <#assign journalArticle = assetRenderer.getArticle() /> 
28        <#assign documentsax = saxReaderUtil.read(journalArticle.getContentByLocale(locale)) /> 
29        <#assign rootElement = documentsax.getRootElement() />    
30    
31        <#assign entryTitle = htmlUtil.escape(assetRenderer.getTitle(locale)) /> 
32        <#assign categories = entry.getCategories() /> 
33        <#assign col=paramUtil.getLong(request, "columns") /> 
34                      
35        <#list rootElement.elements() as dynamicElement> 
36            <#if "Titulo" == dynamicElement.attributeValue("name")> 
37        		<#assign entryTitle = dynamicElement.element("dynamic-content").getText() /> 
38            </#if> 
39            <#if "GENERALIMAGE" == dynamicElement.attributeValue("name")> 
40                <#assign imagen = dynamicElement.element("dynamic-content").getText() /> 
41            </#if> 
42            <#if "GENERALCONTENT" == dynamicElement.attributeValue("name")> 
43                <#assign content = dynamicElement.element("dynamic-content").getText() /> 
44            </#if> 
45            <#if "YEAR" == dynamicElement.attributeValue("name")> 
46                <#assign year = dynamicElement.element("dynamic-content").getText() /> 
47            </#if> 
48            <#if "MONTH" == dynamicElement.attributeValue("name")> 
49                <#assign month = dynamicElement.element("dynamic-content").getText() /> 
50            </#if> 
51            <#if "FRIENDLY_URL" == dynamicElement.attributeValue("name")> 
52                <#assign friendlyUrl = dynamicElement.element("dynamic-content").getText() /> 
53            </#if> 
54            <#if "OPEN_NEW_TAB" == dynamicElement.attributeValue("name")> 
55                <#assign openNewTab = dynamicElement.element("dynamic-content").getText() /> 
56            </#if> 
57            <#if "Otro_Enlace" == dynamicElement.attributeValue("name")> 
58                <#assign otro = dynamicElement.element("dynamic-content").getText() /> 
59                <#assign onclick = getSingleValue(otro,dynamicElement, "onclick") /> 
60            </#if>             
61            <#if "Autor" == dynamicElement.attributeValue("name")>             
62                <#assign autor = dynamicElement.element("dynamic-content").getText()/> 
63                <#assign autorComplete = autorComplete + getAutor(autor,dynamicElement)> 
64            </#if> 
65            <#if "DOCUMENT" == dynamicElement.attributeValue("name")> 
66                <#assign document = dynamicElement.element("dynamic-content").getText() /> 
67            </#if>             
68         </#list>		               
69                  
70		<#assign viewURL = getViewURL(viewURL, friendlyUrl, otro) > 
71                   
72        <!-- categories --> 
73        <#assign categoriesTipoContenido=getCategories(categories,propsUtil.get("vocabulary.tipo.contenido")) /> 
74        <#assign categoriesTematicaPrincipal=getCategories(categories,propsUtil.get("vocabulary.tematica.principal")) /> 
75        <#assign categoriesTematicaSecundaries=getCategories(categories,propsUtil.get("vocabulary.tematica.secundario")) /> 
76                 
77        <!-- asset links -->         
78        <#assign assetLinks = assetLinkLocalService.getDirectLinks(entry.getEntryId()) >         
79        <#assign dossierNumber = getAssetLinksDossierNumber(assetLinks)> 
80        <#assign dossierUrl = getAssetLinksDossierURL(assetLinks)>               
81             
82        <!-- autor show -->     
83        <#if categoriesTipoContenido?has_content> 
84			<#if autor?has_content> 
85				<#assign autorShow = autor> 
86			</#if> 
87		</#if> 
88		     
89		<div class="search-result row ng-scope"> 
90			<div class="col-sm-4 col-xs-12 main-article-image"> 
91			<#if onclick?has_content> 
92				<a href="${viewURL}" title="${entryTitle}" class="pushtag" onclick="${onclick}"> 
93			<#else> 
94				<a href="${viewURL}" title="${entryTitle}" class="pushtag"> 
95			</#if>	 
96				<#if imagen?has_content> 
97					<img src="${imagen}" alt="${entryTitle}"/> 
98				</#if>  
99				</a> 
100			</div> 
101			<div class="col-sm-8 col-xs-12 search-summary">  
102				<div class="wrapper"> 				 
103					<div class="index-and-title">	     		 
104						<#if categoriesTipoContenido?has_content> 
105							<#list categoriesTipoContenido as category >						 
106								<p class="category" style="position:relative;margin: 0;left: 0;"> ${category.getTitle(locale)}</p>						 
107							</#list>	 
108						</#if> 
109					</div>    
110					<h2 class="header"> 
111						<a href="${viewURL}" target="_self" class="ng-binding pushtag"> 
112							${entryTitle} 
113						</a> 
114					</h2>  
115					<#if month?has_content && year?has_content> 
116						<div class="month-year"> 
117							<p>${month}&nbsp;${year}</p> 
118						</div> 
119					</#if> 
120					<div class="tags-and-date"> 
121				   		<#if categories?has_content> 
122							<#list categories as category > 
123						    	<#assign vocabularyId = 45835/> 
124						        <#assign vocabularyId = propsUtil.get("vocabulary.tematica.principal") /> 
125						        <#if category.getVocabularyId() == vocabularyId?number> 
126						           	<#assign enllacCategory=""> 
127						            <#assign assetCategoryProperty = assetCategoryPropertyLocalService.getCategoryProperty(category.getCategoryId(), "layout")/> 
128									<#assign layoutCategoria = layoutLocalService.fetchLayoutByFriendlyURL(themeDisplay.getSiteGroupId(), false, "/"+assetCategoryProperty.getValue())>	 
129									<#assign enllacCategory = portalUtil.getLayoutFullURL(layoutCategoria, themeDisplay)>  
130						            <span class="tags"> 
131										<a href="${enllacCategory}" title="${category.getTitle(locale)}" >${category.getTitle(locale)}</a> 
132									</span> 
133						         </#if> 
134						   	</#list> 
135					   	</#if> 
136					   	<#if categoriesTematicaSecundaries?has_content> 
137					        <#list categoriesTematicaSecundaries as category> 
138					          	<#assign enllacCategory=""> 
139					            <#assign assetCategoryProperty = assetCategoryPropertyLocalService.getCategoryProperty(category.getCategoryId(), "layout")/> 
140								<#assign layoutCategoria = layoutLocalService.fetchLayoutByFriendlyURL(themeDisplay.getSiteGroupId(), false, "/"+assetCategoryProperty.getValue())>	 
141								<#assign enllacCategory = portalUtil.getLayoutFullURL(layoutCategoria, themeDisplay)> 
142						    	<span class="tags"> 
143									<a href="${enllacCategory}" title="${category.getTitle(locale)}" >${category.getTitle(locale)}</a> 
144								</span>  
145						    </#list> 
146					    </#if> 
147					    <#if month?has_content && year?has_content> 
148							<span class="posted-on">						 
149								<time datetime="${month} ${year}">${month} ${year}</time> 
150							</span> 
151						</#if>    
152					</div>		  
153				     <#if autorComplete?has_content> 
154				     	<div class="autor-destacat">  
155							<span class="autor"> 
156								${autorComplete?substring(0, (autorComplete?length)-1)} 
157							</span>   
158						</div> 
159				    </#if> 
160	    			<div class="summary"><p class="ng-binding">${content}</p></div>	 
161				</div> 
162			<#--<#include "/html/portlet/asset_publisher/asset_actions.jsp" />--> 
163						 
164				<#--	<#assign renderRequest = renderRequest.setAttribute("asset_metadata.jspf-filterByMetadata", true)> --> 
165					 
166					<#--<#include "/html/portlet/asset_publisher/asset_metadata.jspf" />--> 
167			</div>        
168		</div>   
169	</#list> 
170<#else> 
171	<div class="alert alert-info"> 
172		<@liferay.language key="there-are-no-results"/>	     
173	</div>   
174</#if>     
175</section> 
176 
177 
178 
179<#function getViewURL viewURL friendlyURL otherlink > 
180	<#assign viewURLFinal = viewURL> 
181	<#if friendlyURL?has_content> 
182		<#assign viewURLFinal = friendlyURL> 
183	<#else> 
184		<#if viewURL?has_content && (viewURL?split("\\?")?size>1) > 
185			viewURLFinal = viewURL?string?split("\\?")[0]> 
186		</#if> 
187	 
188		<#if (otherlink?has_content)> 
189			<#assign viewURLFinal = otherlink> 
190		</#if> 
191	</#if> 
192	<#return viewURLFinal> 
193</#function> 
194 
195 
196<#function getAutor autor dynamicElement> 
197   	<#assign autorComplete = ""> 
198    <#assign autor = dynamicElement.element("dynamic-content").getText()/> 
199    <#if autor?has_content> 
200    	<#assign autorList = dynamicElement.selectNodes("dynamic-element[@name='Descripcio_Autor']") /> 
201		<#if (autorList?has_content) > 
202			<#if (autorList?size>0) > 
203				<#list autorList as curr_autor> 
204					<#assign descripcio_autor = curr_autor.selectNodes("dynamic-content")[0].getData() /> 
205				    <#if descripcio_autor?has_content> 
206				    	<#assign autorComplete =autorComplete + autor + "," + descripcio_autor + ";"> 
207					<#else> 
208						<#assign autorComplete =autorComplete + autor +";"> 
209					</#if> 
210				</#list> 
211			</#if> 
212		</#if> 
213	</#if> 
214 <#return autorComplete> 
215</#function> 
216 
217<#function getAssetLinksDossierNumber assetLinks> 
218	<#assign dossierNumber=""> 
219	<#list assetLinks as assetLinkAux > 
220        	<#assign assetEnryIdLinked = assetLinkAux.getEntryId2()> 
221			<#assign assetEntryLinked = assetEntryLocalService.getEntry(assetEnryIdLinked)> 
222			<#assign categoriesLink = assetEntryLinked.getCategories()> 
223			<#assign isDossier = "false"> 
224			 
225			<#list  categoriesLink as categoryLink >				 
226				<#assign dosierCategoryId = PropsUtil.get("categoria.dossier.id")?number> 
227				<#if categoryLink.getCategoryId()==dosierCategoryId > 
228					<#assign isDossier = "true" > 
229				</#if>				 
230			</#list> 
231			<#if isDossier=="true" > 
232				<#assign dossierNumber =getArticleFieldValue(assetEntryLinked,"NUMBER",locale.toString()) >				 
233			 </#if> 
234        </#list> 
235	<#return dossierNumber> 
236</#function> 
237 
238 
239<#function getAssetLinksDossierURL assetLinks> 
240	<#assign dossierUrl=""> 
241	<#list assetLinks as assetLinkAux > 
242        	<#assign assetEnryIdLinked = assetLinkAux.getEntryId2()> 
243			<#assign assetEntryLinked = assetEntryLocalService.getEntry(assetEnryIdLinked)> 
244			<#assign categoriesLink = assetEntryLinked.getCategories()> 
245			<#assign isDossier = "false"> 
246			 
247			<#list  categoriesLink as categoryLink >				 
248				<#assign dosierCategoryId = PropsUtil.get("categoria.dossier.id")?number> 
249				<#if categoryLink.getCategoryId()==dosierCategoryId > 
250					<#assign isDossier = "true" > 
251				</#if>				 
252			</#list> 
253			<#if isDossier=="true" >				 
254				<#assign dossierUrl = AssetPublisherHelperImpl.getAssetViewURL(liferayPortletRequest, liferayPortletResponse, assetEntryLinked, viewInContext) >			 </#if> 
255        </#list> 
256	<#return dossierUrl> 
257</#function> 
258 
259<#function getCategories categories vocabularyId> 
260	<#assign res = []> 
261	<#list categories as category >        
262        <#if category.getVocabularyId() == vocabularyId?number> 
263             <#assign res = res + [category]>                    
264        </#if> 
265     </#list> 
266     <#return res> 
267</#function> 
268 
269<#function printDivSizeCol numElements> 
270	 <#if numElements?number%2 == 0> 
271		<#return "<div class='col-md-6 col-sm-6 col-xs-12'>">	 
272	<#else> 
273		<#return  "<div class='col-md-4 col-sm-4 col-xs-12'>"> 
274	</#if>  
275</#function> 
276 
277<#function printDivSizeCol2 numElements>	  
278	<#if numElements?has_content> 
279		<#if numElements?number == 1 || numElements?number == 0>   
280			<#return "<div class='col-md-7 col-sm-7 col-xs-12'>"> 
281		<#elseif numElements?number%6 == 0> 
282			<#return "<div class='col-md-4 col-sm-4 col-xs-12'>"> 
283		<#elseif numElements?number%2 == 0> 
284			<#return "<div class='col-md-6 col-sm-6 col-xs-12'>">	 
285		<#else> 
286			<#return "<div class='col-md-4 col-sm-4 col-xs-12'>"> 
287		</#if> 
288	<#else> 
289		<#return "<div class='col-md-7 col-sm-7 col-xs-12'>"> 
290	</#if> 
291</#function> 
292 
293<#function getStringValue2levels otro dynamicElement field1 field2 > 
294	<#assign res=""> 
295	<#if otro?has_content>	     
296	    <#assign res=dynamicElement.selectSingleNode("/root/dynamic-element[@name='" 
297	     + field1+ "']/dynamic-element[@name='"+field2+"']/dynamic-content")[0].getText() /> 
298	      
299	</#if>  
300	<#return res> 
301</#function> 
302 
303<#function getSingleValue element dynamicElement fieldname> 
304	<#assign res=""> 
305	<#if element?has_content> 
306	    <#assign elementList = dynamicElement.selectNodes("dynamic-element[@name='"+fieldname+"']") /> 
307		<#if (elementList?has_content) > 
308			<#if (elementList?size>0) > 
309				<#list elementList as curr_element> 
310					<#assign cur_value = curr_element.selectNodes("dynamic-content")[0].getData() /> 
311				    <#if cur_value?has_content> 
312				    	<#assign res =res + cur_value>			 
313					</#if> 
314				</#list> 
315			</#if> 
316		</#if> 
317	</#if>  
318	<#return res> 
319</#function> 
320 
321 
322<#function getNumberValue3levels dynamicElement field1 field2 field3> 
323	<#assign res=0> 
324	<#if dynamicElement?has_content>	     
325	    <#assign res=dynamicElement.selectSingleNode("/root/dynamic-element[@name='" 
326	     + field1+ "']/dynamic-element[@name='"+field2+"']/dynamic-element[@name='"+field3+"']/dynamic-content").getText() />			 
327	</#if>  
328	<#return res?number> 
329</#function> 
330 
331<#function getButtonStyles document> 
332	<#assign classFile="fa-file-o"> 
333	<#if document?contains(".pdf")> 
334		<#assign classFile="fa-file-pdf-o"/>					     
335	<#elseif document?contains(".xls") || document?contains(".xlsx")> 
336		<#assign classFile="fa-file-excel-o"/>					     
337	<#elseif document?contains(".doc") || document?contains(".docx")> 
338		<#assign classFile="fa-file-word-o"/>					  
339	</#if>	 
340	<#return classFile> 
341</#function>