Catégorie

Année

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