Show last authors
1 {{include document='Publications.MacroSheet'/}}{{velocity}}##
2 ## publication page with menus
3 #set( $publicationMenu = true )
4 ## co-editor macro
5 #macro(coeditorFullName $trimmedEditor)#if( $trimmedEditor.contains(",") )#set( $temp = $trimmedEditor.split(","))$temp.get(1).trim() $temp.get(0).trim()#else#set( $temp = $trimmedEditor.split(" ") )$temp.get(1).trim() $temp.get(0).trim()#end
6 #end
7 #macro(coeditorFirstName $trimmedEditor)#if( $trimmedEditor.contains(",") )#set( $temp = $trimmedEditor.split(","))$temp.get(1).trim()#else#set( $temp = $trimmedEditor.split(" ") )$temp.get(0).trim()#end
8 #end
9 #macro(coeditorLastName $trimmedEditor)#if( $trimmedEditor.contains(",") )#set( $temp = $trimmedEditor.split(","))$temp.get(0).trim()#else#set( $temp = $trimmedEditor.split(" ") )$temp.get(1).trim()#end
10 #end
11 #### get parameters
12 ## who
13 #set( $userNamePar = $request.user )
14 #set( $firstNamePar = $request.name )
15 #set( $lastNamePar = $request.surname )
16 #### handle who
17 #if( $firstNamePar && $lastNamePar )
18 ## from the URL, "name=Firstname&surname=Lastname" parameter
19 #set( $oneEditor = true )
20 #set( $editorFirstName = $firstNamePar )
21 #set( $editorLastName = $lastNamePar )
22 #elseif( $userName )
23 ## from a personal page, "XWiki.PersonalSpace" $userName form
24 #set( $oneEditor = true )
25 #set( $userdoc = $xwiki.getDocument($userName) )
26 #set( $editorFirstName = $userdoc.display("first_name") )
27 #set( $editorLastName = $userdoc.display("last_name") )
28 #elseif( $userNamePar )
29 ## from the URL, "user=PersonalSpace" parameter
30 #set( $oneEditor = true)
31 #set( $userdoc = $xwiki.getDocument("XWiki.$userNamePar") )
32 #set( $editorFirstName = $userdoc.display("first_name") )
33 #set( $editorLastName = $userdoc.display("last_name") )
34 #else
35 #set( $oneEditor = false )
36 #set( $editorFirstName = "" )
37 #set( $editorLastName = "" )
38 #end
39 ## editor name hash maps
40 #set( $edFirstNameMap = $util.getHashMap() )
41 #set( $edLastNameMap = $util.getHashMap() )
42 #### query
43 #set( $sql = ", BaseObject as obj, StringProperty as prop, StringProperty as prop1, LargeStringProperty as prop2, LongProperty as prop3
44 where
45 obj.name = doc.fullName and
46 obj.className = 'Publications.PublicationClass' and
47 obj.name <> 'Publications.PublicationClassTemplate' and
48 obj.name <> 'Publications.PublicationTemplate' and
49 prop.id.id = obj.id and
50 prop.name = 'status' and
51 prop.value = 'Published' and
52 prop1.id.id = obj.id and
53 prop1.name = 'editor' and
54 prop1.value <> '' and
55 (prop1.value like '%$editorFirstName $editorLastName%' or
56 prop1.value like '%$editorLastName, $editorFirstName%') and
57 prop2.id.id = obj.id and
58 prop2.name = 'author' and
59 prop2.value = '' and
60 prop3.id.id = obj.id and
61 prop3.name = 'year'
62 order by prop3.value asc
63 " )
64 #set( $pubFound = $xwiki.searchDocuments($sql) )
65 ## editor list intialised
66 #set( $edArrayList = $util.getArrayList() )
67 ## editor-pub hash map initialised
68 #set( $edPaperMap = $util.getHashMap() )
69 ## START EACH PUB IN MAP
70 #foreach( $pub in $pubFound )
71 ## set $doc & $obj
72 #set( $pubDoc = $xwiki.getDocument($pub) )#set( $pubObj = $pubDoc.getObject("Publications.PublicationClass") )
73 ## prepare $edList for each editored pub
74 #set( $edListNoAnd = $pubObj.getProperty("editor").value.split(" (and|AND) ") )
75 ## single out individual editors for each editored pub
76 #### START / feed editor list from each pub
77 #foreach( $untrimmedEditor in $edListNoAnd )
78 #### trim editor
79 #set( $trimmedEditor = $untrimmedEditor.trim() )
80 #### build editor lists
81 #if( $edArrayList.contains(${trimmedEditor}) ) ## edArrayList already contains current editor
82 #set( $noprintvar = $edPaperMap.get(${trimmedEditor}).add($pub) ) ## adding $pub to edPaperMap for current editor
83 #elseif( $oneEditor ) ## edArrayList does not contain current editor, and we are looking for coeditors
84 #if( !( $trimmedEditor.contains($editorLastName) && $trimmedEditor.contains($editorFirstName) ) ) ## an actual coeditor
85 #set( $noprintvar = $edArrayList.add(${trimmedEditor}) ) ## add coeditor to edArrayList
86 #set( $noprintvar = $edPaperMap.put(${trimmedEditor}, $util.getArrayList()) ) ## add coeditor to edPaperMap
87 #set( $noprintvar = $edPaperMap.get(${trimmedEditor}).add($pub) ) ## adding $pub to edPaperMap for current editor
88 #end
89 #else ## edArrayList does not contain current editor, and we are indexing all editors
90 #set( $noprintvar = $edArrayList.add(${trimmedEditor}) ) ## add coeditor to edArrayList
91 #set( $noprintvar = $edPaperMap.put(${trimmedEditor}, $util.getArrayList()) ) ## add coeditor to edPaperMap
92 #set( $noprintvar = $edPaperMap.get(${trimmedEditor}).add($pub) ) ## adding $pub to edPaperMap for current editor
93 #end
94 #end
95 #### END / feed editor list from each pub
96 #end
97 ## END EACH PUB IN MAP
98 ## final values
99 ## $edArrayList
100 ## $edPaperMap
101 #set( $pubFoundNo = $pubFound.size() )
102 #set( $editorFoundNo = $edArrayList.size() )
103 #### output results
104 {{id name='top'/}}
105 >$pubFoundNo #if( $pubFoundNo == 1 ){{stringEngIta eng='publication' ita='pubblicazione'/}}#else{{stringEngIta eng='publications' ita='pubblicazioni'/}}#end / $editorFoundNo #if( $oneEditor )#if( $editorFoundNo == 1 ){{stringEngIta eng='co-editor' ita='co-curatore'/}}#else{{stringEngIta eng='co-editors' ita='co-curatori'/}}#end / $editorFirstName $editorLastName#else#if( $editorFoundNo == 1 ){{stringEngIta eng='editor' ita='autore'/}}#else{{stringEngIta eng='editors' ita='curatori'/}}#end#end
106
107 #set( $sortedEditorList = $xwiki.sort($edArrayList) )
108 ## build top index
109 (% style='font-size:smaller' %)
110 #foreach( $trimmedEditor in $sortedEditorList )#if( $velocityCount > 1 )
111 | #end[[#coeditorFirstName($trimmedEditor) **#coeditorLastName($trimmedEditor)**>>$doc||anchor='$trimmedEditor']] #end
112 (%%)
113 #foreach( $trimmedEditor in $sortedEditorList )
114 #set( $edPubList = $edPaperMap.get($trimmedEditor) )
115 #set( $edPubNo = $edPubList.size() )
116 |{{id name='$trimmedEditor'/}}(((
117 (% style='font-style:oblique;align:left' %)#coeditorFirstName($trimmedEditor)(%%)
118 (% style='font-style:oblique;font-weight:bold;align:left' %)[[#coeditorLastName($trimmedEditor)>>Publications.EditorIndex||queryString='name=#coeditorFirstName($trimmedEditor)&surname=#coeditorLastName($trimmedEditor)']](%%)
119 )))|(% style="text-align:right;vertical-align:top" %)(((
120 #foreach( $editorPub in $edPubList )#if( $velocityCount >1 ) | #end#pubTitleLink($editorPub)#end
121 )))(%%)
122
123 (% style='font-style:oblique;font-size:smaller;text-align:right;color:gray;margin-top:-2em' %)(((($edPubNo) [ [[{{stringEngIta eng='top' ita='in cima'}}>>||anchor='top']] ][ [[{{stringEngIta eng='bottom' ita='in fondo'}}>>||anchor='bottom']] ])))(%%)
124 #end
125 {{id name='bottom'/}}
126 {{/velocity}}

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