Changes for page Per Status
From version 94.1
edited by Andrea Omicini
on 22/06/2023 15:13
on 22/06/2023 15:13
Change comment:
There is no comment for this version
To version 86.7
edited by Andrea Omicini
on 22/06/2023 12:35
on 22/06/2023 12:35
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -29,15 +29,11 @@ 29 29 #set( $showInline = false ) 30 30 #end 31 31 ## HANDLE INLINE / END 32 -inline $showInline 33 -bibtext $showBibtex 34 34 ## 35 35 ## HANDLE STATUS / START 36 -#template('apice_publications.vm') 37 37 ## $oneStatus false gets a list of statuses, true just one 38 38 #set( $oneStatus = false ) 39 39 #set( $showRejected = false ) 40 -#set( $showPublished = false ) 41 41 ## $statusList gets the list of statuses to be shown 42 42 #set( $statusList = $publicationStatuses ) 43 43 ## ... ... @@ -45,18 +45,12 @@ 45 45 #if( $statusPar.toLowerCase() == "all" ) 46 46 ## 'all' value gets all unpublished papers including "Rejected" ones 47 47 #set( $showRejected = true ) 48 -#elseif( $statusPar.toLowerCase() == "published" ) 49 - #set( $oneStatus = true ) 50 - #set( $statusList = ["published"] ) 51 - #set( $showPublished = true ) 52 -#elseif( $statusPar.toLowerCase() == "rejected" ) 53 - #set( $oneStatus = true ) 54 - #set( $statusList = ["rejected"] ) 55 - #set( $showRejected = true ) 56 -#elseif( $publicationStatuses.contains($statusPar) ) 57 -## 'status' parameter is an admissible publication status value 58 - #set( $oneStatus = true ) 59 - #set( $statusList = [$statusPar] ) 44 +#else 45 + #if( $publicationStatuses.contains($statusPar) ) 46 + ## 'status' parameter is an admissible publication status value 47 + #set( $oneStatus = true ) 48 + #set( $statusList = [$statusPar] ) 49 + #end 60 60 #end 61 61 ## 62 62 ## HANDLE STATUS / END ... ... @@ -115,125 +115,41 @@ 115 115 ## map & counter initialisation 116 116 #set( $itemMap = {} ) 117 117 #set( $itemNo = 0 ) 118 -## cycle over st atuses108 +## cycle over sorts 119 119 #foreach( $status in $statusList ) 120 - #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected ) 121 - #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #end 122 - where obj.name = doc.fullName and obj.className = '${objectSpace}.${objectClass}' and obj.name <> '${objectPool}.${objectTemplate}' #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" ) 123 - #set( $itemFound = $xwiki.searchDocuments($query) ) 124 -## set counters 125 - #set( $itemStatusNo = $itemFound.size() ) 126 - #if( $itemStatusNo > 0 ) 127 - #set( $itemMap[$status] = $itemFound ) 128 - #set( $itemNo = $itemNo + $itemStatusNo ) 129 - #end 110 + #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #end 111 + where obj.name = doc.fullName and obj.className = '${objectSpace}.${objectClass}' and obj.name <> '${objectSpace}.${objectTemplate}' and propAuthor.id.id = obj.id and propEditor.id.id = obj.id and propStatus.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' ) ) 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" ) 112 + #set( $pubFound = $xwiki.searchDocuments($query) ) 113 + #set( $pubStatusNo = $pubFound.size() ) 114 + #if( $pubStatusNo > 0 ) 115 + #set( $pubMap[$status] = $pubFound ) 116 + #set( $pubNo = $pubNo + $pubStatusNo ) 130 130 #end 131 131 #end 132 -## 133 133 ## output results 134 134 ## page subtitle 135 -<div style="display: flex"> 136 - <div class="mainheader"> 137 -$itemNo 138 -#if( $oneStatus ) 139 - #if( $itemNo == 1 ) 140 - $services.localization.render('work').toLowerCase() 141 - <span class="textsecondary"> / </span> 142 - $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase() 143 - #else 144 - $services.localization.render('works').toLowerCase() 145 - <span class="textsecondary"> / </span> 146 - $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end 147 -#else 148 - #if( $itemNo == 1 ) 149 - #if( $showPublished ) 150 - $services.localization.render('work').toLowerCase() 151 - #else 152 - $services.localization.render('yetunpublished_singular').toLowerCase() 153 - #end 154 - #else 155 - #if( $showPublished ) 156 - $services.localization.render('works').toLowerCase() 157 - #else 158 - $services.localization.render('yetunpublished').toLowerCase() 159 - #end 160 - #end 161 -#end 162 -#if( $oneUser ) 163 - <span class="textsecondary"> / </span> 164 - $userFirstName $userLastName 165 -#end 166 - </div> 167 - <div style="flex-grow: 1"> 168 - </div> 169 - <div"> 170 - <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> 171 - <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> 172 - </div> 173 -</div> 121 +{{id name="top"/}} 122 +>(%%)$pubNo #if( $pubNo == 1 ){{stringEngIta eng="$objectEngSingular.toLowerCase()" ita="$objectItaSingular.toLowerCase()"/}}#{else}{{stringEngIta eng="$objectEngPlural.toLowerCase()" ita="$objectItaPlural.toLowerCase()"/}}#{end} / #if( $oneStatus ){{pubStatus uppercase='false' plural='true'}}$statusPar{{/pubStatus}}#{else}{{pubStatus uppercase='false' plural='true'}}unpublished{{/pubStatus}}#{end}#if( $oneUser ) / $userFirstName $userLastName#{end}(%%) 174 174 ## stop if no pubs are found 175 -#if( $ itemNo == 0 || $itemMap.keySet().size() == 0 )124 +#if( $pubNo == 0 || $pubMap.keySet().size() == 0 ) 176 176 ## redundant double check 177 177 #stop 178 178 #end 179 179 ## some pubs found 180 180 ## page index 181 -#if( $ itemMap.keySet().size() > 1 )130 +#if( $pubMap.keySet().size() > 1 ) 182 182 ## found more than one status 183 -<div class="mainselectbar" id="index"> 184 - #foreach( $status in $itemMap.keySet() ) 185 - #if( !$foreach.first ) 186 -  •  187 - #end 188 - [[$services.localization.render("${objectSpace}.${objectClass}_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]] 189 - #end 190 -</div> 132 +{{id name="index"/}} 133 +(% style="font-size:smaller; text-align:right; padding:1em 1.5em 0.25em 1.5em; background-color:$theme.highlightColor" %)(((#foreach( $status in $pubMap.keySet() )#if( !$foreach.first ) | #end[[{{pubStatus uppercase='false' plural='true'}}$status{{/pubStatus}}>>||anchor="$status"]]#end))) 191 191 #end 192 -## 193 -#template('apice_publication_macros.vm') 194 -## 195 -#foreach( $status in $itemMap.keySet() ) 196 -## status top / start 197 -<div class="mainselectseparator"> 198 - <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")> 199 - $services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase() 200 - </a> 201 -</div> 202 -## status top / end 203 -## 204 -## status display / start 205 -<div> 206 - #if( $showInline && !$showBibtex ) 207 - <ul> 208 - #foreach( $item in $itemMap[$status] ) 209 - <li>#pubperstatus($item)</li> 210 - #end 211 - </ul> 212 - #else 213 - #foreach( $item in $itemMap[$sort] ) 214 - #if( $showBibtex) 215 - #if( $showInline ) 216 - ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}}))) 217 - #else 218 - ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}}))) 219 - #end 220 - #else 221 - <div style="border-style:hidden hidden hidden hidden; font-size:smaller; line-height: 1.25em; margin-bottom: .5em"> 222 - #pubauthed($item)<br/> 223 - #pubtitle($item)<br/> 224 - <span class="textsecondary">(#pubstatus($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}} 225 - </div> 226 - #end 227 - #end 135 +## pubs displayed per year 136 +#foreach( $status in $pubMap.keySet() ) 137 +(% style="border-style:solid hidden hidden solid; border-color:$theme.borderColor; text-align:left; font-style:oblique" %)|{{id name='$status'/}}[[{{pubStatus uppercase='false' plural='true'}}$status{{/pubStatus}}>>$doc.name||queryString='status=$status#if( $oneUser )#if( $apiceUser )&user=$userName#{else}&name=$userFirstName&surname=$userLastName#end#end']] 138 + #foreach( $pub in $pubMap[$status] ) 139 +(% style="border-style:hidden hidden hidden hidden" %)|{{pub inline='false' linked='title'}}$pub{{/pub}} 228 228 #end 229 -</div> 230 -## status display / end 231 -## 232 -## status bottom / start 233 -<div #if( $foreach.last )id="bottom"#end class="mainselectbottom"> 234 - #set( $itemStatusNo = $itemMap[$status].size() ) 235 -$itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${objectSpace}.${objectClass}_status_${status}").toLowerCase()#{else}$services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase()#end • [[{{stringEngIta eng='top' ita='in cima'/}}>>||anchor="top"]] • [[{{stringEngIta eng='index' ita='indice'/}}>>||anchor="index"]] • [[{{stringEngIta eng='bottom' ita='in fondo'/}}>>||anchor="bottom"]] 236 -</div> 141 + #set( $pubStatusNo = $pubMap[$status].size() ) 142 +(% style="border-style:hidden solid solid hidden; border-color:$theme.borderColor; text-align:right; font-style:oblique; font-size:smaller" %)|($pubStatusNo #if( $pubStatusNo == 1 ){{stringEngIta eng='publication' ita='pubblicazione'/}} {{pubStatus uppercase='false' plural='false'}}$status{{/pubStatus}}#{else}{{stringEngIta eng='publications' ita='pubblicazioni'/}} {{pubStatus uppercase='false' plural='true'}}$status{{/pubStatus}}#end) [[[{{stringEngIta eng='top' ita='in cima'/}}]>>||anchor="top"]] [[[{{stringEngIta eng='bottom' ita='in fondo'/}}]>>||anchor="bottom"]] 237 237 ## status bottom / end 238 238 #end 239 239 {{/html}}