Changes for page Per Sort

From version 36.1
edited by Andrea Omicini
on 11/07/2023 17:04
Change comment: There is no comment for this version
To version 37.1
edited by Andrea Omicini
on 11/01/2024 23:17
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,164 +1,1 @@
1 -{{velocity}}
2 -{{html clean="false" wiki="true"}}
3 -#template('apice_macros.vm')
4 -#setobjectspace("Publications")
5 -## BIBTEX / START
6 -## show BibTeX
7 -#set( $bibtexPar = $request.bibtex.trim().toLowerCase() )
8 -## default: false
9 -#set( $showBibtex = false )
10 -## check $bibtexPar
11 -#if( $bibtexPar != "" && $trueStringList.contains($bibtexPar.toLowerCase()) )
12 - #set( $showBibtex = true )
13 -#end
14 -## BIBTEX / END
15 -##
16 -## INLINE / START
17 -## inline display
18 -#set( $inlinePar = $request.inline.trim().toLowerCase() )
19 -## default: true
20 -#set( $showInline = true )
21 -## check $inlinePar
22 -#if( $inlinePar != "" && $falseStringList.contains($inlinePar) )
23 - #set( $showInline = false )
24 -#end
25 -## INLINE / END
26 -#template('apice_user_param.vm')
27 -## SORT / START
28 -## $sortList gets the list of sorts to be shown
29 -## $oneSort true if just one sort to be shown
30 -#set( $sortList = $publicationSorts )
31 -#set( $oneSort = false )
32 -##
33 -#if( $request.sort && $request.sort.trim() != "" )
34 - #set( $sortPar = $request.sort.trim().toLowerCase() )
35 - #if( $publicationSorts.contains($sortPar) )
36 -## 'sort' parameter is an admissible publication sort value
37 - #set( $sortList = [$sortPar])
38 - #set( $oneSort = true )
39 - #else
40 -## 'sort' parameter is not an admissible publication sort value
41 -{{warning}}$sortPar is not an admissible sort for APICE publications{{/warning}}
42 - #stop
43 - #end
44 -#end
45 -## INVARIANT: $oneSort and $sortList are correctly and coherently initialised
46 -## SORT / END
47 -##
48 -## DATA STRUCTURES / START
49 -#set( $itemMap = {} )
50 -#set( $itemNo = 0 )
51 -## cycle over sorts
52 -#foreach( $sort in $sortList )
53 -## set query
54 - #set( $query = ", BaseObject as obj, StringProperty as propStatus, DateProperty as propYear, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propSort #if( !$hasEdit ), StringProperty as propAccess #end
55 - where obj.name = doc.fullName and obj.className = '${mainSpace}.Class' and obj.name <> '${objectPool}.Template' and propStatus.id.id = obj.id and propYear.id.id = obj.id and propSort.id.id = obj.id and propStatus.name = 'status' and propYear.name = 'year' #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 lower(propStatus.value) = 'published' and propSort.name = 'sort' and lower(propSort.value) = '$sort' #if( !$hasEdit ) and propAccess.id.id = obj.id and propAccess.name = 'access' and propAccess.value <> 'hidden' #end order by propYear.value desc" )
56 -## execute query
57 - #set( $itemFound = $xwiki.searchDocuments($query) )
58 -## set counters
59 - #set( $itemSortNo = $itemFound.size() )
60 - #if( $itemSortNo > 0 )
61 - #set( $itemMap[$sort] = $itemFound )
62 - #set( $itemNo = $itemNo + $itemSortNo )
63 - #end
64 -#end
65 -## DATA STRUCTURES / END
66 -##
67 -## DISPLAY / START
68 -## page subtitle
69 -<div style="display: flex">
70 - <div class="mainheader">
71 -$itemNo
72 -#if( $oneSort )
73 - #if( $itemNo == 1 )
74 - $services.localization.render("${mainSpace}.Class_sort_${sortList[0]}").toLowerCase()
75 - #else
76 - $services.localization.render("${mainSpace}.Class_sort_${sortList[0]}_plural").toLowerCase()
77 - #end
78 -#else
79 - #if( $itemNo == 1 )
80 - $services.localization.render('publication').toLowerCase()
81 - #else
82 - $services.localization.render('publications').toLowerCase()
83 - #end
84 -#end
85 -#if( $oneUser )
86 - <span class="textsecondary">&ensp;/&ensp;</span>
87 - $userFirstName $userLastName
88 -#end
89 - </div>
90 - <div style="flex-grow: 1">
91 - </div>
92 - <div>
93 - <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","bibtex=$showBibtex&inline=#if( $showInline )false#{else}true#end#if( $oneSort )&sort=${sortList[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>
94 - <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","inline=$showInline&bibtex=#if( $showBibtex )false#{else}true#end#if( $oneSort )&sort=${sortList[0]}#end#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")'>#if( $showBibtex )text#{else}bib#end</a>
95 - </div>
96 -</div>
97 -## stop if no pubs are found
98 -#if( $itemNo == 0 || $itemMap.keySet().size() == 0 )
99 -## redundant double check
100 - #stop
101 -#end
102 -## some pubs found
103 -## page index
104 -#if( $itemMap.keySet().size() > 1 )
105 -## found more than one sort
106 -<div class="mainselectbar" id="index">
107 - #foreach( $sort in $itemMap.keySet() )
108 - #if( !$foreach.first )
109 - &ensp;&bull;&ensp;
110 - #end
111 - [[$services.localization.render("${mainSpace}.Class_sort_${sort}_short_plural").toLowerCase()>>||anchor="$sort"]]
112 - #end
113 -</div>
114 -#end
115 -##
116 -#template('apice_publication_macros.vm')
117 -##
118 -#foreach( $sort in $itemMap.keySet() )
119 -## sort top / start
120 -<div class="mainselectseparator">
121 - <a class="mainselectseparatorlink" id="$sort" href=$xwiki.getURL($doc,"view","sort=$sort&bibtex=$showBibtex&inline=$showInline#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")>
122 - $services.localization.render("${mainSpace}.Class_sort_${sort}_plural").toLowerCase()
123 - </a>
124 -</div>
125 -## sort top / end
126 -##
127 -## sort display / start
128 -<div>
129 - #if( $showInline && !$showBibtex )
130 - <ul>
131 - #foreach( $item in $itemMap[$sort] )
132 - <li>#pubpersort($item)</li>
133 - #end
134 - </ul>
135 - #else
136 - #foreach( $item in $itemMap[$sort] )
137 - #if( $showBibtex)
138 - #if( $showInline )
139 - ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}})))
140 - #else
141 - ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}})))
142 - #end
143 - #else
144 - <div style="border-style: hidden hidden hidden hidden; font-size: smaller; line-height: 1.25em; margin: .75em 0 .75em 0">
145 - <div style="margin: 0 0 0 0">#pubauthed($item)</div>
146 - <div style="margin: 0 0 0 0">#pubtitle($item)</div>
147 - <div style="margin: 0 0 0 0"><span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}</div>
148 - </div>
149 - #end
150 - #end
151 - #end
152 -</div>
153 -## sort display / end
154 -##
155 -## sort bottom / start
156 -<div #if( $foreach.last )id="bottom"#end class="mainselectbottom">
157 - #set( $itemSortNo = $itemMap[$sort].size() )
158 -$itemSortNo #if( $itemSortNo == 1 )$services.localization.render("${mainSpace}.Class_sort_${sort}").toLowerCase()#{else}$services.localization.render("${mainSpace}.Class_sort_${sort}_plural").toLowerCase()#end &bull; #anchorlinks()
159 -</div>
160 -## sort bottom / end
161 -#end
162 -## DISPLAY / END
163 -{{/html}}
164 -{{/velocity}}{{pageDisplay sort="objectservice"/}}
1 +{{include reference="Showcase" excludeFirstHeading="true"/}}{{include reference="Classes.Users.PerSort" excludeFirstHeading="true"/}}