Changes for page Per Status

From version 76.1
edited by Andrea Omicini
on 03/01/2023 00:02
Change comment: There is no comment for this version
To version 69.1
edited by Andrea Omicini
on 31/12/2022 02:24
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -9,7 +9,7 @@
9 9  #set( $firstNamePar = $request.name.trim() )
10 10  #set( $lastNamePar = $request.surname.trim() )
11 11  ## which status
12 -#set( $statusPar = $request.status.trim() )
12 +#set($statusPar = $request.status.trim())
13 13  ##
14 14  #### handle who
15 15  #if( $userName )
... ... @@ -61,7 +61,7 @@
61 61   #set( $userString = "%$userFirstName $userLastName%" )
62 62   #end
63 63  #else
64 - #set( $userString = "%%" )
64 + #set( $userString = "" )
65 65  #end
66 66  ##
67 67  #### handle status
... ... @@ -68,39 +68,48 @@
68 68  ## $oneStatus false gets a list of statuses, true just one
69 69  #set( $oneStatus = false )
70 70  ## $statusList gets the list of statuses to be shown
71 -#set( $statusList = [] )
72 72  ## default: all unpublished papers except Rejected ones
73 -#set( $discard = $statusList.addAll($unpublishedStatuses) )
72 +#set( $statusList = $statusRangeUnpublished )
74 74  #if( $statusPar.toLowerCase() == "all" )
75 75  ## 'all' value gets all unpublished papers including "Rejected" ones
76 - #set( $discard = $statusList.add("rejected") )
75 + #set($statusList = $statusRangeUnpublishedFull)
77 77  #else
78 - #if( $allStatusesPlus.contains($statusPar) )
77 + #if( $statusRangeFull.contains($statusPar) )
79 79   ## 'status' parameter is an admissible publication status value
80 - #set( $oneStatus = true )
81 - #set( $statusList = [$statusPar] )
79 + #set($oneStatus = true)
80 + #set($statusList = [$statusPar])
82 82   #end
83 83  #end
84 -$statusList
85 85  ##
86 -## query to structures
87 -#set( $pubMap = {} )
88 -#set( $pubNo = 0 )
84 +{{id name="top"/}}
85 +#if( $oneUser )#if( $oneStatus )
86 +>**{{pubStatus uppercase='true' plural='true'}}$statusPar{{/pubStatus}}** / $userFirstName $userLastName
87 +#else
88 +>**{{pubStatus uppercase='true' plural='true'}}unpublished{{/pubStatus}}** / $userFirstName $userLastName
89 +#end#elseif($oneStatus)
90 +>{{pubStatus uppercase='true' plural='true'}}$statusPar{{/pubStatus}}
91 +#else
92 +>{{pubStatus uppercase='true' plural='true'}}unpublished{{/pubStatus}}
93 +#end
94 +##
95 +#if( !$oneStatus )
96 +(% style="font-size: smaller; padding:1em 1.5em 0.25em 1.5em; background-color:$theme.highlightColor" %)(((#foreach( $status in $statusList )#if( $foreach.index > 0 ) | #end[[{{pubStatus}}$status{{/pubStatus}}>>||anchor=$status]]#end)))
97 +#end
98 +##
89 89  #foreach( $status in $statusList )
90 -$status
91 91   #set( $from = ", BaseObject as obj, LargeStringProperty as prop0, LargeStringProperty as prop1, StringProperty as prop2" )
92 92   #set( $where = "obj.name = doc.fullName and obj.className = '${objectSpace}.${objectClass}' and obj.name <> '${objectSpace}.${objectTemplate}' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop2.id.id = obj.id and prop0.name = 'author' and prop1.name = 'editor' and ( prop0.value like '$userString' or ( prop0.value = '' and prop1.value like '$userString' ) ) and prop2.name = 'status' and prop2.value = '$status'" )
93 93   #set( $sql = $from + " where " + $where )
94 94   #set( $pubFound = $xwiki.searchDocuments($sql) )
95 95   #set( $pubStatusNo = $pubFound.size() )
96 -$pubFound
97 -$pubFound.size()
98 98   #if( $pubStatusNo > 0 )
99 - #set( $pubMap[$status] = $pubFound )
100 - #set( $pubNo = $pubNo + $pubStatusNo )
106 + #if( !$oneStatus )
107 +(% style="border-style:solid hidden hidden solid; border-color:$theme.borderColor; text-align:left; font-style:oblique" %)|{{id name='$sort'/}}{{pubStatus plural='true' uppercase='true'}}$status{{/pubStatus}}{{id name="$status"/}}
108 + #end
109 + #foreach( $pub in $pubFound )#if( $xwiki.exists($pub) )#set( $pubDoc = $xwiki.getDocument($pub) )#if( $pubDoc.getObject("${objectSpace}.${objectClass}") )## handling visibility at show time
110 +|{{pub inline='false' linked='title'}}$pub{{/pub}}
111 + #end#end#end
112 +(% style="#if( !$oneStatus )border-style:hidden solid solid hidden;#end border-color:$theme.borderColor; text-align:right; font-style:oblique; font-weight:normal; font-size:smaller; color:gray" %)|($pubStatusNo #if( $pubStatusNo > 1 ){{pubStatus plural='true'}}$status{{/pubStatus}}#else{{pubStatus plural='false'}}$status{{/pubStatus}}#end) [[[top]>>||anchor="top"]]
101 101   #end
102 102  #end
103 -$pubMap
104 -
105 -
106 106  {{/velocity}}