Changes for page Per Status

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

Summary

Details

Page properties
Content
... ... @@ -31,11 +31,9 @@
31 31  ## HANDLE INLINE / END
32 32  ##
33 33  ## HANDLE STATUS / START
34 -#template('apice_publications.vm')
35 35  ## $oneStatus false gets a list of statuses, true just one
36 36  #set( $oneStatus = false )
37 37  #set( $showRejected = false )
38 -#set( $showPublished = false )
39 39  ## $statusList gets the list of statuses to be shown
40 40  #set( $statusList = $publicationStatuses )
41 41  ##
... ... @@ -43,18 +43,12 @@
43 43  #if( $statusPar.toLowerCase() == "all" )
44 44  ## 'all' value gets all unpublished papers including "Rejected" ones
45 45   #set( $showRejected = true )
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] )
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
58 58  #end
59 59  ##
60 60  ## HANDLE STATUS / END
... ... @@ -113,18 +113,16 @@
113 113  ## map & counter initialisation
114 114  #set( $itemMap = {} )
115 115  #set( $itemNo = 0 )
116 -## cycle over statuses
108 +## cycle over sorts
117 117  #foreach( $status in $statusList )
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) )
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) )
122 122  ## set counters
123 - #set( $itemStatusNo = $itemFound.size() )
124 - #if( $itemStatusNo > 0 )
125 - #set( $itemMap[$status] = $itemFound )
126 - #set( $itemNo = $itemNo + $itemStatusNo )
127 - #end
114 + #set( $itemStatusNo = $itemFound.size() )
115 + #if( $itemStatusNo > 0 )
116 + #set( $itemMap[$status] = $itemFound )
117 + #set( $itemNo = $itemNo + $itemStatusNo )
128 128   #end
129 129  #end
130 130  ##
... ... @@ -153,8 +153,8 @@
153 153   <div style="flex-grow: 1">
154 154   </div>
155 155   <div">
156 - <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>
157 - <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>
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>
158 158   </div>
159 159  </div>
160 160  ## stop if no pubs are found
... ... @@ -165,7 +165,7 @@
165 165  ## some pubs found
166 166  ## page index
167 167  #if( $itemMap.keySet().size() > 1 )
168 -## found more than one status
158 +## found more than one sort
169 169  <div class="mainselectbar" id="index">
170 170   #foreach( $status in $itemMap.keySet() )
171 171   #if( !$foreach.first )
... ... @@ -178,7 +178,7 @@
178 178  ##
179 179  #template('apice_publication_macros.vm')
180 180  ##
181 -#foreach( $status in $itemMap.keySet() )
171 +#foreach( $sort in $itemMap.keySet() )
182 182  ## status top / start
183 183  <div class="mainselectseparator">
184 184   <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")>
... ... @@ -191,7 +191,7 @@
191 191  <div>
192 192   #if( $showInline && !$showBibtex )
193 193   <ul>
194 - #foreach( $item in $itemMap[$status] )
184 + #foreach( $item in $itemMap[$sort] )
195 195   <li>#publinked($item)</li>
196 196  ## <li>#pubperstatus($item)</li>
197 197   #end