Changes for page Per Status
From version 89.1
edited by Andrea Omicini
on 22/06/2023 13:00
on 22/06/2023 13:00
Change comment:
There is no comment for this version
To version 96.4
edited by Andrea Omicini
on 22/06/2023 20:14
on 22/06/2023 20:14
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -31,9 +31,11 @@ 31 31 ## HANDLE INLINE / END 32 32 ## 33 33 ## HANDLE STATUS / START 34 +#template('apice_publications.vm') 34 34 ## $oneStatus false gets a list of statuses, true just one 35 35 #set( $oneStatus = false ) 36 36 #set( $showRejected = false ) 38 +#set( $showPublished = false ) 37 37 ## $statusList gets the list of statuses to be shown 38 38 #set( $statusList = $publicationStatuses ) 39 39 ## ... ... @@ -41,12 +41,18 @@ 41 41 #if( $statusPar.toLowerCase() == "all" ) 42 42 ## 'all' value gets all unpublished papers including "Rejected" ones 43 43 #set( $showRejected = true ) 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 46 +#elseif( $statusPar.toLowerCase() == "published" ) 47 + #set( $oneStatus = true ) 48 + #set( $statusList = ["published"] ) 49 + #set( $showPublished = true ) 50 +#elseif( $statusPar.toLowerCase() == "rejected" ) 51 + #set( $oneStatus = true ) 52 + #set( $statusList = ["rejected"] ) 53 + #set( $showRejected = true ) 54 +#elseif( $publicationStatuses.contains($statusPar) ) 55 +## 'status' parameter is an admissible publication status value 56 + #set( $oneStatus = true ) 57 + #set( $statusList = [$statusPar] ) 50 50 #end 51 51 ## 52 52 ## HANDLE STATUS / END ... ... @@ -107,17 +107,18 @@ 107 107 #set( $itemNo = 0 ) 108 108 ## cycle over statuses 109 109 #foreach( $status in $statusList ) 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 <> '${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" ) 112 - #set( $itemFound = $xwiki.searchDocuments($query) ) 118 + #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected ) 119 + #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #end 120 + 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" ) 121 + #set( $itemFound = $xwiki.searchDocuments($query) ) 113 113 ## set counters 114 - #set( $itemStatusNo = $itemFound.size() ) 115 - #if( $itemStatusNo > 0 ) 116 - #set( $itemMap[$status] = $itemFound ) 117 - #set( $itemNo = $itemNo + $itemStatusNo ) 123 + #set( $itemStatusNo = $itemFound.size() ) 124 + #if( $itemStatusNo > 0 ) 125 + #set( $itemMap[$status] = $itemFound ) 126 + #set( $itemNo = $itemNo + $itemStatusNo ) 127 + #end 118 118 #end 119 119 #end 120 -$itemStatusNo 121 121 ## 122 122 ## output results 123 123 ## page subtitle ... ... @@ -126,14 +126,26 @@ 126 126 $itemNo 127 127 #if( $oneStatus ) 128 128 #if( $itemNo == 1 ) 138 + $services.localization.render('work').toLowerCase() 139 + <span class="textsecondary"> / </span> 129 129 $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase() 130 130 #else 131 -$services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end 142 + $services.localization.render('works').toLowerCase() 143 + <span class="textsecondary"> / </span> 144 + $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end 132 132 #else 133 133 #if( $itemNo == 1 ) 134 - $services.localization.render('yetunpublished_singular').toLowerCase() 147 + #if( $showPublished ) 148 + $services.localization.render('work').toLowerCase() 149 + #else 150 + $services.localization.render('yetunpublished_singular').toLowerCase() 151 + #end 135 135 #else 136 - $services.localization.render('yetunpublished').toLowerCase() 153 + #if( $showPublished ) 154 + $services.localization.render('works').toLowerCase() 155 + #else 156 + $services.localization.render('yetunpublished').toLowerCase() 157 + #end 137 137 #end 138 138 #end 139 139 #if( $oneUser ) ... ... @@ -143,9 +143,11 @@ 143 143 </div> 144 144 <div style="flex-grow: 1"> 145 145 </div> 146 - <div ">167 + <div> 147 147 <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> 169 +#if( $showPublished ) 148 148 <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> 171 +#end 149 149 </div> 150 150 </div> 151 151 ## stop if no pubs are found ... ... @@ -183,12 +183,11 @@ 183 183 #if( $showInline && !$showBibtex ) 184 184 <ul> 185 185 #foreach( $item in $itemMap[$status] ) 186 - <li>#publinked($item)</li> 187 -## <li>#pubperstatus($item)</li> 209 + <li>#pubperstatus($item)</li> 188 188 #end 189 189 </ul> 190 190 #else 191 - #foreach( $item in $itemMap[$s ort] )213 + #foreach( $item in $itemMap[$status] ) 192 192 #if( $showBibtex) 193 193 #if( $showInline ) 194 194 ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}}))) ... ... @@ -199,7 +199,7 @@ 199 199 <div style="border-style:hidden hidden hidden hidden; font-size:smaller; line-height: 1.25em; margin-bottom: .5em"> 200 200 #pubauthed($item)<br/> 201 201 #pubtitle($item)<br/> 202 - <span class="textsecondary">(#pubst atus($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}224 + <span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}} 203 203 </div> 204 204 #end 205 205 #end