Changes for page Per Status

From version 89.1
edited by Andrea Omicini
on 22/06/2023 13:00
Change comment: There is no comment for this version
To version 94.2
edited by Andrea Omicini
on 22/06/2023 15:14
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -29,11 +29,15 @@
29 29   #set( $showInline = false )
30 30  #end
31 31  ## HANDLE INLINE / END
32 +inline $showInline
33 +bibtext $showBibtex
32 32  ##
33 33  ## HANDLE STATUS / START
36 +#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 )
40 +#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
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] )
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) )
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) )
113 113  ## set counters
114 - #set( $itemStatusNo = $itemFound.size() )
115 - #if( $itemStatusNo > 0 )
116 - #set( $itemMap[$status] = $itemFound )
117 - #set( $itemNo = $itemNo + $itemStatusNo )
125 + #set( $itemStatusNo = $itemFound.size() )
126 + #if( $itemStatusNo > 0 )
127 + #set( $itemMap[$status] = $itemFound )
128 + #set( $itemNo = $itemNo + $itemStatusNo )
129 + #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 )
140 + $services.localization.render('work').toLowerCase()
141 + <span class="textsecondary">&ensp;/&ensp;</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
144 + $services.localization.render('works').toLowerCase()
145 + <span class="textsecondary">&ensp;/&ensp;</span>
146 + $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()
149 + #if( $showPublished )
150 + $services.localization.render('work').toLowerCase()
151 + #else
152 + $services.localization.render('yetunpublished_singular').toLowerCase()
153 + #end
135 135   #else
136 - $services.localization.render('yetunpublished').toLowerCase()
155 + #if( $showPublished )
156 + $services.localization.render('works').toLowerCase()
157 + #else
158 + $services.localization.render('yetunpublished').toLowerCase()
159 + #end
137 137   #end
138 138  #end
139 139  #if( $oneUser )
... ... @@ -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[$sort] )
213 + #foreach( $item in $itemMap[$status] )
192 192   #if( $showBibtex)
193 193   #if( $showInline )
194 194   ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}})))