Show last authors
1 {{include document="Main.MacroSheet"/}}{{include document="Publications.MacroSheet"/}}{{include document="Publications.GlobalVars"/}}{{include document="Publications.ServiceMacroSheet"/}}{{velocity filter="none"}}{{html clean="false" wiki="true"}}
2 #### get parameters
3 ## when
4 #set( $yearPar = $context.getRequest().getParameter("year") )
5 #set( $firstYearPar = $context.getRequest().getParameter("from") )
6 #set( $lastYearPar = $context.getRequest().getParameter("to") )
7 ## who
8 #set( $userNamePar = $context.getRequest().getParameter("user") )
9 #set( $firstNamePar = $context.getRequest().getParameter("name") )
10 #set( $lastNamePar = $context.getRequest().getParameter("surname") )
11 #set( $authorNamePar = $context.getRequest().getParameter("author") )
12 #set( $editorNamePar = $context.getRequest().getParameter("editor") )
13 ## service selection
14 #set( $servicePar = $context.getRequest().getParameter("service").toLowerCase() )
15 ## test for presence / absence of service ID
16 ## yes/true no/false
17 #set( $idPar = $context.getRequest().getParameter("id").toLowerCase() )
18 ##
19 ## handle test for presence
20 #set( $id = true )#if( $idPar == 'no' || $idPar == 'false' )#set( $id = false )#end
21 ##
22 #set( $serviceOk = false )
23 #if( $servicePar && $servicePar != "" )
24 #if ( $serviceList.contains($servicePar) )
25 #set( $serviceOk = true )
26 #set( $serviceId = ${serviceIdMap.get($servicePar)} )
27 #set( $serviceField = ${serviceFieldMap.get($servicePar)} )
28 #else
29 <div stile='width: 100%;'>{{warning}}$servicePar {{english}}is not a recognised service{{/english}}{{italian}}non è un servizio riconosciuto{{/italian}}{{/warning}}</div>
30 <div>{{english}}One service among the following should be selected:{{/english}}{{italian}}È necessario selezionare uno tra i seguenti servizi:{{/italian}}</div>
31 #foreach($serviceId in $serviceList)
32 * $serviceNameMap.get($serviceId) &mdash; [[<tt>…/Publications/Id?id=$serviceId</tt>>>Publications.Id?id=$serviceId]]
33 #end
34 #end
35 #else
36 <div stile='width: 100%; font-size: larger'>{{error}}{{english}}Publication service not selected{{/english}}{{italian}}Servizio pubblicazioni non selezionato{{/italian}}{{/error}}</div>
37 <div>{{english}}One service among the following should be selected:{{/english}}{{italian}}È necessario selezionare uno tra i seguenti servizi:{{/italian}}</div>
38 #foreach($serviceId in $serviceList)
39 * $serviceNameMap.get($serviceId) &mdash; [[<tt>…/Publications/Id?service=$serviceId</tt>>>Publications.Id?service=$serviceId]]
40 #end
41 #end
42 ##
43 ## handle who
44 ## default: all users, all publications
45 #set( $allUsers = true )
46 #set( $justAuthor = false )
47 #set( $justEditor = false )
48 #set( $authorSearchName = "" )
49 #set( $editorSearchName = "" )
50 ##
51 #if ( $userName && $userName != "" )
52 ## from a personal page, "XWiki.UserName" $userName form
53 #set( $allUsers = false )
54 #set( $userdoc = $xwiki.getDocument($userName) )
55 #set( $displayFirstName = $userdoc.display("first_name") )
56 #set( $displayLastName = $userdoc.display("last_name") )
57 #set( $displayFullName = $displayFirstName + " " + $displayLastName )
58 #set( $authorSearchName = $displayLastName + ", " + $displayFirstName )
59 #set( $editorSearchName = $displayLastName + ", " + $displayFirstName )
60 #elseif ( $userNamePar && $userNamePar != "" )
61 ## from the request, "user=UserName" parameter
62 #set( $allUsers = false )
63 #set( $userdoc = $xwiki.getDocument("XWiki.$userNamePar") )
64 #set( $displayFirstName = $userdoc.display("first_name") )
65 #set( $displayLastName = $userdoc.display("last_name") )
66 #set( $displayFullName = $displayFirstName + " " + $displayLastName )
67 #set( $authorSearchName = $displayLastName + ", " + $displayFirstName )
68 #set( $editorSearchName = $displayLastName + ", " + $displayFirstName )
69 #elseif ( $firstNamePar && $firstNamePar!= "" && $lastNamePar && $lastNamePar != "" )
70 ## from the request, "name=Firstname&surname=Lastname" parameter
71 #set( $allUsers = false )
72 #set( $displayFirstName = $firstNamePar )
73 #set( $displayLastName = $lastNamePar )
74 #set( $displayFullName = $displayFirstName + " " + $displayLastName )
75 #set( $authorSearchName = $displayLastName + ", " + $displayFirstName )
76 #set( $editorSearchName = $displayLastName + ", " + $displayFirstName )
77 #elseif ( $authorNamePar && $authorNamePar != "" )
78 #set( $allUsers = false )
79 #set( $justAuthor = true )
80 #set( $authordoc = $xwiki.getDocument("XWiki.$authorNamePar") )
81 #set( $displayFirstName = $authordoc.display("first_name") )
82 #set( $displayLastName = $authordoc.display("last_name") )
83 #set( $displayFullName = $displayFirstName + " " + $displayLastName )
84 #set( $authorSearchName = $displayLastName + ", " + $displayFirstName )
85 #set( $editorSearchName = "Just author" )
86 #elseif ( $editorNamePar && $editorNamePar != "" )
87 #set( $allUsers = false )
88 #set( $justEditor = true )
89 #set( $editordoc = $xwiki.getDocument("XWiki.$editorNamePar") )
90 #set( $displayFirstName = $editordoc.display("first_name") )
91 #set( $displayLastName = $editordoc.display("last_name") )
92 #set( $displayFullName = $displayFirstName + " " + $displayLastName )
93 #set( $authorSearchName = "Just editor" )
94 #set( $editorSearchName = $displayLastName + ", " + $displayFirstName )
95 #end
96 ##
97 ## handle when
98 #if ( $yearPar )
99 ## 'year' parameter takes precedence
100 #set( $year = $util.parseInt($yearPar) )
101 #set( $yearList = [$year] )
102 #set( $oneYear = true )
103 #else
104 #set( $oneYear = false )
105 #set( $yearList = [$lastYear..$firstYear] )
106 #if ( $firstYearPar )
107 #set( $yearFirst = $util.parseInt($firstYearPar) )
108 #if ( $yearList.contains($yearFirst) )
109 #set( $firstYear = $yearFirst )
110 #set( $yearList = [$lastYear..$firstYear] )
111 #end
112 #end
113 #if( $lastYearPar )
114 #set( $yearLast = $util.parseInt($lastYearPar) )
115 #if ( $yearList.contains($yearLast) )
116 #set( $lastYear = $yearLast )
117 #set( $yearList = [$lastYear..$firstYear] )
118 #end
119 #end
120 #if( $lastYear == $firstYear )
121 #set( $year = $lastYear )
122 #set( $yearList = [$year] )
123 #set( $oneYear = true )
124 #end
125 #end
126 ##
127 #set( $autheditedTotal = 0 )
128 ##
129 #if( $serviceOk )
130 #### output results
131 <a name="top"> </a>
132 = {{english}}Publications#if( $id ) with#else without#end $serviceId#if(!$allUsers) / $displayFullName#if( $justAuthor) //(author)//#end#if( $justEditor) //(editor)//#end#end#if($oneYear) ($year)#else ($firstYear—$lastYear)#end{{/english}}{{italian}}Pubblicationi#if( $id ) con#else senza#end $serviceId#if(!$allUsers) / $displayFullName#if( $justAuthor) //(aut.)//#end#if( $justEditor) //(ed.)//#end#end#if($oneYear) ($year)#else ($firstYear—$lastYear)#end{{/italian}}=
133
134 #if(!$oneYear)(((#foreach( $year in $yearList)#if($velocityCount > 1) | #end[[$year>>#$year]]#end)))#end
135 ##
136 #foreach ($year in $yearList)
137 #set($sqlid = ", BaseObject as obj, StringProperty as prop, LongProperty as prop1, StringProperty as prop2, LargeStringProperty as prop3, StringProperty as prop4 where obj.name=doc.fullName and obj.className='Publications.PublicationClass' and obj.name<>'Publications.PublicationClassTemplate' and prop.id.id=obj.id and prop1.id.id=obj.id and prop2.id.id=obj.id and prop3.id.id=obj.id and prop4.id.id=obj.id and prop.name = 'status' and prop.value = 'Published' and prop1.name = 'year' and prop1.value = $year and prop2.name = '$serviceField' and prop2.value <> '' and prop3.name='author' and prop4.name='editor' and ( prop3.value like '%$authorSearchName%' or (prop3.value = '' and prop4.value like '%$editorSearchName%') )" )
138 #set($sqlnoid = ", BaseObject as obj, StringProperty as prop, LongProperty as prop1, StringProperty as prop2, LargeStringProperty as prop3, StringProperty as prop4 where obj.name=doc.fullName and obj.className='Publications.PublicationClass' and obj.name<>'Publications.PublicationClassTemplate' and prop.id.id=obj.id and prop1.id.id=obj.id and prop2.id.id=obj.id and prop3.id.id=obj.id and prop4.id.id=obj.id and prop.name = 'status' and prop.value = 'Published' and prop1.name = 'year' and prop1.value = $year and prop2.name = '$serviceField' and prop2.value = '' and prop3.name='author' and prop4.name='editor' and ( prop3.value like '%$authorSearchName%' or (prop3.value = '' and prop4.value like '%$editorSearchName%') )" )
139 ## id parameter
140 #if( $id )#set( $sql = $sqlid )#else#set( $sql = $sqlnoid )#end
141 #set($pubFound = $xwiki.searchDocuments($sql))
142 #if ($pubFound.size()>0)
143 #set( $autheditedTotal = $autheditedTotal + $pubFound.size())
144 #if (!$oneYear)
145 <a name=$year> </a>
146 == $year <em>($pubFound.size())</em> ==
147 #else
148 <em>($pubFound.size())</em>
149 #end
150 #foreach ($pub in $pubFound)
151 #set($pubDoc=$xwiki.getDocument($pub))
152 * {{pubLinks year=no all=no $servicePar=yes}}$pubDoc{{/pubLinks}}
153 #end
154 #end
155 #end
156 <table width="100%"><tr><th align="right"><a href="#top">{{{[}}}top{{{]}}}</a></th></tr></table>
157 #end
158 {{/html}}
159 {{/velocity}}

2011 © aliCE Research Group @ DEIS, Alma Mater Studiorum-Università di Bologna
1.1