Navegación por categorías

Navegación por categorías

Se ha producido un error al procesar la plantilla.
The following has evaluated to null or missing:
==> maxLoop  [in template "49203#49237#1325998" at line 28, column 35]

----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #list 1..maxLoop as i  [in template "49203#49237#1325998" at line 28, column 25]
----
1<#assign assetCategoriesCustomService = serviceLocator.findService("pa.mtl.assetcategories.customservice.api.AssetCategoriesCustomServiceApi") 
2		 assetCategoryService = serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryLocalService") 
3		 assetCategoryPropertyService =  serviceLocator.findService("com.liferay.asset.kernel.service.AssetCategoryPropertyLocalService") 
4		 SAXReaderUtil = staticUtil["com.liferay.portal.kernel.xml.SAXReaderUtil"] 
5		 HtmlUtil = staticUtil["com.liferay.portal.kernel.util.HtmlUtil"] 
6		 layoutLocalService = serviceLocator.findService("com.liferay.portal.kernel.service.LayoutLocalService") 
7		 PortletURLFactoryUtil = staticUtil["com.liferay.portal.kernel.portlet.PortletURLFactoryUtil"] 
8		 PortletRequest = staticUtil["javax.portlet.PortletRequest"]     
9		 journalArticleService = serviceLocator.findService("com.liferay.journal.service.JournalArticleLocalService") 
10		 ParamUtil = staticUtil["com.liferay.portal.kernel.util.ParamUtil"]   
11		 categoryId =ParamUtil.getLong(renderRequest,"categoryId", 0) 
12		 categoryName = ParamUtil.getString(request,"categoryName", "") 
13/> 
14 
15 
16<#-- inicialización de categoría: si no hay seleccionada se coge la primera de la jerarquía --> 
17<#if (categoryId <= 0) > 
18 
19    <#if categoryName?has_content> 
20    	<#assign currentCategory = assetCategoriesCustomService.findCategoryByName(categoryName, groupId) 
21    			 categoryId = currentCategory.getCategoryId()/> 
22    <#else> 
23     
24	    <#if entries?has_content> 
25	        <#foreach vocabulary in entries> 
26	         
27	            <#foreach aCategory in vocabulary.getCategories()> 
28	                <#list 1..maxLoop as i> 
29	                    <#if aCategory.getParentCategory()?has_content> 
30	                        <#assign aCategory = aCategory.getParentCategory()/> 
31	                    <#else> 
32	                        <#assign categoryId = aCategory.getCategoryId()/> 
33	                        <#break>  
34	                   </#if>   
35	                </#list> 
36	            </#foreach> 
37	             
38	        </#foreach> 
39	    </#if> 
40	</#if>     
41</#if> 
42 
43<#if ! currentCategory ? has_content > 
44	 <#assign currentCategory = assetCategoryService.getAssetCategory(categoryId)/> 
45</#if> 
46 
47<#assign childCategories = assetCategoriesCustomService.getChildCategoriesOrdered(categoryId,locale) 
48         showContents = true 
49         forceShowCategories = false 
50/> 
51 
52<!-- Pintar subcategorías --> 
53<#if childCategories?has_content>	 
54	<div class="card flex-md-row mb-4 box-shadow h-md-250"> 
55      	<div class="card-body d-flex flex-column align-items-start">                      
56          	<h2 class="mb-0">${currentCategory.getTitle(locale)}</h2>   
57          	<div class="outer">  
58              	<div class="row">   
59              		<#list childCategories as childCategory>	 
60	              		<#if assetCategoryPropertyService.getCategoryProperty(childCategory.getCategoryId(),"idContenido") ? has_content > 
61	                        <#assign contentIdProperty = assetCategoryPropertyService.getCategoryProperty(childCategory.getCategoryId(),"idContenido")/> 
62	                        <#assign contentId = contentIdProperty.getValue()/> 
63	                        <#if contentId ? has_content> 
64	                            <#assign journalArticleSub = journalArticleService.getLatestArticle(groupId,contentId)/> 
65	                             
66	                            <#assign document = SAXReaderUtil.read(journalArticleSub.getContentByLocale(locale)) 
67									paginaDetalleNode =  document.selectSingleNode("/root/dynamic-element[@name='paginaDetalle']/dynamic-content") 
68								/> 
69			 
70								<#if paginaDetalleNode?has_content && paginaDetalleNode.getText()?has_content> 
71									<#assign  pageDetail = paginaDetalleNode.getText()/> 
72									<#if (pageDetail?index_of("@")>0)> 
73										<#assign pageDetailPosition = (pageDetail?index_of("@")-1) 
74			 								pageDetail = pageDetail[0..pageDetailPosition] 
75			 								layoutDetail = layoutLocalService.getLayout(themeDisplay.getScopeGroupId(),false,pageDetail?number)					                          					  
76										/> 
77									</#if> 
78								<#else> 
79                                    <#assign detailPage = "general" 
80                                             layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) /> 
81								</#if> 
82									 
83								<#assign categoryUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE)/> 
84									${categoryUrl.setParameter("categoryId", childCategory.getCategoryId()+"")}											 
85	                            <#if journalArticleSub?has_content> 
86	                                <#-- obtener el contenido de la categoría actual --> 
87	                                <#assign childCategoryContent = journalArticleService.getArticleContent(journalArticleSub, "","VIEW", locale, themeDisplay)/> 
88	                                <#if journalArticleSub.getStatus() == 0> 
89	                                <div class="col-md-6 ${childCategory?item_parity}"> 
90	                               		${childCategoryContent}   
91	                               		 
92	                               		<div class="link-more"> 
93	                               			<a class="more-information" title="${languageUtil.get(locale,'juventud.general.more-info-about')} ${childCategory.getTitle(locale)}" 
94	                               				href="${categoryUrl}" >${languageUtil.get(locale,'juventud.general.more-info')}</a> 
95	                               		</div>	                               				                               				 
96	                               	</div> 
97	                               	</#if> 
98	                            </#if> 
99	                        </#if> 
100	                    </#if> 
101	               </#list>    
102	                
103	               <!-- Después de pintar las subcategorías, pintamos los contenidos relacionados con la categoría actual --> 
104	               <#assign journalArticles = assetCategoriesCustomService.findJournalArticlesByCategoryId(currentCategory.getCategoryId(), groupId, 0, null, "title", "asc", null, null)/>             	          
105		           <#list journalArticles as journalArticle> 
106		            	<#assign document = SAXReaderUtil.read(journalArticle.getContentByLocale(locale)) 
107			                     titleNode = document.selectSingleNode("/root/dynamic-element[@name='titulo']/dynamic-content") 
108			                     title = titleNode.getText() 
109			                     resumen = ""			                      
110			                     imagenNode = document.selectSingleNode("/root/dynamic-element[@name='imagen']/dynamic-content") 
111			                     currentUrl = renderResponse.createRenderURL() 
112			                     detailPage = "detalle" 
113	                         	 layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) 
114	                 			 detailUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE) 
115             			/> 
116			            <#if document.selectSingleNode("/root/dynamic-element[@name='resumen']/dynamic-content") ? has_content> 
117							<#assign resumenNode = document.selectSingleNode("/root/dynamic-element[@name='resumen']/dynamic-content")	 
118									 resumen = HtmlUtil.stripHtml(resumenNode.getText()) 
119							/> 
120				      	</#if> 
121				      	     
122						${currentUrl.setParameter("categoryId",categoryId+"")} 
123						${detailUrl.setParameter("categoryId",currentCategory.getCategoryId()+"")} 
124						${detailUrl.setParameter("articleId", journalArticle.getArticleId())} 
125						<#if journalArticle.getStatus() == 0>	                      
126              			<div class="col-md-6 ${journalArticle?item_parity}"> 
127                          	<h3 class="title"> 
128                          		<a title="${languageUtil.get(locale,'juventud.general.more-info-about')} ${title}" 
129                          		   href="${detailUrl}&articleId=${journalArticle.getArticleId()}&title=${HtmlUtil.escapeURL(title)}&redirect=${HtmlUtil.escapeURL(currentUrl)}">${title}</a> 
130                          	</h3>       
131                          	<div class="col-content">  
132                          		<#if imagenNode ? has_content && imagenNode.getText() ? has_content> 
133                          			<div class="col-icon">		                          			 
134	                                	<img src="${imagenNode.getText()}" alt="${languageUtil.get(locale,'juventud.category.imagen')} - ${title}" />                                	             
135	                            	</div> 
136	                            	<div class="col-summary">			                            	 
137	                            <#else> 
138	                            	<div class="col-summary without-icon"> 
139	                            </#if>			                           
140                          		                                  
141                                  	 	${resumen}	 
142                              		</div> 
143                          	</div>                                                                               
144                          	<div class="link-more"> 
145                          		<a class="more-information" title="${languageUtil.get(locale,'juventud.general.more-info-about')} ${title}" 
146                          			href="${detailUrl}&articleId=${journalArticle.getArticleId()}&title=${HtmlUtil.escapeURL(title)}&redirect=${HtmlUtil.escapeURL(currentUrl)}">${languageUtil.get(locale,'juventud.general.more-info')}</a> 
147                      		</div> 
148                      	</div>  
149                      	</#if> 
150                	</#list>  
151	                
152	                
153	                                             
154              	</div> <!-- row -->           
155            </div> <!-- outer -->   
156        </div> 
157    </div>  
158<!-- No hay subcategorías, pintamos los contenidos de la categoría --> 
159<#else>                           
160  	<div class="card flex-md-row mb-4 box-shadow h-md-250"> 
161      	<div class="card-body d-flex flex-column align-items-start">                      
162          	<h2 class="mb-0">${currentCategory.getTitle(locale)}</h2>   
163          	<div class="outer">  
164              	<div class="row">    
165              		<#assign structureId = assetCategoriesCustomService.findStructure("ARTICULO", groupId)/>  
166              	              		 
167          			<#assign journalArticles = assetCategoriesCustomService.findJournalArticlesByCategoryId(currentCategory.getCategoryId(), groupId, structureId, null, "title", "asc", null, null)/>             	 
168						             
169		            <#list journalArticles as journalArticle> 
170		            	<#assign document = SAXReaderUtil.read(journalArticle.getContentByLocale(locale))			                      
171			                     title = "" 
172			                     resumen = ""	 
173			                     currentUrl = renderResponse.createRenderURL() 
174			                     detailPage = "detalle" 
175	                         	 layoutDetail = layoutLocalService.getFriendlyURLLayout(themeDisplay.getScopeGroupId(), false, "/"+detailPage) 
176	                 			 detailUrl = PortletURLFactoryUtil.create(request, "com_liferay_asset_categories_navigation_web_portlet_AssetCategoriesNavigationPortlet", layoutDetail.getPlid(), PortletRequest.RENDER_PHASE) 
177             			/> 
178			            <#if document.selectSingleNode("/root/dynamic-element[@name='titulo']/dynamic-content") ? has_content> 
179							<#assign titleNode = document.selectSingleNode("/root/dynamic-element[@name='titulo']/dynamic-content")	 
180									 title = titleNode.getText() 
181							/> 
182				      	</#if>  
183			            <#if document.selectSingleNode("/root/dynamic-element[@name='resumen']/dynamic-content") ? has_content> 
184							<#assign resumenNode = document.selectSingleNode("/root/dynamic-element[@name='resumen']/dynamic-content")	 
185									 resumen = HtmlUtil.stripHtml(resumenNode.getText()) 
186							/> 
187				      	</#if> 
188				      	<#if document.selectSingleNode("/root/dynamic-element[@name='imagen']/dynamic-content") ? has_content> 
189							<#assign imagenNode = document.selectSingleNode("/root/dynamic-element[@name='imagen']/dynamic-content")	/> 
190				      	</#if> 
191						      	 
192						      	        
193						${currentUrl.setParameter("categoryId",categoryId+"")} 
194						${detailUrl.setParameter("categoryId",currentCategory.getCategoryId()+"")} 
195						${detailUrl.setParameter("articleId", journalArticle.getArticleId())} 
196							                      
197              			<div class="col-md-6 ${journalArticle?item_parity}"> 
198                          	<h3 class="title"> 
199                          		<a title="${languageUtil.get(locale,'juventud.general.more-info-about')} ${title}" 
200                          			href="${detailUrl}&articleId=${journalArticle.getArticleId()}&title=${HtmlUtil.escapeURL(title)}&redirect=${HtmlUtil.escapeURL(currentUrl)}">${title}</a> 
201                          	</h3>       
202                          	<div class="col-content">  
203                          		<#if imagenNode ? has_content && imagenNode.getText() ? has_content> 
204                          			<div class="col-icon">		                          			 
205	                                	<img src="${imagenNode.getText()}" alt="${languageUtil.get(locale,'juventud.category.imagen')} - ${title}" />                                	             
206	                            	</div> 
207	                            	<div class="col-summary">			                            	 
208	                            <#else> 
209	                            	<div class="col-summary without-icon"> 
210	                            </#if>			                           
211                          		                                  
212                                  	 	${resumen}	 
213                              		</div> 
214                          	</div>                                                                               
215                          	<div class="link-more"> 
216                          		<a class="more-information" title="${languageUtil.get(locale,'juventud.general.more-info-about')} ${title}" 
217                          			href="${detailUrl}&articleId=${journalArticle.getArticleId()}&title=${HtmlUtil.escapeURL(title)}&redirect=${HtmlUtil.escapeURL(currentUrl)}">${languageUtil.get(locale,'juventud.general.more-info')}</a> 
218                      		</div> 
219                      	</div>  
220                	</#list>  
221                </div> <!-- row -->           
222            </div> <!-- outer -->   
223        </div> 
224    </div>    	 
225</#if>