Changes for page Per Status
From version 91.1
edited by Andrea Omicini
on 22/06/2023 13:09
on 22/06/2023 13:09
Change comment:
There is no comment for this version
To version 102.1
edited by Andrea Omicini
on 11/07/2023 17:19
on 11/07/2023 17:19
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,10 +28,10 @@ 28 28 #if( $inlinePar != "" && $falseStringList.contains($inlinePar) ) 29 29 #set( $showInline = false ) 30 30 #end 31 -## HANDLE INLINE / END 25 +## INLINE / END 26 +#template('apice_user_param.vm') 32 32 ## 33 -## HANDLE STATUS / START 34 -#template('apice_publications.vm') 28 +## STATUS / START 35 35 ## $oneStatus false gets a list of statuses, true just one 36 36 #set( $oneStatus = false ) 37 37 #set( $showRejected = false ) ... ... @@ -53,81 +53,32 @@ 53 53 #set( $showRejected = true ) 54 54 #elseif( $publicationStatuses.contains($statusPar) ) 55 55 ## 'status' parameter is an admissible publication status value 56 - 57 - 50 + #set( $oneStatus = true ) 51 + #set( $statusList = [$statusPar] ) 58 58 #end 59 59 ## 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 54 +## STATUS / END 111 111 ## 112 -### query to structures 113 -## map & counter initialisation 56 +## DATA STRUCTURES / START 114 114 #set( $itemMap = {} ) 115 115 #set( $itemNo = 0 ) 116 116 ## cycle over statuses 117 117 #foreach( $status in $statusList ) 118 118 #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected ) 119 - #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #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" )121 - #set( $itemFound = $xwiki.searchDocuments($query) ) 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" ) 64 + #set( $itemFound = $xwiki.searchDocuments($query) ) 122 122 ## set counters 123 - #set( $itemStatusNo = $itemFound.size() ) 124 - #if( $itemStatusNo > 0 ) 125 - #set( $itemMap[$status] = $itemFound ) 126 - #set( $itemNo = $itemNo + $itemStatusNo ) 66 + #set( $itemStatusNo = $itemFound.size() ) 67 + #if( $itemStatusNo > 0 ) 68 + #set( $itemMap[$status] = $itemFound ) 69 + #set( $itemNo = $itemNo + $itemStatusNo ) 70 + #end 127 127 #end 128 128 #end 73 +## DATA STRUCTURES / END 129 129 ## 130 -## outputresults75 +## DISPLAY / START 131 131 ## page subtitle 132 132 <div style="display: flex"> 133 133 <div class="mainheader"> ... ... @@ -134,14 +134,26 @@ 134 134 $itemNo 135 135 #if( $oneStatus ) 136 136 #if( $itemNo == 1 ) 137 - $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase() 82 + $services.localization.render('work').toLowerCase() 83 + <span class="textsecondary"> / </span> 84 + $services.localization.render("${mainSpace}.Class_status_${statusList[0]}").toLowerCase() 138 138 #else 139 -$services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end 86 + $services.localization.render('works').toLowerCase() 87 + <span class="textsecondary"> / </span> 88 + $services.localization.render("${mainSpace}.Class_status_${statusList[0]}_plural").toLowerCase() #end 140 140 #else 141 141 #if( $itemNo == 1 ) 142 - $services.localization.render('yetunpublished_singular').toLowerCase() 91 + #if( $showPublished ) 92 + $services.localization.render('work').toLowerCase() 93 + #else 94 + $services.localization.render('yetunpublished_singular').toLowerCase() 95 + #end 143 143 #else 144 - $services.localization.render('yetunpublished').toLowerCase() 97 + #if( $showPublished ) 98 + $services.localization.render('works').toLowerCase() 99 + #else 100 + $services.localization.render('yetunpublished').toLowerCase() 101 + #end 145 145 #end 146 146 #end 147 147 #if( $oneUser ) ... ... @@ -151,9 +151,11 @@ 151 151 </div> 152 152 <div style="flex-grow: 1"> 153 153 </div> 154 - <div ">111 + <div> 155 155 <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","bibtex=$showBibtex&inline=#if( $showInline )false#{else}true#end#if( $oneStatus )&status=${statusList[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> 113 +#if( $showPublished ) 156 156 <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","inline=$showInline&bibtex=#if( $showBibtex )false#{else}true#end#if( $oneStatus )&status=${statusList[0]}#end#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")'>#if( $showBibtex )text#{else}bib#end</a> 115 +#end 157 157 </div> 158 158 </div> 159 159 ## stop if no pubs are found ... ... @@ -170,7 +170,7 @@ 170 170 #if( !$foreach.first ) 171 171  •  172 172 #end 173 - [[$services.localization.render("${ objectSpace}.${objectClass}_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]]132 + [[$services.localization.render("${mainSpace}.Class_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]] 174 174 #end 175 175 </div> 176 176 #end ... ... @@ -180,8 +180,8 @@ 180 180 #foreach( $status in $itemMap.keySet() ) 181 181 ## status top / start 182 182 <div class="mainselectseparator"> 183 - <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")> 184 - $services.localization.render("${ objectSpace}.${objectClass}_status_${status}_plural").toLowerCase()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() 185 185 </a> 186 186 </div> 187 187 ## status top / end ... ... @@ -191,12 +191,11 @@ 191 191 #if( $showInline && !$showBibtex ) 192 192 <ul> 193 193 #foreach( $item in $itemMap[$status] ) 194 - <li>#publinked($item)</li> 195 -## <li>#pubperstatus($item)</li> 153 + <li>#pubperstatus($item)</li> 196 196 #end 197 197 </ul> 198 198 #else 199 - #foreach( $item in $itemMap[$s ort] )157 + #foreach( $item in $itemMap[$status] ) 200 200 #if( $showBibtex) 201 201 #if( $showInline ) 202 202 ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}}))) ... ... @@ -204,10 +204,10 @@ 204 204 ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}}))) 205 205 #end 206 206 #else 207 - <div style="border-style:hidden hidden hidden hidden; font-size:smaller; line-height: 1.25em; margin -bottom: .5em">208 - #pubauthed($item)< br/>209 - #pubtitle($item)< br/>210 - <span class="textsecondary">(#pubst atus($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}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> 211 211 </div> 212 212 #end 213 213 #end ... ... @@ -218,9 +218,10 @@ 218 218 ## status bottom / start 219 219 <div #if( $foreach.last )id="bottom"#end class="mainselectbottom"> 220 220 #set( $itemStatusNo = $itemMap[$status].size() ) 221 -$itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${ objectSpace}.${objectClass}_status_${status}").toLowerCase()#{else}$services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase()#end •[[{{stringEngItaeng='top' ita='incima'/}}>>||anchor="top"]] • [[{{stringEngIta eng='index' ita='indice'/}}>>||anchor="index"]] • [[{{stringEngIta eng='bottom' ita='in fondo'/}}>>||anchor="bottom"]]179 +$itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${mainSpace}.Class_status_${status}").toLowerCase()#{else}$services.localization.render("${mainSpace}.Class_status_${status}_plural").toLowerCase()#end • #anchorlinks() 222 222 </div> 223 223 ## status bottom / end 224 224 #end 183 +## DISPLAY / END 225 225 {{/html}} 226 226 {{/velocity}}{{pageDisplay sort="objectservice"/}}