Show last authors
1 #includeMacros("Main.MacroSheet")
2 #includeMacros("Publications.MacroSheet")
3 #includeMacros("Publications.GlobalVars")
4
5 #### get parameters
6 ## when
7 #set( $yearPar = $context.getRequest().getParameter("year") )
8 #set( $firstYearPar = $context.getRequest().getParameter("from") )
9 #set( $lastYearPar = $context.getRequest().getParameter("to") )
10 ## who
11 #set( $userNamePar = $context.getRequest().getParameter("user") )
12 #set( $firstNamePar = $context.getRequest().getParameter("name") )
13 #set( $lastNamePar = $context.getRequest().getParameter("surname") )
14
15 ## handle who
16 #if ( $userName )
17 ## from a personal page, "XWiki.PersonalSpace" $userName form
18 #set( $oneAuthor = true )
19 #set( $userdoc = $xwiki.getDocument($userName) )
20 #set( $authorFirstName = $userdoc.display("first_name") )
21 #set( $authorLastName = $userdoc.display("last_name") )
22 #elseif ( $userNamePar )
23 ## from the URL, "user=PersonalSpace" parameter
24 #set( $oneAuthor = true)
25 #set( $userdoc = $xwiki.getDocument("XWiki.$userNamePar") )
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( $oneAuthor = true )
31 #set( $authorFirstName = $firstNamePar )
32 #set( $authorLastName = $lastNamePar )
33 #else
34 #set( $oneAuthor = false )
35 #set( $authorFirstName = "" )
36 #set( $authorLastName = "" )
37 #end
38
39 ## handle when
40 #if ( $yearPar )
41 ## 'year' parameter takes precedence
42 #set( $year = $util.parseInt($yearPar) )
43 #set( $yearList = [$year] )
44 #set( $oneYear = true )
45 #else
46 #set( $oneYear = false )
47 #set( $yearList = [$lastYear..$firstYear] )
48 #if ( $firstYearPar )
49 #set( $yearFirst = $util.parseInt($firstYearPar) )
50 #if ( $yearList.contains($yearFirst) )
51 #set( $firstYear = $yearFirst )
52 #set( $yearList = [$lastYear..$firstYear] )
53 #end
54 #end
55 #if( $lastYearPar )
56 #set( $yearLast = $util.parseInt($lastYearPar) )
57 #if ( $yearList.contains($yearLast) )
58 #set( $lastYear = $yearLast )
59 #set( $yearList = [$lastYear..$firstYear] )
60 #end
61 #end
62 #if( $lastYear == $firstYear )
63 #set( $year = $lastYear )
64 #set( $yearList = [$year] )
65 #set( $oneYear = true )
66 #end
67 #end
68
69 #set( $authoredTotal = 0 )
70
71 #### output results
72 <a name="top"> </a>
73
74 1 Authored publications with IRIS ID #if($oneAuthor) by $authorFirstName $authorLastName #end in the #apice() Space #if ($oneYear) ($year) #else ($firstYear&mdash;$lastYear) #end
75
76 #if (!$oneYear)
77 Below, the authored publications with IRIS ID #if($oneAuthor) by $authorFirstName $authorLastName #end in the #apice() Space between $firstYear and $lastYear, ordered by year of publication.
78 ----
79 <div>
80 #foreach ($year in $yearList)
81 #if ($velocityCount > 1) | #end [$year |#$year]
82 #end
83 </div>
84 ----
85 #end
86
87 #foreach ($year in $yearList)
88 #set ($sql = ", BaseObject as obj, StringProperty as prop, LongProperty as prop1, StringProperty as prop2, LargeStringProperty as prop3
89 where
90 obj.name=doc.fullName and
91 obj.className='Publications.PublicationClass' and
92 obj.name<>'Publications.PublicationClassTemplate' and
93 prop.id.id=obj.id and
94 prop1.id.id=obj.id and
95 prop2.id.id=obj.id and
96 prop3.id.id=obj.id and
97 prop.name = 'status' and
98 prop.value = 'Published' and
99 prop1.name = 'year' and
100 prop1.value = " + $year +" and
101 prop2.name = 'irisId' and
102 prop2.value <> '' and
103 prop3.name='author' and
104 prop3.value like '%$authorLastName, $authorFirstName%'")
105 #set($pubFound = $xwiki.searchDocuments($sql))
106 #if ($pubFound.size()>0)
107 #set( $authoredTotal = $authoredTotal + $pubFound.size())
108 #if (!$oneYear)
109 <a name=$year> </a>
110 1.1 $year <em>($pubFound.size())</em>
111 #else
112 <em>($pubFound.size())</em>
113 #end
114 #foreach ($item in $pubFound)
115 #set($pubDoc=$xwiki.getDocument($item))
116 #set($pubObj=$pubDoc.getObject("Publications.PublicationClass"))
117 #set ($iris = $irisurl+$pubDoc.display('irisId') )
118 * [ $pubDoc.display("title") | $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>[ {image:iris.png|document=Publications.Iris|width=40px} | $iris ]#end
119
120 #end
121 <table width="100%"><tr><th align="right"><a href="#top">{pre}[{/pre}top{pre}]{/pre}</a></th></tr></table>
122 #end
123 #end
124 <div align='right'><em>\[total: $authoredTotal\]</em></div>

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