Changes for page Per Status

From version 87.1
edited by Andrea Omicini
on 22/06/2023 12:58
Change comment: There is no comment for this version
To version 91.1
edited by Andrea Omicini
on 22/06/2023 13:09
Change comment: There is no comment for this version

Summary

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
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
47 47   #set( $oneStatus = true )
48 48   #set( $statusList = [$statusPar] )
49 - #end
50 50  #end
51 51  ##
52 52  ## HANDLE STATUS / END
... ... @@ -105,8 +105,9 @@
105 105  ## map & counter initialisation
106 106  #set( $itemMap = {} )
107 107  #set( $itemNo = 0 )
108 -## cycle over sorts
116 +## cycle over statuses
109 109  #foreach( $status in $statusList )
118 + #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected )
110 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 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 112   #set( $itemFound = $xwiki.searchDocuments($query) )
... ... @@ -143,8 +143,8 @@
143 143   <div style="flex-grow: 1">
144 144   </div>
145 145   <div">
146 - <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","bibtex=$showBibtex&inline=#if( $showInline )false#{else}true#end#if( $oneSort )&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>
147 - <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","inline=$showInline&bibtex=#if( $showBibtex )false#{else}true#end#if( $oneSort )&status=${statusList[0]}#end#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")'>#if( $showBibtex )text#{else}bib#end</a>
155 + <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>
156 + <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>
148 148   </div>
149 149  </div>
150 150  ## stop if no pubs are found
... ... @@ -155,7 +155,7 @@
155 155  ## some pubs found
156 156  ## page index
157 157  #if( $itemMap.keySet().size() > 1 )
158 -## found more than one sort
167 +## found more than one status
159 159  <div class="mainselectbar" id="index">
160 160   #foreach( $status in $itemMap.keySet() )
161 161   #if( !$foreach.first )
... ... @@ -168,7 +168,7 @@
168 168  ##
169 169  #template('apice_publication_macros.vm')
170 170  ##
171 -#foreach( $sort in $itemMap.keySet() )
180 +#foreach( $status in $itemMap.keySet() )
172 172  ## status top / start
173 173  <div class="mainselectseparator">
174 174   <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")>
... ... @@ -181,7 +181,7 @@
181 181  <div>
182 182   #if( $showInline && !$showBibtex )
183 183   <ul>
184 - #foreach( $item in $itemMap[$sort] )
193 + #foreach( $item in $itemMap[$status] )
185 185   <li>#publinked($item)</li>
186 186  ## <li>#pubperstatus($item)</li>
187 187   #end