Changes for page Per Status
From version 97.1
edited by Andrea Omicini
on 25/06/2023 13:49
on 25/06/2023 13:49
Change comment:
There is no comment for this version
To version 86.4
edited by Andrea Omicini
on 18/03/2023 09:36
on 18/03/2023 09:36
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,0 @@ 1 -$services.localization.render('perstatus') - Content
-
... ... @@ -1,185 +1,124 @@ 1 -{{velocity}} 2 -{{html clean="false" wiki="true"}} 3 -#template('apice_boolean.vm') 4 -## BIBTEX / START 5 -## show BibTeX 6 -#set( $bibtexPar = $request.bibtex.trim().toLowerCase() ) 7 -## default: false 8 -#set( $showBibtex = false ) 9 -## check $bibtexPar 10 -#if( $bibtexPar != "" && $trueStringList.contains($bibtexPar.toLowerCase()) ) 11 - #set( $showBibtex = true ) 12 -#end 13 -## BIBTEX / END 1 += {{italiano}}Per stato{{/italiano}}{{english}}Per Status{{/english}} = 2 + 3 +{{include reference="Publications.Environment" excludeFirstHeading="true"/}}{{velocity}} 4 +## a Publications page 5 +#set( $publicationMenu = true ) 6 +#### get parameters 7 +## who 8 +#set( $userNamePar = $request.user.trim() ) 9 +#set( $firstNamePar = $request.name.trim() ) 10 +#set( $lastNamePar = $request.surname.trim() ) 11 +## which status 12 +#set( $statusPar = $request.status.trim() ) 14 14 ## 15 -## INLINE / START 16 -## inline display 17 -#set( $inlinePar = $request.inline.trim().toLowerCase() ) 18 -## default: true 19 -#set( $showInline = true ) 20 -## check $inlinePar 21 -#if( $inlinePar != "" && $falseStringList.contains($inlinePar) ) 22 - #set( $showInline = false ) 14 +#### handle who 15 +#if( $userName ) 16 +## from a personal page, "XWiki.$userName" $userName form 17 + #if( !$xwiki.exists( $userName ) ) 18 +{{warning}}User $userName does not exist{{/warning}} 19 + #stop 20 + #end 21 + #set( $apiceUser = true ) 22 + #set( $oneUser = true ) 23 + #set( $userdoc = $xwiki.getDocument($userName) ) 24 + #set( $userFirstName = $userdoc.display("first_name") ) 25 + #set( $userLastName = $userdoc.display("last_name") ) 26 +#elseif( $userNamePar ) ## from the URL, "user=$userNamePar" parameter 27 + #if( $userNamePar.contains('XWiki.') ) 28 + #set( $userName = "$userNamePar" ) 29 + #else 30 + #set( $userName = "XWiki.$userNamePar" ) 31 + #end 32 + #if( !$xwiki.exists( $userName ) ) 33 + #if( $services.localization.currentLocale == 'it' ) 34 +{{warning}}L'utente “$userNamePar” non esiste{{/warning}} 35 + #else 36 +{{warning}}User “$userNamePar” does not exist{{/warning}} 37 + #end 38 + #stop 39 + #end 40 + #set( $apiceUser = true ) 41 + #set( $oneUser = true) 42 + #set( $userdoc = $xwiki.getDocument($userName) ) 43 + #set( $userFirstName = $userdoc.display("first_name") ) 44 + #set( $userLastName = $userdoc.display("last_name") ) 45 +#elseif( $firstNamePar && $lastNamePar ) 46 +## from the URL, "name=Firstname&surname=Lastname" parameter 47 + #set( $apiceUser = false ) 48 + #set( $oneUser = true ) 49 + #set( $userFirstName = $firstNamePar ) 50 + #set( $userLastName = $lastNamePar ) 51 +#else 52 + #set( $apiceUser = false ) 53 + #set( $oneUser = false ) 54 + #set( $userFirstName = "" ) 55 + #set( $userLastName = "" ) 23 23 #end 24 -## INLINE / END 25 -#template('apice_publications.vm') 26 -#template('apice_user_param.vm') 57 +#if( $oneUser ) 58 + #if( $apiceUser ) 59 + #set( $userString = "%$userName%" ) 60 + #else 61 + #set( $userString = "%$userFirstName $userLastName%" ) 62 + #end 63 +#else 64 + #set( $userString = "%%" ) 65 +#end 27 27 ## 28 -## STATUS/ START67 +#### handle status 29 29 ## $oneStatus false gets a list of statuses, true just one 30 30 #set( $oneStatus = false ) 31 -#set( $showRejected = false ) 32 -#set( $showPublished = false ) 33 33 ## $statusList gets the list of statuses to be shown 34 -#set( $statusList = $publicationStatuses)35 -## 36 -#set( $s tatusPar = $request.status.trim() )71 +#set( $statusList = [] ) 72 +## default: all unpublished papers except Rejected ones 73 +#set( $discard = $statusList.addAll($unpublishedStatuses) ) 37 37 #if( $statusPar.toLowerCase() == "all" ) 38 38 ## 'all' value gets all unpublished papers including "Rejected" ones 39 - #set( $showRejected = true ) 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] ) 76 + #set( $discard = $statusList.add("rejected") ) 77 +#else 78 + #if( $allStatusesPlus.contains($statusPar) ) 79 + ## 'status' parameter is an admissible publication status value 80 + #set( $oneStatus = true ) 81 + #set( $statusList = [$statusPar] ) 82 + #end 52 52 #end 53 53 ## 54 -## STATUS / END 55 -## 56 -## DATA STRUCTURES / START 57 -#set( $itemMap = {} ) 58 -#set( $itemNo = 0 ) 59 -## cycle over statuses 85 +## query to structures 86 +#set( $pubMap = {} ) 87 +#set( $pubNo = 0 ) 60 60 #foreach( $status in $statusList ) 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}.${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 - #set( $itemFound = $xwiki.searchDocuments($query) ) 65 -## set counters 66 - #set( $itemStatusNo = $itemFound.size() ) 67 - #if( $itemStatusNo > 0 ) 68 - #set( $itemMap[$status] = $itemFound ) 69 - #set( $itemNo = $itemNo + $itemStatusNo ) 70 - #end 89 + #set( $from = ", BaseObject as obj, LargeStringProperty as prop0, LargeStringProperty as prop1, StringProperty as prop2, StringProperty as prop3" ) 90 + #set( $where = "obj.name = doc.fullName and obj.className = '${objectSpace}.${objectClass}' and obj.name <> '${objectSpace}.${objectTemplate}' and prop0.id.id = obj.id and prop1.id.id = obj.id and prop2.id.id = obj.id and prop3.id.id = obj.id and prop0.name = 'author' and prop1.name = 'editor' and ( prop0.value like '$userString' or ( prop0.value = '' and prop1.value like '$userString' ) ) and prop2.name = 'status' and prop2.value = '$status' and prop3.name = 'access' and prop3.value <> 'hidden'" ) 91 + #set( $sql = $from + " where " + $where ) 92 + #set( $pubFound = $xwiki.searchDocuments($sql) ) 93 + #set( $pubStatusNo = $pubFound.size() ) 94 + #if( $pubStatusNo > 0 ) 95 + #set( $pubMap[$status] = $pubFound ) 96 + #set( $pubNo = $pubNo + $pubStatusNo ) 71 71 #end 72 72 #end 73 -## DATA STRUCTURES / END 74 -## 75 -## DISPLAY / START 99 +## output results 76 76 ## page subtitle 77 -<div style="display: flex"> 78 - <div class="mainheader"> 79 -$itemNo 80 -#if( $oneStatus ) 81 - #if( $itemNo == 1 ) 82 - $services.localization.render('work').toLowerCase() 83 - <span class="textsecondary"> / </span> 84 - $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase() 85 - #else 86 - $services.localization.render('works').toLowerCase() 87 - <span class="textsecondary"> / </span> 88 - $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end 89 -#else 90 - #if( $itemNo == 1 ) 91 - #if( $showPublished ) 92 - $services.localization.render('work').toLowerCase() 93 - #else 94 - $services.localization.render('yetunpublished_singular').toLowerCase() 95 - #end 96 - #else 97 - #if( $showPublished ) 98 - $services.localization.render('works').toLowerCase() 99 - #else 100 - $services.localization.render('yetunpublished').toLowerCase() 101 - #end 102 - #end 103 -#end 104 -#if( $oneUser ) 105 - <span class="textsecondary"> / </span> 106 - $userFirstName $userLastName 107 -#end 108 - </div> 109 - <div style="flex-grow: 1"> 110 - </div> 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 116 - </div> 117 -</div> 101 +{{id name="top"/}} 102 +>(%%)$pubNo #if( $pubNo == 1 ){{stringEngIta eng="$objectEngSingular.toLowerCase()" ita="$objectItaSingular.toLowerCase()"/}}#{else}{{stringEngIta eng="$objectEngPlural.toLowerCase()" ita="$objectItaPlural.toLowerCase()"/}}#{end} / #if( $oneStatus ){{pubStatus uppercase='false' plural='true'}}$statusPar{{/pubStatus}}#{else}{{pubStatus uppercase='false' plural='true'}}unpublished{{/pubStatus}}#{end}#if( $oneUser ) / $userFirstName $userLastName#{end}(%%) 118 118 ## stop if no pubs are found 119 -#if( $ itemNo == 0 || $itemMap.keySet().size() == 0 )104 +#if( $pubNo == 0 || $pubMap.keySet().size() == 0 ) 120 120 ## redundant double check 121 121 #stop 122 122 #end 123 123 ## some pubs found 124 124 ## page index 125 -#if( $ itemMap.keySet().size() > 1 )110 +#if( $pubMap.keySet().size() > 1 ) 126 126 ## found more than one status 127 -<div class="mainselectbar" id="index"> 128 - #foreach( $status in $itemMap.keySet() ) 129 - #if( !$foreach.first ) 130 -  •  131 - #end 132 - [[$services.localization.render("${objectSpace}.${objectClass}_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]] 133 - #end 134 -</div> 112 +{{id name="index"/}} 113 +(% style="font-size:smaller; text-align:right; padding:1em 1.5em 0.25em 1.5em; background-color:$theme.highlightColor" %)(((#foreach( $status in $pubMap.keySet() )#if( !$foreach.first ) | #end[[{{pubStatus uppercase='false' plural='true'}}$status{{/pubStatus}}>>||anchor="$status"]]#end))) 135 135 #end 136 -## 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}.${objectClass}_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 115 +## pubs displayed per year 116 +#foreach( $status in $pubMap.keySet() ) 117 +(% 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']] 118 + #foreach( $pub in $pubMap[$status] ) 119 +(% style="border-style:hidden hidden hidden hidden" %)|{{pub inline='false' linked='title'}}$pub{{/pub}} 172 172 #end 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}.${objectClass}_status_${status}").toLowerCase()#{else}$services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase()#end • [[{{stringEngIta eng='top' ita='in cima'/}}>>||anchor="top"]] • [[{{stringEngIta eng='index' ita='indice'/}}>>||anchor="index"]] • [[{{stringEngIta eng='bottom' ita='in fondo'/}}>>||anchor="bottom"]] 180 -</div> 181 -## status bottom / end 121 + #set( $pubStatusNo = $pubMap[$status].size() ) 122 +(% 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"]] 182 182 #end 183 -## DISPLAY / END 184 -{{/html}} 185 -{{/velocity}}{{pageDisplay sort="objectservice"/}} 124 +{{/velocity}}