Wiki source code of Per Year
Last modified by Andrea Omicini on 28/03/2021 02:49
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | #includeMacros("Main.MacroSheet")#includeMacros("Events.MacroSheet")#includeMacros("Events.GlobalVars") | ||
2 | |||
3 | #### Setting year variables | ||
4 | ## set from caller page: $firstYearEv, $lastYearEv | ||
5 | #if( $firstYearEv )#set( $firstYear = $firstYearEv )#end | ||
6 | #if( $lastYearEv )#set( $lastYear = $lastYearEv )#end | ||
7 | |||
8 | #### get parameters | ||
9 | ## when | ||
10 | #set( $yearPar = $context.getRequest().getParameter("year") ) | ||
11 | #set( $firstYearPar = $context.getRequest().getParameter("from") ) | ||
12 | #set( $lastYearPar = $context.getRequest().getParameter("to") ) | ||
13 | ## who | ||
14 | #set( $userNamePar = $context.getRequest().getParameter("user") ) | ||
15 | #set( $firstNamePar = $context.getRequest().getParameter("name") ) | ||
16 | #set( $lastNamePar = $context.getRequest().getParameter("surname") ) | ||
17 | |||
18 | #### handle who | ||
19 | #if ( $userName ) | ||
20 | ## from a personal page, "XWiki.PersonalSpace" $userName form | ||
21 | #set( $onePerson = true ) | ||
22 | #set( $userdoc = $xwiki.getDocument($userName) ) | ||
23 | #set( $personFirstName = $userdoc.display("first_name") ) | ||
24 | #set( $personLastName = $userdoc.display("last_name") ) | ||
25 | #elseif ( $userNamePar ) | ||
26 | ## from the URL, "user=PersonalSpace" parameter | ||
27 | #set( $userName = "XWiki.$userNamePar" ) | ||
28 | #set( $onePerson = true) | ||
29 | #set( $userdoc = $xwiki.getDocument($userName) ) | ||
30 | #set( $personFirstName = $userdoc.display("first_name") ) | ||
31 | #set( $personLastName = $userdoc.display("last_name") ) | ||
32 | #elseif ( $firstNamePar && $lastNamePar ) | ||
33 | ## from the URL, "name=Firstname&surname=Lastname" parameter | ||
34 | #set( $onePerson = true ) | ||
35 | #set( $personFirstName = $firstNamePar ) | ||
36 | #set( $personLastName = $lastNamePar ) | ||
37 | #else | ||
38 | #set( $oneAuthor = false ) | ||
39 | #set( $personFirstName = "" ) | ||
40 | #set( $personLastName = "" ) | ||
41 | #end | ||
42 | |||
43 | #### handle when | ||
44 | #if ( $yearPar ) | ||
45 | ## 'year' parameter takes precedence | ||
46 | #set( $year = $util.parseInt($yearPar) ) | ||
47 | #set( $yearList = [$year] ) | ||
48 | #set( $oneYear = true ) | ||
49 | #else | ||
50 | #set( $oneYear = false ) | ||
51 | #set( $yearList = [$lastYear..$firstYear] ) | ||
52 | #if ( $firstYearPar ) | ||
53 | #set( $yearFirst = $util.parseInt($firstYearPar) ) | ||
54 | #if ( $yearList.contains($yearFirst) ) | ||
55 | #set( $firstYear = $yearFirst ) | ||
56 | #set( $yearList = [$lastYear..$firstYear] ) | ||
57 | #end | ||
58 | #end | ||
59 | #if( $lastYearPar ) | ||
60 | #set( $yearLast = $util.parseInt($lastYearPar) ) | ||
61 | #if ( $yearList.contains($yearLast) ) | ||
62 | #set( $lastYear = $yearLast ) | ||
63 | #set( $yearList = [$lastYear..$firstYear] ) | ||
64 | #end | ||
65 | #end | ||
66 | #if( $lastYear == $firstYear ) | ||
67 | #set( $year = $lastYear ) | ||
68 | #set( $yearList = [$year] ) | ||
69 | #set( $oneYear = true ) | ||
70 | #end | ||
71 | #end | ||
72 | |||
73 | |||
74 | #### Preparing the web page | ||
75 | ## | ||
76 | ## top anchor | ||
77 | <a name="top"> </a> | ||
78 | ## | ||
79 | ## Page title | ||
80 | ## | ||
81 | #if ($context.language=="it") | ||
82 | |||
83 | 1 Eventi #if($onePerson) con $personFirstName $personLastName #else nello spazio #apice() #end #if ($oneYear) ($year) #else ($firstYear—$lastYear) #end | ||
84 | #else | ||
85 | |||
86 | 1 Events #if($onePerson) with $personFirstName $personLastName #else in the #apice() Space #end #if ($oneYear) ($year) #else ($firstYear—$lastYear) #end | ||
87 | #end | ||
88 | ## | ||
89 | |||
90 | #if (!$oneYear) | ||
91 | #if ($context.language=="it") | ||
92 | Sotto, gli eventi scientifici #if($onePerson) con $personFirstName $personLastName #else nello spazio #apice() #end tra il $firstYear e il $lastYear, ordinati per anno. | ||
93 | #else | ||
94 | Below, scientific events #if($onePerson) with $personFirstName $personLastName #else in the #apice() Space #end between $firstYear and $lastYear, ordered by year. | ||
95 | #end | ||
96 | ---- | ||
97 | <div> | ||
98 | #foreach ($year in $yearList) | ||
99 | #if ($velocityCount > 1) | #end [$year |#$year] | ||
100 | #end | ||
101 | </div> | ||
102 | ---- | ||
103 | #end | ||
104 | |||
105 | #foreach ($year in $yearList) | ||
106 | #if($onePerson) | ||
107 | #set ($sql = ", BaseObject as obj, DateProperty as prop, LargeStringProperty as prop1, LargeStringProperty as prop2, LargeStringProperty as prop3, LargeStringProperty as prop4, LargeStringProperty as prop5, LargeStringProperty as prop6, LargeStringProperty as prop7 | ||
108 | where | ||
109 | obj.name=doc.fullName and | ||
110 | obj.className='Events.EventClass' and | ||
111 | obj.name<>'Events.EventClassTemplate' and | ||
112 | prop.id.id=obj.id and | ||
113 | prop1.id.id=obj.id and | ||
114 | prop2.id.id=obj.id and | ||
115 | prop3.id.id=obj.id and | ||
116 | prop4.id.id=obj.id and | ||
117 | prop5.id.id=obj.id and | ||
118 | prop6.id.id=obj.id and | ||
119 | prop7.id.id=obj.id and | ||
120 | prop.name='year' and | ||
121 | prop1.name='general_chair' and | ||
122 | prop2.name='program_chair' and | ||
123 | prop2.name='program_chair' and | ||
124 | prop3.name='organising_chair' and | ||
125 | prop4.name='pc_member' and | ||
126 | prop5.name='organiser' and | ||
127 | prop6.name='lecturer' and | ||
128 | prop7.name='other_role_player_1' and | ||
129 | year(prop.value) = $year and | ||
130 | ( prop1.value like '%$userName%' or | ||
131 | prop2.value like '%$userName%' or | ||
132 | prop3.value like '%$userName%' or | ||
133 | prop4.value like '%$userName%' or | ||
134 | prop5.value like '%$userName%' or | ||
135 | prop6.value like '%$userName%' or | ||
136 | prop7.value like '%$userName%' ) | ||
137 | order by prop.value desc") | ||
138 | #else | ||
139 | #set ($sql = ", BaseObject as obj, DateProperty as prop | ||
140 | where | ||
141 | obj.name=doc.fullName and | ||
142 | obj.className='Events.EventClass' and | ||
143 | obj.name<>'Events.EventClassTemplate' and | ||
144 | prop.id.id=obj.id and | ||
145 | prop.name='year' and | ||
146 | year(prop.value) = $year | ||
147 | order by prop.value desc") | ||
148 | #end | ||
149 | ## | ||
150 | #set($eventFound = $xwiki.searchDocuments($sql)) | ||
151 | #if ($eventFound.size()>0) | ||
152 | #if (!$oneYear) | ||
153 | <a name=$year> </a> | ||
154 | 1.1 $year | ||
155 | #end | ||
156 | #foreach ($item in $eventFound) | ||
157 | #if ($velocityCount > 1) | #end#eventAcrolink($item)#if($context.getUser() != "XWiki.XWikiGuest")<a href="$xwiki.getURL("$item", "inline")"><img alt="$msg.get('panels.documentInformation.editIncluded', [$page])" src="$xwiki.getSkinFile('icons/silk/page_white_edit.gif')" /></a>#end#end | ||
158 | #end | ||
159 | #end |