Heading Example
You do not have the roles required to access this portlet.
You do not have the roles required to access this portlet.
An error occurred while processing the template.
The following has evaluated to null or missing:
==> articleIdToShow [in template "79933785239121#20119#41645" at line 122, column 53]
----
Tip: If the failing expression is known to 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: ${articleIdToShow} [in template "79933785239121#20119#41645" at line 122, column 51]
----
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
9
10<#function getDate maDate, daysToAdd>
11 <#if maDate =="all">
12 <#local maDate=addDays(.now,daysToAdd)>
13 <#else>
14 <#attempt>
15 <#if maDate?has_content>
16 <#local maDate = dateUtil.parseDate("yyyy-MM-dd",maDate,locale)/>
17 <#else>
18 <#local maDate=addDays(.now,daysToAdd)/>
19 </#if>
20 <#recover>
21 <#local maDate=addDays(.now,daysToAdd)/>
22 </#attempt>
23 </#if>
24 <#return maDate>
25</#function>
26
27
28<div class="text-center">
29
30<#assign lienToShow = "">
31<#assign titreToShow = "">
32<#assign imageFicheToShow = "">
33<#assign nombreDeVuesToShow = 10000000>
34<#assign expandoToChange = "">
35<#assign index = 0>
36<#assign bestScore = -1>
37<#if entries?has_content>
38 <#list entries as curEntry>
39 <#assign renderer = curEntry.getAssetRenderer()>
40 <#assign className = renderer.getClassName()>
41 <#if className == "com.liferay.journal.model.JournalArticle">
42 <#assign journalArticle = renderer.getArticle()>
43
44 <#assign document = saxReaderUtil.read(journalArticle.getContent())>
45 <#assign rootElement = document.getRootElement()>
46 <#assign articleId = journalArticle.getArticleId()>
47
48 <#assign lien = "">
49 <#assign titre = "">
50 <#assign date_debut = "">
51 <#assign date_fin = "">
52 <#assign format = "">
53 <#assign imageFiche = "">
54 <#assign imageArticleContent = "">
55
56
57 <#assign expandoBridge = journalArticle.getExpandoBridge()>
58 <#assign hasAttribute = expandoBridge.hasAttribute("nbvues")>
59 <#assign nombreDeVues = expandoBridge.getAttribute("nbvues")>
60
61 <#list rootElement.elements() as dynamicElement>
62 <#if dynamicElement.attributeValue("name") == "Text96424148">
63 <#assign titre = dynamicElement.element("dynamic-content").getText()>
64 </#if>
65 <#if dynamicElement.attributeValue("name") == "Text40058933">
66 <#assign lien = dynamicElement.element("dynamic-content").getText()>
67 </#if>
68 <#if dynamicElement.attributeValue("name") == "Date38504422">
69 <#assign date_debut = dynamicElement.element("dynamic-content").getText()>
70 </#if>
71 <#if dynamicElement.attributeValue("name") == "Date12132604">
72 <#assign date_fin = dynamicElement.element("dynamic-content").getText()>
73 </#if>
74 <#if dynamicElement.attributeValue("name") == "Select07511272">
75 <#assign format = dynamicElement.element("dynamic-content").getText()>
76 </#if>
77 <#if "Image02997258" == dynamicElement.attributeValue("name")>
78 <#assign imageArticleContent = dynamicElement.element("dynamic-content").getText()>
79 <#if imageArticleContent??>
80 <#assign imgJson = jsonFactoryUtil.createJSONObject(imageArticleContent)>
81 <#if imgJson.url?has_content>
82 <#assign imageFiche = imgJson.url>
83 <#elseif imgJson.groupId?has_content>
84 <#assign imageFiche = "/documents/"+ imgJson.groupId +"/" +imgJson.resourcePrimKey +"/"+ imgJson.name +"/"+imgJson.uuid>
85 </#if>
86 </#if>
87 </#if>
88 </#list>
89 </#if>
90
91 <#assign dateDebut = getDate(date_debut,0)>
92 <#assign dateFin = getDate(date_fin,0)>
93
94 <#if (dateUtil.compareTo(dateDebut?date,.now?date) <= 0) && (dateUtil.compareTo(dateFin?date,.now?date) >= 0)>
95
96 <#assign seed = (.now?long * (index + 1))?abs>
97 <#assign randomScore = (seed % 10000) / 100.0>
98
99
100
101
102
103 <#if index == 0>
104 <#assign bestScore = randomScore>
105 </#if>
106 <#if (randomScore >= bestScore)>
107 <#assign bestScore = randomScore>
108 <#assign lienToShow = lien>
109 <#assign titreToShow = titre>
110 <#assign imageFicheToShow = imageFiche>
111 <#assign expandoToChange = expandoBridge>
112 <#assign articleIdToShow = articleId>
113 <#assign nombreDeVuesToShow = nombreDeVues>
114 </#if>
115 </#if>
116 <#assign index = index + 1>
117 </#list>
118 <#if expandoToChange?has_content>
119 <#assign tmp = expandoToChange.setAttribute("nbvues",nombreDeVuesToShow+1)>
120 </#if>
121
122 <a href="/web/coopoint/clicpub?id=${articleIdToShow}&lien=${lienToShow}" target="_blank"><img style="max-width:70%;" src="${imageFicheToShow}" alt="${titreToShow}" /></a>
123</#if>
124
125</div>