1<#--
2Widget templates can be used to modify the look of a
3specific application.
4
5Please use the right panel to quickly add commonly used variables.
6Autocomplete is also available and can be invoked by typing "${".
7-->
8<style>
9 .span-category p {
10 display: inline;
11 margin-bottom: 0;
12 }
13</style>
14<!-- -->
15<#function userGroupIdByCategoryId categoryId>
16 <#assign UserGroupService = serviceLocator.findService("com.liferay.portal.kernel.service.UserGroupLocalService")>
17 <#assign userGroupId = 0 />
18 <#list UserGroupService.getUserGroups(-1,-1) as userGroup>
19 <#assign expando = userGroup.getExpandoBridge()/>
20 <#if expando.getAttribute("idcategorie") == categoryId>
21 <#assign userGroupId = userGroup.getUserGroupId() />
22 </#if>
23 </#list>
24 <#return userGroupId>
25</#function>
26
27<!-- Test si le user fait partie d'un groupe -->
28<#function estDansLeGroupe userId userGroupId>
29 <#assign UserGroupService = serviceLocator.findService("com.liferay.portal.kernel.service.UserGroupLocalService")>
30 <#return UserGroupService.hasUserUserGroup(userId,userGroupId) >
31</#function>
32
33<!-- calcule l'intersection de 2 listes -->
34<#function getIntersection list1 list2>
35 <#assign intersection = []>
36 <#list list1 as item1>
37 <#if list2?seq_contains(item1)>
38 <#assign intersection += [item1]>
39 </#if>
40 </#list>
41 <#return []>
42</#function>
43
44
45<#assign AbonneUserGroupId = 33616/>
46<#assign AbonneAvanceUserGroupId = 49064/>
47<#assign UserService = serviceLocator.findService("com.liferay.portal.kernel.service.UserService")>
48<#assign userId = UserService.getCurrentUser().getUserId()>
49<#assign isAbonne = estDansLeGroupe(userId,AbonneUserGroupId) />
50<#assign isAbonneAvancee = estDansLeGroupe(userId,AbonneAvanceUserGroupId) />
51
52<div class="container">
53 <div class="row d-flex align-items-stretch">
54
55<#if entries?has_content>
56 <#list entries as curEntry>
57 <#assign assetEntryCategoryIds = curEntry.getCategoryIds() />
58 <#assign renderer = curEntry.getAssetRenderer()>
59 <#assign className = renderer.getClassName()>
60 <#if className == "com.liferay.journal.model.JournalArticle">
61 <#assign journalArticle = renderer.getArticle()>
62 <#assign document = saxReaderUtil.read(journalArticle.getContent())>
63 <#assign rootElement = document.getRootElement()>
64
65 <#assign link = "">
66 <#assign titre = "">
67 <#assign sommaire= "">
68 <#assign date = "">
69 <#assign estEnLigne = "">
70
71 <#assign imageFiche = "">
72 <#assign imageArticleContent = "">
73 <#assign journalArticleResourcePK = journalArticle.getResourcePrimKey()>
74 <#assign assetCategoryLocalServiceUtil = staticUtil["com.liferay.asset.kernel.service.AssetCategoryLocalServiceUtil"]>
75 <#assign categoryList = assetCategoryLocalServiceUtil.getCategories("com.liferay.journal.model.JournalArticle", journalArticleResourcePK)/>
76
77
78 <#list rootElement.elements() as dynamicElement>
79 <#if dynamicElement.attributeValue("name") == "Text45360172">
80 <#assign titre = dynamicElement.element("dynamic-content").getText()>
81 </#if>
82 <#if dynamicElement.attributeValue("name") == "RichText73680515">
83 <#assign sommaire = dynamicElement.element("dynamic-content").getText()>
84 </#if>
85 <#if dynamicElement.attributeValue("name") == "Date19797917">
86 <#assign date = dynamicElement.element("dynamic-content").getText()>
87 </#if>
88 <#if dynamicElement.attributeValue("name") == "Radio33203483">
89 <#assign estEnLigne = dynamicElement.element("dynamic-content").getText()>
90 </#if>
91
92
93 <#if "Image60701321" == dynamicElement.attributeValue("name")>
94 <#assign imageArticleContent = dynamicElement.element("dynamic-content").getText()>
95 <#if imageArticleContent??>
96 <#assign imgJson = jsonFactoryUtil.createJSONObject(imageArticleContent)>
97 <#if imgJson.url?has_content>
98 <#assign imageFiche = imgJson.url>
99 <#elseif imgJson.groupId?has_content>
100 <#assign imageFiche = "/documents/"+ imgJson.groupId +"/" +imgJson.resourcePrimKey +"/"+ imgJson.name +"/"+imgJson.uuid>
101 </#if>
102 </#if>
103 </#if>
104 <#assign link = renderer.getURLViewInContext(renderRequest, renderResponse, '') >
105
106
107
108 </#list>
109 </#if>
110 <!--Tester si le contenu est sélectionné En ligne-->
111 <#if estEnLigne == "Option67141765">
112
113 <div class="col-sm-6 col-lg-6 d-flex align-items-stretch">
114 <a class="box box-dossier mb-4 w-100 d-flex flex-column" href="${link}">
115 <#if imageArticleContent?? && imageFiche != "">
116 <div class="ratio-9-16 mb-3" alt="${titre}" style="background-image: url('${imageFiche}')"></div>
117 <#else>
118 <div class="ratio-9-16 mb-3" alt="${titre}" style="background-color:black;"></div>
119 </#if>
120
121 <div class="px-2">
122 <h3 class="h4 mb-3">${titre}</h3>
123 <#if sommaire ??>
124 ${sommaire}
125 </#if>
126 </div>
127
128 <div class="p-2 mt-auto row d-flex align-items-end">
129 <div class="col-auto small">
130 <span class="fw-bold text-uppercase span-category">
131 <#assign isAbonneDossier = false />
132 <#list categoryList as category>
133 ${htmlUtil.unescape(category.getDescription())}
134 <#assign dossierUserGroupId = userGroupIdByCategoryId(category.getCategoryId()) />
135 <#if estDansLeGroupe(userId,dossierUserGroupId) == true >
136 <#assign isAbonneDossier = true />
137 </#if>
138 </#list>
139 </span>
140 <span> / </span>
141 <span>${date}</span>
142 </div>
143 <#if isAbonne || isAbonneAvancee || isAbonneDossier>
144 <div class="col text-end text-right">
145 <span data-toggle="tooltip" data-placement="top" title="Accèder au dossier">
146 <svg id="next" xmlns="http://www.w3.org/2000/svg" width="20.5" height="20.5" viewBox="0 0 20.5 20.5"><g id="Groupe_111" data-name="Groupe 111"><path id="Tracé_309" data-name="Tracé 309" d="M10.25,0A10.25,10.25,0,1,0,20.5,10.25,10.261,10.261,0,0,0,10.25,0Zm3.166,10.854L9.146,15.125a.854.854,0,0,1-1.208-1.208L11.6,10.25,7.938,6.583A.854.854,0,1,1,9.146,5.375l4.271,4.271A.853.853,0,0,1,13.416,10.854Z" fill="#2b3a8b"/></g></svg>
147 </span>
148 </div>
149 <#else>
150 <div class="col text-end text-right">
151 <span data-toggle="tooltip" data-placement="top" title="Contenu payant - Abonnez-vous pour y avoir accès">
152 <svg xmlns="http://www.w3.org/2000/svg" width="12.766" height="14.59" viewBox="0 0 12.766 14.59"><path id="Tracé_272" data-name="Tracé 272" d="M4.1,4.1V5.471H8.663V4.1A2.28,2.28,0,1,0,4.1,4.1ZM2.28,5.471V4.1a4.1,4.1,0,0,1,8.207,0V5.471h.456a1.825,1.825,0,0,1,1.824,1.824v5.471a1.825,1.825,0,0,1-1.824,1.824H1.824A1.825,1.825,0,0,1,0,12.766V7.295A1.825,1.825,0,0,1,1.824,5.471Z" fill="#2b3a8c"/></svg>
153 </span>
154 </div>
155 </#if>
156 </div>
157
158
159 </a>
160 </div>
161 </#if>
162 </#list>
163 </#if>
164</div>
165</div>