Changes for page Per Sort
From version 29.3
edited by Andrea Omicini
on 22/06/2023 16:39
on 22/06/2023 16:39
Change comment:
There is no comment for this version
To version 33.1
edited by Andrea Omicini
on 03/07/2023 23:46
on 03/07/2023 23:46
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,18 +1,10 @@ 1 1 {{velocity}} 2 -{{html wiki="true"clean="false"}}3 -# # GET PARAMETERS / START4 -# # inlinedisplay5 -# set($inlinePar=$request.inline.trim().toLowerCase() )2 +{{html clean="false" wiki="true"}} 3 +#template('apice_macros.vm') 4 +#setobjectspace("Publications") 5 +## BIBTEX / START 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 16 16 ## default: false 17 17 #set( $showBibtex = false ) 18 18 ## check $bibtexPar ... ... @@ -19,9 +19,11 @@ 19 19 #if( $bibtexPar != "" && $trueStringList.contains($bibtexPar.toLowerCase()) ) 20 20 #set( $showBibtex = true ) 21 21 #end 22 -## HANDLEBIBTEX / END14 +## BIBTEX / END 23 23 ## 24 -## HANDLE INLINE / START 16 +## INLINE / START 17 +## inline display 18 +#set( $inlinePar = $request.inline.trim().toLowerCase() ) 25 25 ## default: true 26 26 #set( $showInline = true ) 27 27 ## check $inlinePar ... ... @@ -28,13 +28,11 @@ 28 28 #if( $inlinePar != "" && $falseStringList.contains($inlinePar) ) 29 29 #set( $showInline = false ) 30 30 #end 31 -## HANDLEINLINE / END32 -# #33 -## HANDLESORT / START25 +## INLINE / END 26 +#template('apice_user_param.vm') 27 +## SORT / START 34 34 ## $sortList gets the list of sorts to be shown 35 35 ## $oneSort true if just one sort to be shown 36 -#template('apice_publications.vm') 37 -## default: all sorts 38 38 #set( $sortList = $publicationSorts ) 39 39 #set( $oneSort = false ) 40 40 ## ... ... @@ -51,61 +51,9 @@ 51 51 #end 52 52 #end 53 53 ## INVARIANT: $oneSort and $sortList are correctly and coherently initialised 54 -## HANDLESORT / END46 +## SORT / END 55 55 ## 56 -## HANDLE WHO / START 57 -#template('apice_macros.vm') 58 -#isuserspace() 59 -#if( $isUserSpace ) 60 - #userspace() 61 -## from a personal page 62 - #set( $apiceUser = true ) 63 - #set( $oneUser = true ) 64 -#elseif( $userNamePar ) 65 -## from the URL, "user=$userNamePar" parameter 66 - #if( $userNamePar.contains('XWiki.') ) 67 - #set( $userName = "$userNamePar" ) 68 - #else 69 - #set( $userName = "XWiki.$userNamePar" ) 70 - #end 71 - #if( !$xwiki.exists( $userName ) ) 72 - #if( $services.localization.currentLocale == 'it' ) 73 -{{warning}}L'utente “$userNamePar” non esiste{{/warning}} 74 - #else 75 -{{warning}}User “$userNamePar” does not exist{{/warning}} 76 - #end 77 - #stop 78 - #end 79 - #set( $apiceUser = true ) 80 - #set( $oneUser = true) 81 - #set( $userdoc = $xwiki.getDocument($userName) ) 82 - #set( $userFirstName = $userdoc.display("first_name") ) 83 - #set( $userLastName = $userdoc.display("last_name") ) 84 -#elseif( $firstNamePar && $lastNamePar ) 85 -## from the URL, "name=Firstname&surname=Lastname" parameter 86 - #set( $apiceUser = false ) 87 - #set( $oneUser = true ) 88 - #set( $userFirstName = $firstNamePar ) 89 - #set( $userLastName = $lastNamePar ) 90 -#else 91 - #set( $apiceUser = false ) 92 - #set( $oneUser = false ) 93 - #set( $userFirstName = "" ) 94 - #set( $userLastName = "" ) 95 -#end 96 -#if( $oneUser ) 97 - #if( $apiceUser ) 98 - #set( $userString = "%$userName%" ) 99 - #else 100 - #set( $userString = "%$userFirstName $userLastName%" ) 101 - #end 102 -#else 103 - #set( $userString = "%%" ) 104 -#end 105 -## HANDLE WHO / END 106 -## 107 -### query to structures 108 -## map & counter initialisation 48 +## DATA STRUCTURES / START 109 109 #set( $itemMap = {} ) 110 110 #set( $itemNo = 0 ) 111 111 ## cycle over sorts ... ... @@ -112,7 +112,7 @@ 112 112 #foreach( $sort in $sortList ) 113 113 ## set query 114 114 #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 115 - where obj.name = doc.fullName and obj.className = '${objectSpace}. ${objectClass}' and obj.name <> '${objectPool}.${objectTemplate}' 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" )55 + where obj.name = doc.fullName and obj.className = '${objectSpace}.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" ) 116 116 ## execute query 117 117 #set( $itemFound = $xwiki.searchDocuments($query) ) 118 118 ## set counters ... ... @@ -122,8 +122,9 @@ 122 122 #set( $itemNo = $itemNo + $itemSortNo ) 123 123 #end 124 124 #end 65 +## DATA STRUCTURES / END 125 125 ## 126 -## #outputresults67 +## DISPLAY / START 127 127 ## page subtitle 128 128 <div style="display: flex"> 129 129 <div class="mainheader"> ... ... @@ -130,9 +130,9 @@ 130 130 $itemNo 131 131 #if( $oneSort ) 132 132 #if( $itemNo == 1 ) 133 - $services.localization.render("${objectSpace}. ${objectClass}_sort_${sortList[0]}").toLowerCase()74 + $services.localization.render("${objectSpace}.Class_sort_${sortList[0]}").toLowerCase() 134 134 #else 135 - $services.localization.render("${objectSpace}. ${objectClass}_sort_${sortList[0]}_plural").toLowerCase()76 + $services.localization.render("${objectSpace}.Class_sort_${sortList[0]}_plural").toLowerCase() 136 136 #end 137 137 #else 138 138 #if( $itemNo == 1 ) ... ... @@ -148,7 +148,7 @@ 148 148 </div> 149 149 <div style="flex-grow: 1"> 150 150 </div> 151 - <div ">92 + <div> 152 152 <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> 153 153 <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> 154 154 </div> ... ... @@ -167,7 +167,7 @@ 167 167 #if( !$foreach.first ) 168 168  •  169 169 #end 170 - [[$services.localization.render("${objectSpace}. ${objectClass}_sort_${sort}_short_plural").toLowerCase()>>||anchor="$sort"]]111 + [[$services.localization.render("${objectSpace}.Class_sort_${sort}_short_plural").toLowerCase()>>||anchor="$sort"]] 171 171 #end 172 172 </div> 173 173 #end ... ... @@ -178,7 +178,7 @@ 178 178 ## sort top / start 179 179 <div class="mainselectseparator"> 180 180 <a class="mainselectseparatorlink" id="$sort" href=$xwiki.getURL($doc,"view","sort=$sort#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")> 181 - $services.localization.render("${objectSpace}. ${objectClass}_sort_${sort}_plural").toLowerCase()122 + $services.localization.render("${objectSpace}.Class_sort_${sort}_plural").toLowerCase() 182 182 </a> 183 183 </div> 184 184 ## sort top / end ... ... @@ -214,9 +214,10 @@ 214 214 ## sort bottom / start 215 215 <div #if( $foreach.last )id="bottom"#end class="mainselectbottom"> 216 216 #set( $itemSortNo = $itemMap[$sort].size() ) 217 -$itemSortNo #if( $itemSortNo == 1 )$services.localization.render("${objectSpace}. ${objectClass}_sort_${sort}").toLowerCase()#{else}$services.localization.render("${objectSpace}.${objectClass}_sort_${sort}_plural").toLowerCase()#end •[[{{stringEngItaeng='top' ita='incima'/}}>>||anchor="top"]] • [[{{stringEngIta eng='index' ita='indice'/}}>>||anchor="index"]] • [[{{stringEngIta eng='bottom' ita='in fondo'/}}>>||anchor="bottom"]]158 +$itemSortNo #if( $itemSortNo == 1 )$services.localization.render("${objectSpace}.Class_sort_${sort}").toLowerCase()#{else}$services.localization.render("${objectSpace}.Class_sort_${sort}_plural").toLowerCase()#end • #anchorlinks() 218 218 </div> 219 219 ## sort bottom / end 220 220 #end 162 +## DISPLAY / END 221 221 {{/html}} 222 222 {{/velocity}}{{pageDisplay sort="objectservice"/}}