Changes for page Per Status

From version 68.1
edited by Andrea Omicini
on 31/12/2022 02:23
Change comment: There is no comment for this version
To version 73.1
edited by Andrea Omicini
on 02/01/2023 23:59
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,48 +68,35 @@
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 = [] )
71 71  ## default: all unpublished papers except Rejected ones
72 -#set( $statusList = $statusRangeUnpublished )
73 +#set( $discard = $statusList.addAll($unpublishedStatuses) )
73 73  #if( $statusPar.toLowerCase() == "all" )
74 74  ## 'all' value gets all unpublished papers including "Rejected" ones
75 - #set($statusList = $statusRangeUnpublishedFull)
76 + #set( $discard = $statusList.add("rejected") )
76 76  #else
77 - #if( $statusRangeFull.contains($statusPar) )
78 + #if( $allStatusesPlus.contains($statusPar) )
78 78   ## 'status' parameter is an admissible publication status value
79 - #set($oneStatus = true)
80 - #set($statusList = [$statusPar])
80 + #set( $oneStatus = true )
81 + #set( $statusList = [$statusPar] )
81 81   #end
82 82  #end
83 83  ##
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 -##
85 +## query to structures
86 +#set( $pubMap = {} )
87 +#set( $pubNo = 0 )
99 99  #foreach( $status in $statusList )
100 100   #set( $from = ", BaseObject as obj, LargeStringProperty as prop0, LargeStringProperty as prop1, StringProperty as prop2" )
101 - #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'" )
90 + #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'" )
102 102   #set( $sql = $from + " where " + $where )
103 103   #set( $pubFound = $xwiki.searchDocuments($sql) )
104 104   #set( $pubStatusNo = $pubFound.size() )
105 105   #if( $pubStatusNo > 0 )
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"]]
95 + #set( $pubMap[$year] = $pubFound )
96 + #set( $pubNo = $pubNo + $pubYearNo )
113 113   #end
114 114  #end
99 +$pubMap
100 +
101 +
115 115  {{/velocity}}