Changes for page Per Status
From version 86.11
edited by Andrea Omicini
on 22/06/2023 12:53
on 22/06/2023 12:53
Change comment:
There is no comment for this version
To version 100.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,12 +28,14 @@ 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 -## HANDLESTATUS / START28 +## STATUS / START 34 34 ## $oneStatus false gets a list of statuses, true just one 35 35 #set( $oneStatus = false ) 36 36 #set( $showRejected = false ) 32 +#set( $showPublished = false ) 37 37 ## $statusList gets the list of statuses to be shown 38 38 #set( $statusList = $publicationStatuses ) 39 39 ## ... ... @@ -41,84 +41,42 @@ 41 41 #if( $statusPar.toLowerCase() == "all" ) 42 42 ## 'all' value gets all unpublished papers including "Rejected" ones 43 43 #set( $showRejected = true ) 44 -#else 45 - #if( $publicationStatuses.contains($statusPar) ) 46 - ## 'status' parameter is an admissible publication status value 47 - #set( $oneStatus = true ) 48 - #set( $statusList = [$statusPar] ) 49 - #end 40 +#elseif( $statusPar.toLowerCase() == "published" ) 41 + #set( $oneStatus = true ) 42 + #set( $statusList = ["published"] ) 43 + #set( $showPublished = true ) 44 +#elseif( $statusPar.toLowerCase() == "rejected" ) 45 + #set( $oneStatus = true ) 46 + #set( $statusList = ["rejected"] ) 47 + #set( $showRejected = true ) 48 +#elseif( $publicationStatuses.contains($statusPar) ) 49 +## 'status' parameter is an admissible publication status value 50 + #set( $oneStatus = true ) 51 + #set( $statusList = [$statusPar] ) 50 50 #end 51 51 ## 52 -## HANDLE STATUS / END 53 -## HANDLE WHO / START 54 -#template('apice_macros.vm') 55 -#isuserspace() 56 -#if( $isUserSpace ) 57 - #userspace() 58 -## from a personal page 59 - #set( $apiceUser = true ) 60 - #set( $oneUser = true ) 61 -#elseif( $userNamePar ) 62 -## from the URL, "user=$userNamePar" parameter 63 - #if( $userNamePar.contains('XWiki.') ) 64 - #set( $userName = "$userNamePar" ) 65 - #else 66 - #set( $userName = "XWiki.$userNamePar" ) 67 - #end 68 - #if( !$xwiki.exists( $userName ) ) 69 - #if( $services.localization.currentLocale == 'it' ) 70 -{{warning}}L'utente “$userNamePar” non esiste{{/warning}} 71 - #else 72 -{{warning}}User “$userNamePar” does not exist{{/warning}} 73 - #end 74 - #stop 75 - #end 76 - #set( $apiceUser = true ) 77 - #set( $oneUser = true) 78 - #set( $userdoc = $xwiki.getDocument($userName) ) 79 - #set( $userFirstName = $userdoc.display("first_name") ) 80 - #set( $userLastName = $userdoc.display("last_name") ) 81 -#elseif( $firstNamePar && $lastNamePar ) 82 -## from the URL, "name=Firstname&surname=Lastname" parameter 83 - #set( $apiceUser = false ) 84 - #set( $oneUser = true ) 85 - #set( $userFirstName = $firstNamePar ) 86 - #set( $userLastName = $lastNamePar ) 87 -#else 88 - #set( $apiceUser = false ) 89 - #set( $oneUser = false ) 90 - #set( $userFirstName = "" ) 91 - #set( $userLastName = "" ) 92 -#end 93 -#if( $oneUser ) 94 - #if( $apiceUser ) 95 - #set( $userString = "%$userName%" ) 96 - #else 97 - #set( $userString = "%$userFirstName $userLastName%" ) 98 - #end 99 -#else 100 - #set( $userString = "%%" ) 101 -#end 102 -## HANDLE WHO / END 54 +## STATUS / END 103 103 ## 104 -### query to structures 105 -## map & counter initialisation 56 +## DATA STRUCTURES / START 106 106 #set( $itemMap = {} ) 107 107 #set( $itemNo = 0 ) 108 -## cycle over s orts59 +## cycle over statuses 109 109 #foreach( $status in $statusList ) 110 - #set( $query = ", BaseObject as obj, #if( $oneUser ) LargeStringProperty as propAuthor, LargeStringProperty as propEditor, #end StringProperty as propStatus #if( !$hasEdit ), StringProperty as propAccess #end 111 - 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" ) 112 - #set( $itemFound = $xwiki.searchDocuments($query) ) 61 + #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected ) 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 = '${objectSpace}.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) ) 113 113 ## set counters 114 - #set( $itemStatusNo = $itemFound.size() ) 115 - #if( $itemStatusNo > 0 ) 116 - #set( $itemMap[$status] = $itemFound ) 117 - #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 118 118 #end 119 119 #end 73 +## DATA STRUCTURES / END 120 120 ## 121 -## outputresults75 +## DISPLAY / START 122 122 ## page subtitle 123 123 <div style="display: flex"> 124 124 <div class="mainheader"> ... ... @@ -125,14 +125,26 @@ 125 125 $itemNo 126 126 #if( $oneStatus ) 127 127 #if( $itemNo == 1 ) 128 - $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase() 82 + $services.localization.render('work').toLowerCase() 83 + <span class="textsecondary"> / </span> 84 + $services.localization.render("${objectSpace}.Class_status_${statusList[0]}").toLowerCase() 129 129 #else 130 -$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("${objectSpace}.Class_status_${statusList[0]}_plural").toLowerCase() #end 131 131 #else 132 132 #if( $itemNo == 1 ) 133 - $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 134 134 #else 135 - $services.localization.render('yetunpublished').toLowerCase() 97 + #if( $showPublished ) 98 + $services.localization.render('works').toLowerCase() 99 + #else 100 + $services.localization.render('yetunpublished').toLowerCase() 101 + #end 136 136 #end 137 137 #end 138 138 #if( $oneUser ) ... ... @@ -142,9 +142,11 @@ 142 142 </div> 143 143 <div style="flex-grow: 1"> 144 144 </div> 145 - <div"> 146 - <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","bibtex=$showBibtex&inline=#if( $showInline )false#{else}true#end#if( $oneSort )&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> 147 - <a class="basebutton" style="padding: .5em" href='$doc.getURL("view","inline=$showInline&bibtex=#if( $showBibtex )false#{else}true#end#if( $oneSort )&status=${statusList[0]}#end#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")'>#if( $showBibtex )text#{else}bib#end</a> 111 + <div> 112 + <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 ) 114 + <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 148 148 </div> 149 149 </div> 150 150 ## stop if no pubs are found ... ... @@ -155,26 +155,63 @@ 155 155 ## some pubs found 156 156 ## page index 157 157 #if( $itemMap.keySet().size() > 1 ) 158 -## found more than one s ort126 +## found more than one status 159 159 <div class="mainselectbar" id="index"> 160 160 #foreach( $status in $itemMap.keySet() ) 161 161 #if( !$foreach.first ) 162 162  •  163 163 #end 164 - [[$services.localization.render("${objectSpace}. ${objectClass}_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]]132 + [[$services.localization.render("${objectSpace}.Class_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]] 165 165 #end 166 166 </div> 167 167 #end 168 168 ## 169 -## pubs displayed per year 170 -#foreach( $status in $pubMap.keySet() ) 171 -(% style="border-style:solid hidden hidden solid; border-color:$theme.borderColor; text-align:left; font-style:oblique" %)|{{id name='$status'/}}[[{{pubStatus uppercase='false' plural='true'}}$status{{/pubStatus}}>>$doc.name||queryString='status=$status#if( $oneUser )#if( $apiceUser )&user=$userName#{else}&name=$userFirstName&surname=$userLastName#end#end']] 172 - #foreach( $pub in $pubMap[$status] ) 173 -(% style="border-style:hidden hidden hidden hidden" %)|{{pub inline='false' linked='title'}}$pub{{/pub}} 137 +#template('apice_publication_macros.vm') 138 +## 139 +#foreach( $status in $itemMap.keySet() ) 140 +## status top / start 141 +<div class="mainselectseparator"> 142 + <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")> 143 + $services.localization.render("${objectSpace}.Class_status_${status}_plural").toLowerCase() 144 + </a> 145 +</div> 146 +## status top / end 147 +## 148 +## status display / start 149 +<div> 150 + #if( $showInline && !$showBibtex ) 151 + <ul> 152 + #foreach( $item in $itemMap[$status] ) 153 + <li>#pubperstatus($item)</li> 154 + #end 155 + </ul> 156 + #else 157 + #foreach( $item in $itemMap[$status] ) 158 + #if( $showBibtex) 159 + #if( $showInline ) 160 + ((({{{ $xwiki.getDocument($item).getValue('bibtex') }}}))) 161 + #else 162 + ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}}))) 163 + #end 164 + #else 165 + <div style="border-style:hidden hidden hidden hidden; font-size:smaller; line-height: 1.25em; margin-bottom: .5em"> 166 + #pubauthed($item)<br/> 167 + #pubtitle($item)<br/> 168 + <span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}} 169 + </div> 170 + #end 171 + #end 174 174 #end 175 - #set( $pubStatusNo = $pubMap[$status].size() ) 176 -(% style="border-style:hidden solid solid hidden; border-color:$theme.borderColor; text-align:right; font-style:oblique; font-size:smaller" %)|($pubStatusNo #if( $pubStatusNo == 1 ){{stringEngIta eng='publication' ita='pubblicazione'/}} {{pubStatus uppercase='false' plural='false'}}$status{{/pubStatus}}#{else}{{stringEngIta eng='publications' ita='pubblicazioni'/}} {{pubStatus uppercase='false' plural='true'}}$status{{/pubStatus}}#end) [[[{{stringEngIta eng='top' ita='in cima'/}}]>>||anchor="top"]] [[[{{stringEngIta eng='bottom' ita='in fondo'/}}]>>||anchor="bottom"]] 173 +</div> 174 +## status display / end 175 +## 176 +## status bottom / start 177 +<div #if( $foreach.last )id="bottom"#end class="mainselectbottom"> 178 + #set( $itemStatusNo = $itemMap[$status].size() ) 179 +$itemStatusNo #if( $itemStatusNo == 1 )$services.localization.render("${objectSpace}.Class_status_${status}").toLowerCase()#{else}$services.localization.render("${objectSpace}.Class_status_${status}_plural").toLowerCase()#end • #anchorlinks() 180 +</div> 177 177 ## status bottom / end 178 178 #end 183 +## DISPLAY / END 179 179 {{/html}} 180 180 {{/velocity}}{{pageDisplay sort="objectservice"/}}