Wiki source code of Per Status

Show last authors
1 {{velocity}}
2 {{html clean="false" wiki="true"}}
3 #template('apice_macros.vm')
4 #setobjectspace("Publications")
5 ## BIBTEX / START
6 ## show BibTeX
7 #set( $bibtexPar = $request.bibtex.trim().toLowerCase() )
8 ## default: false
9 #set( $showBibtex = false )
10 ## check $bibtexPar
11 #if( $bibtexPar != "" && $trueStringList.contains($bibtexPar.toLowerCase()) )
12 #set( $showBibtex = true )
13 #end
14 ## BIBTEX / END
15 ##
16 ## INLINE / START
17 ## inline display
18 #set( $inlinePar = $request.inline.trim().toLowerCase() )
19 ## default: true
20 #set( $showInline = true )
21 ## check $inlinePar
22 #if( $inlinePar != "" && $falseStringList.contains($inlinePar) )
23 #set( $showInline = false )
24 #end
25 ## INLINE / END
26 #template('apice_user_param.vm')
27 ##
28 ## STATUS / START
29 ## $oneStatus false gets a list of statuses, true just one
30 #set( $oneStatus = false )
31 #set( $showRejected = false )
32 #set( $showPublished = false )
33 ## $statusList gets the list of statuses to be shown
34 #set( $statusList = $publicationStatuses )
35 ##
36 #set( $statusPar = $request.status.trim() )
37 #if( $statusPar.toLowerCase() == "all" )
38 ## 'all' value gets all unpublished papers including "Rejected" ones
39 #set( $showRejected = true )
40 #elseif( $statusPar.toLowerCase() == "published" )
41 #set( $oneStatus = true )
42 #set( $statusList = ["published"] )
43 #set( $showPublished = true )
44 #elseif( $statusPar.toLowerCase() == "rejected" )
45 #set( $oneStatus = true )
46 #set( $statusList = ["rejected"] )
47 #set( $showRejected = true )
48 #elseif( $publicationStatuses.contains($statusPar) )
49 ## 'status' parameter is an admissible publication status value
50 #set( $oneStatus = true )
51 #set( $statusList = [$statusPar] )
52 #end
53 ##
54 ## STATUS / END
55 ##
56 ## DATA STRUCTURES / START
57 #set( $itemMap = {} )
58 #set( $itemNo = 0 )
59 ## cycle over statuses
60 #foreach( $status in $statusList )
61 #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected )
62 #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #end
63 where obj.name = doc.fullName and obj.className = '${mainSpace}.Class' and obj.name <> '${objectPool}.Template' #if( $oneUser ) and propAuthor.id.id = obj.id and propEditor.id.id = obj.id and propAuthor.name = 'author' and propEditor.name = 'editor' and ( propAuthor.value like '$userString' or ( propAuthor.value = '' and propEditor.value like '$userString' ) ) #end and propStatus.id.id = obj.id and propStatus.name = 'status' and propStatus.value = '$status' #if( !$hasEdit ) and propAccess.id.id = obj.id and propAccess.name = 'access' and propAccess.value <> 'hidden' #end" )
64 #set( $itemFound = $xwiki.searchDocuments($query) )
65 ## set counters
66 #set( $itemStatusNo = $itemFound.size() )
67 #if( $itemStatusNo > 0 )
68 #set( $itemMap[$status] = $itemFound )
69 #set( $itemNo = $itemNo + $itemStatusNo )
70 #end
71 #end
72 #end
73 ## DATA STRUCTURES / END
74 ##
75 ## DISPLAY / START
76 ## page subtitle
77 <div style="display: flex">
78 <div class="mainheader">
79 $itemNo
80 #if( $oneStatus )
81 #if( $itemNo == 1 )
82 $services.localization.render('work').toLowerCase()
83 <span class="textsecondary">&ensp;/&ensp;</span>
84 $services.localization.render("${mainSpace}.Class_status_${statusList[0]}").toLowerCase()
85 #else
86 $services.localization.render('works').toLowerCase()
87 <span class="textsecondary">&ensp;/&ensp;</span>
88 $services.localization.render("${mainSpace}.Class_status_${statusList[0]}_plural").toLowerCase() #end
89 #else
90 #if( $itemNo == 1 )
91 #if( $showPublished )
92 $services.localization.render('work').toLowerCase()
93 #else
94 $services.localization.render('yetunpublished_singular').toLowerCase()
95 #end
96 #else
97 #if( $showPublished )
98 $services.localization.render('works').toLowerCase()
99 #else
100 $services.localization.render('yetunpublished').toLowerCase()
101 #end
102 #end
103 #end
104 #if( $oneUser )
105 <span class="textsecondary">&ensp;/&ensp;</span>
106 $userFirstName $userLastName
107 #end
108 </div>
109 <div style="flex-grow: 1">
110 </div>
111 <div>
112 <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","bibtex=$showBibtex&inline=#if( $showInline )false#{else}true#end#if( $oneStatus )&status=${statusList[0]}#end#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")'>#if( $showBibtex )#if( $showInline )formatted#{else}plain#end#else#if( $showInline )long#{else}short#end#end</a>
113 #if( $showPublished )
114 <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","inline=$showInline&bibtex=#if( $showBibtex )false#{else}true#end#if( $oneStatus )&status=${statusList[0]}#end#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")'>#if( $showBibtex )text#{else}bib#end</a>
115 #end
116 </div>
117 </div>
118 ## stop if no pubs are found
119 #if( $itemNo == 0 || $itemMap.keySet().size() == 0 )
120 ## redundant double check
121 #stop
122 #end
123 ## some pubs found
124 ## page index
125 #if( $itemMap.keySet().size() > 1 )
126 ## found more than one status
127 <div class="mainselectbar" id="index">
128 #foreach( $status in $itemMap.keySet() )
129 #if( !$foreach.first )
130 &ensp;&bull;&ensp;
131 #end
132 [[$services.localization.render("${mainSpace}.Class_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]]
133 #end
134 </div>
135 #end
136 ##
137 #template('apice_publication_macros.vm')
138 ##
139 #foreach( $status in $itemMap.keySet() )
140 ## status top / start
141 <div class="mainselectseparator">
142 <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status&bibtex=$showBibtex&inline=$showInline#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")>
143 $services.localization.render("${mainSpace}.Class_status_${status}_plural").toLowerCase()
144 </a>
145 </div>
146 ## status top / end
147 ##
148 ## status display / start
149 <div>
150 #if( $showInline && !$showBibtex )
151 <ul>
152 #foreach( $item in $itemMap[$status] )
153 <li>#pubperstatus($item)</li>
154 #end
155 </ul>
156 #else
157 #foreach( $item in $itemMap[$status] )
158 #if( $showBibtex)
159 #if( $showInline )
160 ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}})))
161 #else
162 ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}})))
163 #end
164 #else
165 <div style="border-style: hidden hidden hidden hidden; font-size: smaller; line-height: 1.25em; margin: .75em 0 .75em 0">
166 <div style="margin: 0 0 0 0">#pubauthed($item)</div>
167 <div style="margin: 0 0 0 0">#pubtitle($item)</div>
168 <div style="margin: 0 0 0 0"><span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}</div>
169 </div>
170 #end
171 #end
172 #end
173 </div>
174 ## status display / end
175 ##
176 ## status bottom / start
177 <div #if( $foreach.last )id="bottom"#end class="mainselectbottom">
178 #set( $itemStatusNo = $itemMap[$status].size() )
179 $itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${mainSpace}.Class_status_${status}").toLowerCase()#{else}$services.localization.render("${mainSpace}.Class_status_${status}_plural").toLowerCase()#end &bull; #anchorlinks()
180 </div>
181 ## status bottom / end
182 #end
183 ## DISPLAY / END
184 {{/html}}
185 {{/velocity}}{{pageDisplay sort="objectservice"/}}