Changes for page Per Status

From version 101.2
edited by Andrea Omicini
on 11/07/2023 17:07
Change comment: There is no comment for this version
To version 96.4
edited by Andrea Omicini
on 22/06/2023 20:14
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,10 +1,18 @@
1 1  {{velocity}}
2 -{{html clean="false" wiki="true"}}
3 -#template('apice_macros.vm')
4 -#setobjectspace("Publications")
5 -## BIBTEX / START
2 +{{html wiki="true" clean="false"}}
3 +## GET PARAMETERS / START
4 +## inline display
5 +#set( $inlinePar = $request.inline.trim().toLowerCase() )
6 6  ## show BibTeX
7 7  #set( $bibtexPar = $request.bibtex.trim().toLowerCase() )
8 +## who
9 +#set( $userNamePar = $request.user.trim() )
10 +#set( $firstNamePar = $request.name.trim() )
11 +#set( $lastNamePar = $request.surname.trim() )
12 +## GET PARAMETERS / END
13 +##
14 +#template('apice_boolean.vm')
15 +## HANDLE BIBTEX / START
8 8  ## default: false
9 9  #set( $showBibtex = false )
10 10  ## check $bibtexPar
... ... @@ -11,11 +11,9 @@
11 11  #if( $bibtexPar != "" && $trueStringList.contains($bibtexPar.toLowerCase()) )
12 12   #set( $showBibtex = true )
13 13  #end
14 -## BIBTEX / END
22 +## HANDLE BIBTEX / END
15 15  ##
16 -## INLINE / START
17 -## inline display
18 -#set( $inlinePar = $request.inline.trim().toLowerCase() )
24 +## HANDLE INLINE / START
19 19  ## default: true
20 20  #set( $showInline = true )
21 21  ## check $inlinePar
... ... @@ -22,10 +22,10 @@
22 22  #if( $inlinePar != "" && $falseStringList.contains($inlinePar) )
23 23   #set( $showInline = false )
24 24  #end
25 -## INLINE / END
26 -#template('apice_user_param.vm')
31 +## HANDLE INLINE / END
27 27  ##
28 -## STATUS / START
33 +## HANDLE STATUS / START
34 +#template('apice_publications.vm')
29 29  ## $oneStatus false gets a list of statuses, true just one
30 30  #set( $oneStatus = false )
31 31  #set( $showRejected = false )
... ... @@ -51,9 +51,60 @@
51 51   #set( $statusList = [$statusPar] )
52 52  #end
53 53  ##
54 -## STATUS / END
60 +## HANDLE STATUS / END
61 +## HANDLE WHO / START
62 +#template('apice_macros.vm')
63 +#isuserspace()
64 +#if( $isUserSpace )
65 + #userspace()
66 +## from a personal page
67 + #set( $apiceUser = true )
68 + #set( $oneUser = true )
69 +#elseif( $userNamePar )
70 +## from the URL, "user=$userNamePar" parameter
71 + #if( $userNamePar.contains('XWiki.') )
72 + #set( $userName = "$userNamePar" )
73 + #else
74 + #set( $userName = "XWiki.$userNamePar" )
75 + #end
76 + #if( !$xwiki.exists( $userName ) )
77 + #if( $services.localization.currentLocale == 'it' )
78 +{{warning}}L'utente “$userNamePar” non esiste{{/warning}}
79 + #else
80 +{{warning}}User “$userNamePar” does not exist{{/warning}}
81 + #end
82 + #stop
83 + #end
84 + #set( $apiceUser = true )
85 + #set( $oneUser = true)
86 + #set( $userdoc = $xwiki.getDocument($userName) )
87 + #set( $userFirstName = $userdoc.display("first_name") )
88 + #set( $userLastName = $userdoc.display("last_name") )
89 +#elseif( $firstNamePar && $lastNamePar )
90 +## from the URL, "name=Firstname&surname=Lastname" parameter
91 + #set( $apiceUser = false )
92 + #set( $oneUser = true )
93 + #set( $userFirstName = $firstNamePar )
94 + #set( $userLastName = $lastNamePar )
95 +#else
96 + #set( $apiceUser = false )
97 + #set( $oneUser = false )
98 + #set( $userFirstName = "" )
99 + #set( $userLastName = "" )
100 +#end
101 +#if( $oneUser )
102 + #if( $apiceUser )
103 + #set( $userString = "%$userName%" )
104 + #else
105 + #set( $userString = "%$userFirstName $userLastName%" )
106 + #end
107 +#else
108 + #set( $userString = "%%" )
109 +#end
110 +## HANDLE WHO / END
55 55  ##
56 -## DATA STRUCTURES / START
112 +### query to structures
113 +## map & counter initialisation
57 57  #set( $itemMap = {} )
58 58  #set( $itemNo = 0 )
59 59  ## cycle over statuses
... ... @@ -60,7 +60,7 @@
60 60  #foreach( $status in $statusList )
61 61   #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected )
62 62   #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #end
63 - where obj.name = doc.fullName and obj.className = '${mainSpace}.Class' and obj.name <> '${objectPool}.Template' #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" )
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" )
64 64   #set( $itemFound = $xwiki.searchDocuments($query) )
65 65  ## set counters
66 66   #set( $itemStatusNo = $itemFound.size() )
... ... @@ -70,9 +70,8 @@
70 70   #end
71 71   #end
72 72  #end
73 -## DATA STRUCTURES / END
74 74  ##
75 -## DISPLAY / START
131 +## output results
76 76  ## page subtitle
77 77  <div style="display: flex">
78 78   <div class="mainheader">
... ... @@ -81,11 +81,11 @@
81 81   #if( $itemNo == 1 )
82 82   $services.localization.render('work').toLowerCase()
83 83   <span class="textsecondary">&ensp;/&ensp;</span>
84 - $services.localization.render("${mainSpace}.Class_status_${statusList[0]}").toLowerCase()
140 + $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase()
85 85   #else
86 86   $services.localization.render('works').toLowerCase()
87 87   <span class="textsecondary">&ensp;/&ensp;</span>
88 - $services.localization.render("${mainSpace}.Class_status_${statusList[0]}_plural").toLowerCase() #end
144 + $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end
89 89  #else
90 90   #if( $itemNo == 1 )
91 91   #if( $showPublished )
... ... @@ -129,7 +129,7 @@
129 129   #if( !$foreach.first )
130 130   &ensp;&bull;&ensp;
131 131   #end
132 - [[$services.localization.render("${mainSpace}.Class_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]]
188 + [[$services.localization.render("${objectSpace}.${objectClass}_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]]
133 133   #end
134 134  </div>
135 135  #end
... ... @@ -139,8 +139,8 @@
139 139  #foreach( $status in $itemMap.keySet() )
140 140  ## status top / start
141 141  <div class="mainselectseparator">
142 - <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status&bibtex=$showBibtex&inline=$showInline#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")>
143 - $services.localization.render("${mainSpace}.Class_status_${status}_plural").toLowerCase()
198 + <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")>
199 + $services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase()
144 144   </a>
145 145  </div>
146 146  ## status top / end
... ... @@ -162,10 +162,10 @@
162 162   ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}})))
163 163   #end
164 164   #else
165 - <div style="border-style: hidden hidden hidden hidden; font-size: smaller; line-height: 1.25em; margin: .75em 0 .75em 0">
166 - <div style="margin: 0 0 0 0">#pubauthed($item)</div>
167 - <div style="margin: 0 0 0 0">#pubtitle($item)</div>
168 - <div style="margin: 0 0 0 0"><span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}</div>
221 + <div style="border-style:hidden hidden hidden hidden; font-size:smaller; line-height: 1.25em; margin-bottom: .5em">
222 + #pubauthed($item)<br/>
223 + #pubtitle($item)<br/>
224 + <span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}
169 169   </div>
170 170   #end
171 171   #end
... ... @@ -176,10 +176,9 @@
176 176  ## status bottom / start
177 177  <div #if( $foreach.last )id="bottom"#end class="mainselectbottom">
178 178   #set( $itemStatusNo = $itemMap[$status].size() )
179 -$itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${mainSpace}.Class_status_${status}").toLowerCase()#{else}$services.localization.render("${mainSpace}.Class_status_${status}_plural").toLowerCase()#end &bull; #anchorlinks()
235 +$itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${objectSpace}.${objectClass}_status_${status}").toLowerCase()#{else}$services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase()#end &bull; [[{{stringEngIta eng='top' ita='in cima'/}}>>||anchor="top"]] &bull; [[{{stringEngIta eng='index' ita='indice'/}}>>||anchor="index"]] &bull; [[{{stringEngIta eng='bottom' ita='in fondo'/}}>>||anchor="bottom"]]
180 180  </div>
181 181  ## status bottom / end
182 182  #end
183 -## DISPLAY / END
184 184  {{/html}}
185 185  {{/velocity}}{{pageDisplay sort="objectservice"/}}