Show last authors
1 #includeMacros("Talks.MacroSheet")
2 #includeMacros("Talks.GlobalVars")
3
4 #### get parameters
5 ## who
6 #set( $userNamePar = $context.getRequest().getParameter("user") )
7 #set( $firstNamePar = $context.getRequest().getParameter("name") )
8 #set( $lastNamePar = $context.getRequest().getParameter("surname") )
9 ## category
10 #set($categoryPar = $context.getRequest().getParameter("category"))
11
12 #### handle who
13 #if ( $userName )
14 ## from a personal page, "XWiki.UserName" $userName form
15 #set( $apiceAuthor = true )
16 #set( $oneAuthor = true )
17 #set( $userdoc = $xwiki.getDocument($userName) )
18 #set( $authorFirstName = $userdoc.display("first_name") )
19 #set( $authorLastName = $userdoc.display("last_name") )
20 #elseif ( $userNamePar )
21 ## from the URL, "user=UserName" parameter
22 #set( $userName = "XWiki.$userNamePar" )
23 #set( $apiceAuthor = true )
24 #set( $oneAuthor = true)
25 #set( $userdoc = $xwiki.getDocument($userName) )
26 #set( $authorFirstName = $userdoc.display("first_name") )
27 #set( $authorLastName = $userdoc.display("last_name") )
28 #elseif ( $firstNamePar && $lastNamePar )
29 ## from the URL, "name=Firstname&surname=Lastname" parameter
30 #set( $apiceAuthor = false )
31 #set( $oneAuthor = true )
32 #set( $authorFirstName = $firstNamePar )
33 #set( $authorLastName = $lastNamePar )
34 #else
35 #set( $apiceAuthor = false )
36 #set( $oneAuthor = false )
37 #set( $authorFirstName = "" )
38 #set( $authorLastName = "" )
39 #end
40
41 #### handle category
42 ##
43 #set($categoryRange = ['Talk','Invited','Seminar','Lecture','Tutorial','Project','Informal','Internal','PhD','Poster','Other'])
44 ##
45 #set($oneCategory = false)
46 ##
47 #if(!$categoryPar || $categoryPar.toLowerCase() =="all")
48 #set($categoryList = $categoryRange)
49 #else
50 #if ($categoryRange.contains($categoryPar) )
51 #set($categoryList = [$categoryPar])
52 #set($oneCategory = true)
53 #end
54 #end
55
56 #### Preparing the web page
57 ##
58 ## top anchor
59 <a name="top"> </a>
60 ##
61 ## Page title
62 ##
63 #if($oneAuthor)
64 #if ($context.language=="it")
65 1 #if ($oneCategory) #talkCategoriesString($categoryPar) #else Presentazioni #end di $authorFirstName $authorLastName #if (!$oneCategory) per tipo
66 #end
67 #else
68 1 #if ($oneCategory) #talkCategoriesString($categoryPar) #else Talks #end by $authorFirstName $authorLastName #if (!$oneCategory) by Category
69 #end
70 #end
71 #else
72 #if ($context.language=="it")
73 1 #if ($oneCategory) #talkCategoriesString($categoryPar) #else Presentazioni #end nello spazio #apice() #if (!$oneCategory) per tipo
74 #end
75 #else
76 1 #if ($oneCategory) #talkCategoriesString($categoryPar) #else Talks #end in the #apice() Space #if (!$oneCategory) by Category
77 #end
78 #end
79 #end
80
81 ##
82 ## Page text
83 ##
84 #if (!$oneCategory)
85 #if ($context.language=="it")
86 Di seguito, le presentazioni #if($oneAuthor) di $authorFirstName $authorLastName #else nello spazio #apice() #end ordinate per tipo.
87 <hr />
88 #else
89 Below, the talks #if($oneAuthor) by $authorFirstName $authorLastName #else in the #apice() space #end ordered by category.
90 <hr />
91 #end
92 ##
93 ## Page index
94 ##
95 <div>
96 #foreach ($category in $categoryList)
97 #if ($velocityCount > 1) | #end [#talkCategoriesString($category) |#$category]
98 #end
99 </div>
100 <hr />
101 #end
102 ##
103 ## Document queries, one for each category
104 ##
105 #foreach ($category in $categoryList)
106 #if($oneAuthor)
107 #if($apiceAuthor) ## one APICe author
108 #set ($sql = ", BaseObject as obj, DateProperty as prop, LargeStringProperty as prop1, StringProperty as prop2
109 where
110 obj.name=doc.fullName and
111 obj.className='Talks.TalkClass' and
112 obj.name<>'Talks.TalkClassTemplate' and
113 prop.id.id=obj.id and
114 prop1.id.id=obj.id and
115 prop2.id.id=obj.id and
116 prop.name='date' and
117 prop1.name='authors' and
118 prop1.value like '%$userName%' and
119 prop2.name='category' and
120 prop2.value='$category'
121 order by prop.value desc")
122 #else ## one non APICe author
123 #set ($sql = ", BaseObject as obj, DateProperty as prop, StringProperty as prop1, StringProperty as prop2
124 where
125 obj.name=doc.fullName and
126 obj.className='Talks.TalkClass' and
127 obj.name<>'Talks.TalkClassTemplate' and
128 prop.id.id=obj.id and
129 prop1.id.id=obj.id and
130 prop2.id.id=obj.id and
131 prop.name='date' and
132 prop1.name='externalAuthors' and
133 prop1.value like '%$authorLastName, $authorFirstName%' and
134 prop2.name='category' and
135 prop2.value='$category'
136 order by prop.value desc")
137 #end
138 #else ##all authors
139 #set ($sql = ", BaseObject as obj, DateProperty as prop, StringProperty as prop1
140 where
141 obj.name=doc.fullName and
142 obj.className='Talks.TalkClass' and
143 obj.name<>'Talks.TalkClassTemplate' and
144 prop.id.id=obj.id and
145 prop1.id.id=obj.id and
146 prop.name='date' and
147 prop1.name='category' and
148 prop1.value='$category'
149 order by prop.value desc")
150 #end
151 ##
152 #set($talkFound = $xwiki.searchDocuments($sql))
153 ##
154 #if ($talkFound.size() > 0)
155 #if (!$oneCategory)
156 ##
157 <a name='$category' > </a>
158 1.1 #talkCategoriesString($category)
159
160 ##
161 #end
162 #foreach ($talk in $talkFound)
163 ##
164 * #talkTDASInline($talk)
165
166 ##
167 #end
168 #end
169 #end

Partita IVA: 01131710376 - Copyright © 2008-2021 APICe@DISI Research Group - PRIVACY