Changes for page Per Status
From 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
To version 94.2
edited by Andrea Omicini
on 22/06/2023 15:14
on 22/06/2023 15:14
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,10 +1,18 @@ 1 1 {{velocity}} 2 -{{html clean="false" wiki="true"}}3 -# template('apice_macros.vm')4 -# setobjectspace("Publications")5 -# #BIBTEX/START2 +{{html wiki="true" clean="false"}} 3 +## GET PARAMETERS / START 4 +## inline display 5 +#set( $inlinePar = $request.inline.trim().toLowerCase() ) 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 8 8 ## default: false 9 9 #set( $showBibtex = false ) 10 10 ## check $bibtexPar ... ... @@ -11,11 +11,9 @@ 11 11 #if( $bibtexPar != "" && $trueStringList.contains($bibtexPar.toLowerCase()) ) 12 12 #set( $showBibtex = true ) 13 13 #end 14 -## BIBTEX / END 22 +## HANDLE BIBTEX / END 15 15 ## 16 -## INLINE / START 17 -## inline display 18 -#set( $inlinePar = $request.inline.trim().toLowerCase() ) 24 +## HANDLE INLINE / START 19 19 ## default: true 20 20 #set( $showInline = true ) 21 21 ## check $inlinePar ... ... @@ -22,10 +22,12 @@ 22 22 #if( $inlinePar != "" && $falseStringList.contains($inlinePar) ) 23 23 #set( $showInline = false ) 24 24 #end 25 -## INLINE / END 26 -#template('apice_user_param.vm') 31 +## HANDLE INLINE / END 32 +inline $showInline 33 +bibtext $showBibtex 27 27 ## 28 -## STATUS / START 35 +## HANDLE STATUS / START 36 +#template('apice_publications.vm') 29 29 ## $oneStatus false gets a list of statuses, true just one 30 30 #set( $oneStatus = false ) 31 31 #set( $showRejected = false ) ... ... @@ -51,9 +51,60 @@ 51 51 #set( $statusList = [$statusPar] ) 52 52 #end 53 53 ## 54 -## STATUS / END 62 +## HANDLE STATUS / END 63 +## HANDLE WHO / START 64 +#template('apice_macros.vm') 65 +#isuserspace() 66 +#if( $isUserSpace ) 67 + #userspace() 68 +## from a personal page 69 + #set( $apiceUser = true ) 70 + #set( $oneUser = true ) 71 +#elseif( $userNamePar ) 72 +## from the URL, "user=$userNamePar" parameter 73 + #if( $userNamePar.contains('XWiki.') ) 74 + #set( $userName = "$userNamePar" ) 75 + #else 76 + #set( $userName = "XWiki.$userNamePar" ) 77 + #end 78 + #if( !$xwiki.exists( $userName ) ) 79 + #if( $services.localization.currentLocale == 'it' ) 80 +{{warning}}L'utente “$userNamePar” non esiste{{/warning}} 81 + #else 82 +{{warning}}User “$userNamePar” does not exist{{/warning}} 83 + #end 84 + #stop 85 + #end 86 + #set( $apiceUser = true ) 87 + #set( $oneUser = true) 88 + #set( $userdoc = $xwiki.getDocument($userName) ) 89 + #set( $userFirstName = $userdoc.display("first_name") ) 90 + #set( $userLastName = $userdoc.display("last_name") ) 91 +#elseif( $firstNamePar && $lastNamePar ) 92 +## from the URL, "name=Firstname&surname=Lastname" parameter 93 + #set( $apiceUser = false ) 94 + #set( $oneUser = true ) 95 + #set( $userFirstName = $firstNamePar ) 96 + #set( $userLastName = $lastNamePar ) 97 +#else 98 + #set( $apiceUser = false ) 99 + #set( $oneUser = false ) 100 + #set( $userFirstName = "" ) 101 + #set( $userLastName = "" ) 102 +#end 103 +#if( $oneUser ) 104 + #if( $apiceUser ) 105 + #set( $userString = "%$userName%" ) 106 + #else 107 + #set( $userString = "%$userFirstName $userLastName%" ) 108 + #end 109 +#else 110 + #set( $userString = "%%" ) 111 +#end 112 +## HANDLE WHO / END 55 55 ## 56 -## DATA STRUCTURES / START 114 +### query to structures 115 +## map & counter initialisation 57 57 #set( $itemMap = {} ) 58 58 #set( $itemNo = 0 ) 59 59 ## cycle over statuses ... ... @@ -60,7 +60,7 @@ 60 60 #foreach( $status in $statusList ) 61 61 #if( $status != "published" && $status != "rejected" || $status == "published" && $showPublished || $status == "rejected" && $showRejected ) 62 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" )122 + 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 64 #set( $itemFound = $xwiki.searchDocuments($query) ) 65 65 ## set counters 66 66 #set( $itemStatusNo = $itemFound.size() ) ... ... @@ -70,9 +70,8 @@ 70 70 #end 71 71 #end 72 72 #end 73 -## DATA STRUCTURES / END 74 74 ## 75 -## DISPLAY/ START133 +## output results 76 76 ## page subtitle 77 77 <div style="display: flex"> 78 78 <div class="mainheader"> ... ... @@ -81,11 +81,11 @@ 81 81 #if( $itemNo == 1 ) 82 82 $services.localization.render('work').toLowerCase() 83 83 <span class="textsecondary"> / </span> 84 - $services.localization.render("${ mainSpace}.Class_status_${statusList[0]}").toLowerCase()142 + $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase() 85 85 #else 86 86 $services.localization.render('works').toLowerCase() 87 87 <span class="textsecondary"> / </span> 88 - $services.localization.render("${ mainSpace}.Class_status_${statusList[0]}_plural").toLowerCase() #end146 + $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end 89 89 #else 90 90 #if( $itemNo == 1 ) 91 91 #if( $showPublished ) ... ... @@ -108,11 +108,9 @@ 108 108 </div> 109 109 <div style="flex-grow: 1"> 110 110 </div> 111 - <div> 169 + <div"> 112 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 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 116 </div> 117 117 </div> 118 118 ## stop if no pubs are found ... ... @@ -129,7 +129,7 @@ 129 129 #if( !$foreach.first ) 130 130  •  131 131 #end 132 - [[$services.localization.render("${ mainSpace}.Class_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]]188 + [[$services.localization.render("${objectSpace}.${objectClass}_status_${status}_short_plural").toLowerCase()>>||anchor="$status"]] 133 133 #end 134 134 </div> 135 135 #end ... ... @@ -139,8 +139,8 @@ 139 139 #foreach( $status in $itemMap.keySet() ) 140 140 ## status top / start 141 141 <div class="mainselectseparator"> 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()198 + <a class="mainselectseparatorlink" id="$status" href=$xwiki.getURL($doc,"view","status=$status#if( $apiceUser )&user=$userName#elseif( $oneUser )&name=$userFirstName&surname=$userLastName#end")> 199 + $services.localization.render("${objectSpace}.${objectClass}_status_${status}_plural").toLowerCase() 144 144 </a> 145 145 </div> 146 146 ## status top / end ... ... @@ -162,10 +162,10 @@ 162 162 ((({{code language="bibtex"}}$xwiki.getDocument($item).getValue('bibtex'){{/code}}))) 163 163 #end 164 164 #else 165 - <div style="border-style: 75em0 .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 - < divstyle="margin: 0 0 0 0"><span class="textsecondary">(#pubsort($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}}</div>221 + <div style="border-style:hidden hidden hidden hidden; font-size:smaller; line-height: 1.25em; margin-bottom: .5em"> 222 + #pubauthed($item)<br/> 223 + #pubtitle($item)<br/> 224 + <span class="textsecondary">(#pubstatus($item))</span> {{pubVenue linked="false"}}$item{{/pubVenue}} 169 169 </div> 170 170 #end 171 171 #end ... ... @@ -176,10 +176,9 @@ 176 176 ## status bottom / start 177 177 <div #if( $foreach.last )id="bottom"#end class="mainselectbottom"> 178 178 #set( $itemStatusNo = $itemMap[$status].size() ) 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()235 +$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 180 </div> 181 181 ## status bottom / end 182 182 #end 183 -## DISPLAY / END 184 184 {{/html}} 185 185 {{/velocity}}{{pageDisplay sort="objectservice"/}}