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( $oneEditor = true )
19 #set( $userdoc = $xwiki.getDocument($userName) )
20 #set( $editorFirstName = $userdoc.display("first_name") )
21 #set( $editorLastName = $userdoc.display("last_name") )
22 #elseif ( $userNamePar )
23 ## from the URL, "user=PersonalSpace" parameter
24 #set( $oneEditor = true)
25 #set( $userdoc = $xwiki.getDocument("XWiki.$userNamePar") )
26 #set( $editorFirstName = $userdoc.display("first_name") )
27 #set( $editorLastName = $userdoc.display("last_name") )
28 #elseif ( $firstNamePar && $lastNamePar )
29 ## from the URL, "name=Firstname&surname=Lastname" parameter
30 #set( $oneEditor = true )
31 #set( $editorFirstName = $firstNamePar )
32 #set( $editorLastName = $lastNamePar )
33 #else
34 #set( $oneEditor = false )
35 #set( $editorFirstName = "" )
36 #set( $editorLastName = "" )
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 = [$lastYearEd..$firstYearEd] )
48 #if ( $firstYearPar )
49 #set( $yearFirst = $util.parseInt($firstYearPar) )
50 #if ( $yearList.contains($yearFirst) )
51 #set( $firstYearEd = $yearFirst )
52 #set( $yearList = [$lastYearEd..$firstYearEd] )
53 #end
54 #end
55 #if( $lastYearPar )
56 #set( $yearLast = $util.parseInt($lastYearPar) )
57 #if ( $yearList.contains($yearLast) )
58 #set( $lastYearEd = $yearLast )
59 #set( $yearList = [$lastYearEd..$firstYearEd] )
60 #end
61 #end
62 #if( $lastYearEd == $firstYearEd )
63 #set( $year = $lastYearEd )
64 #set( $yearList = [$year] )
65 #set( $oneYear = true )
66 #end
67 #end
68
69 #set( $editedTotal = 0 )
70
71 #### output results
72
73 <a name="top"> </a>
74
75 1 Edited volumes with IRIS ID #if($oneEditor) by $editorFirstName $editorLastName #end in the #apice() Space #if ($oneYear) ($year) #else ($firstYear&mdash;$lastYear) #end
76
77 #if (!$oneYear)
78 Below, the edited volumes with IRIS ID #if($oneEditor) edited by $editorFirstName $editorLastName #end in the #apice() Space between $firstYear and $lastYear, ordered by year of publication.
79 ----
80 <div>
81 #foreach ($year in $yearList)
82 #if ($velocityCount > 1) | #end [$year |#$year]
83 #end
84 </div>
85 ----
86 #end
87
88 #foreach ($year in $yearList)
89 #set ($sql = ", BaseObject as obj, StringProperty as prop, LongProperty as prop1, StringProperty as prop2, LargeStringProperty as prop3, StringProperty as prop4
90 where obj.name=doc.fullName and
91 obj.className='Publications.PublicationClass' and
92 obj.name<>'Publications.PublicationClassTemplate' and
93 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
94 prop.name = 'status' and
95 prop.value = 'Published' and
96 prop1.name = 'year' and
97 prop1.value = " + $year +" and
98 prop2.name = 'irisId' and
99 prop2.value <> '' and
100 prop3.name = 'author' and
101 prop3.value = '' and
102 prop4.name='editor' and
103 prop4.value like '%$editorLastName, $editorFirstName%'")
104 #set($pubFound = $xwiki.searchDocuments($sql))
105 #if ($pubFound.size()>0)
106 #set( $editedTotal = $editedTotal + $pubFound.size())
107 #if (!$oneYear)
108 <a name=$year> </a>
109 1.1 $year <em>($pubFound.size())</em>
110 #else
111 <em>($pubFound.size())</em>
112 #end
113 #foreach ($item in $pubFound)
114 #set($pubDoc=$xwiki.getDocument($item))
115 #set($pubObj=$pubDoc.getObject("Publications.PublicationClass"))
116 #set ($iris = $irisurl+$pubDoc.display('irisId') )
117 * [ $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
118
119 #end
120 <table width="100%"><tr><th align="right"><a href="#top">{pre}[{/pre}top{pre}]{/pre}</a></th></tr></table>
121 #end
122 #end
123 <div align='right'><em>\[total: $editedTotal\]</em></div>

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