Show last authors
1 #includeMacros("Main.MacroSheet")
2 #includeMacros("Publications.MacroSheet")
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
10 #### handle who
11 #if ( $userName )
12 ## from a personal page, "XWiki.PersonalSpace" $userName form
13 #set( $oneAuthor = true )
14 #set( $userdoc = $xwiki.getDocument($userName) )
15 #set( $authorFirstName = $userdoc.display("first_name") )
16 #set( $authorLastName = $userdoc.display("last_name") )
17 #elseif ( $userNamePar )
18 ## from the URL, "user=PersonalSpace" parameter
19 #set( $oneAuthor = true)
20 #set( $userdoc = $xwiki.getDocument("XWiki.$userNamePar") )
21 #set( $authorFirstName = $userdoc.display("first_name") )
22 #set( $authorLastName = $userdoc.display("last_name") )
23 #elseif ( $firstNamePar && $lastNamePar )
24 ## from the URL, "name=Firstname&surname=Lastname" parameter
25 #set( $oneAuthor = true )
26 #set( $authorFirstName = $firstNamePar )
27 #set( $authorLastName = $lastNamePar )
28 #else
29 #set( $oneAuthor = false )
30 #set( $authorFirstName = "" )
31 #set( $authorLastName = "" )
32 #end
33
34 <a name="top"> </a>
35
36 #if($oneAuthor)
37 1 $authorFirstName $authorLastName's Journal & Series Index
38 #else
39 1 Journal & Series Index
40 #end
41
42 #set ($sql = ", BaseObject as obj, LargeStringProperty as prop, StringProperty as prop1
43 where
44 obj.name=doc.fullName and
45 obj.className='Publications.PublicationClass' and
46 obj.name<>'Publications.PublicationClassTemplate' and
47 prop.id.id=obj.id and
48 prop1.id.id=obj.id and
49 prop.name='author' and
50 prop1.name='status' and
51 prop1.value='Published' and
52 (prop.value like '%$authorFirstName $authorLastName%' or
53 prop.value like '%$authorLastName, $authorFirstName%')
54 ")
55
56 #set($journalMap = $xwiki.getHashMap())
57 #set($journalArrayList = $xwiki.getArrayList())
58 #set($letterMap = $xwiki.getHashMap())
59 #set($journalPubs = 0)
60 #foreach ($pub in $xwiki.searchDocuments($sql))
61 #set($pubDoc=$xwiki.getDocument($pub))
62 #set($pubObj=$pubDoc.getObject("Publications.PublicationClass"))
63 #if ($pubObj.journal != "" || $pubObj.series != "")
64 #set($journalPubs =$journalPubs + 1)
65 #if ($pubObj.journal != "")
66 #set($journal = $pubObj.journal.trim())
67 #else
68 #set($journal = $pubObj.series.trim())
69 #end
70 #### build the journal list
71 #if (!$journalArrayList.contains($journal))
72 #set($noprintvar = $journalArrayList.add($journal))
73 #end
74 #### build the journal hash table
75 #if (!$journalMap.get($journal))
76 $!journalMap.put($journal, $xwiki.getArrayList())
77 #end
78 #set($noprintvar = $journalMap.get($journal).add($pub))
79 #### build the per-letter hash tables
80 #set($firstLetter = $journal.substring(0,1).toUpperCase())
81 #if (!$letterMap.get($firstLetter))
82 $!letterMap.put($firstLetter, true)
83 #end
84 #end
85 #end
86
87 #set($journalNo=$journalArrayList.size())
88
89 #if ($journalNo > 0 )
90 The following page indexes #if($oneAuthor) $authorFirstName $authorLastName's #end publications in the #apice() space ~~by journal & series~~.
91 Currently, the #apice() space contains $journalPubs #if($oneAuthor) $authorFirstName $authorLastName's publications #else items published #end on *$journalNo* journals and series.
92 #else
93 Currently, the #apice() space contains no #if($oneAuthor) $authorFirstName $authorLastName's publications #else items published #end on either journals or series.
94 #end
95
96 #set($sortedJournalList=$xwiki.sort($journalArrayList))
97
98 ----
99 <div>
100 #foreach ($firstLetter in ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"])
101 #if ($velocityCount > 1) | #end
102 #if ($letterMap.get($firstLetter))
103 <a href="#$firstLetter">$firstLetter</a>
104 #else
105 $firstLetter
106 #end
107 #end
108 </div>
109 ----
110 <table width="100%">
111 #foreach ($journal in $sortedJournalList)
112 #set($firstLetter = $journal.substring(0,1).toUpperCase())
113 #if ($letterMap.get($firstLetter))
114 #set($noprintvar = $letterMap.put($firstLetter,false))
115 <tr><th align="left" ><a name="$firstLetter"> $firstLetter </a></th><th align="right"><a href="#top">{pre}[{/pre}top{pre}]{/pre}</a></th></tr>
116 #end
117 #set($journalPubList = $journalMap.get($journal))
118 #set($sortedJournalPubList = $xwiki.sort($journalPubList))
119 <tr valign="top"><td> $journal </td><td>#foreach ($pubjournal in $sortedJournalPubList) #if ($velocityCount > 1) <br/> #end [$xwiki.getDocument($pubjournal).display('title')>$pubjournal] #end</td></tr>
120 #end
121 </table>

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