Changes for page Per Status
From version 70.1
edited by Andrea Omicini
on 02/01/2023 16:28
on 02/01/2023 16:28
Change comment:
There is no comment for this version
To version 67.6
edited by Andrea Omicini
on 18/11/2022 00:44
on 18/11/2022 00:44
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,92 +1,61 @@ 1 1 = {{italiano}}Per stato{{/italiano}}{{english}}Per Status{{/english}} = 2 2 3 3 {{include reference="Publications.Environment" excludeFirstHeading="true"/}}{{velocity}} 4 -## a Publications page 5 5 #set( $publicationMenu = true ) 6 6 #### get parameters 7 7 ## who 8 -#set( $userNamePar = $ request.user.trim() )9 -#set( $firstNamePar = $ request.name.trim() )10 -#set( $lastNamePar = $ request.surname.trim() )7 +#set( $userNamePar = $context.getRequest().getParameter("user") ) 8 +#set( $firstNamePar = $context.getRequest().getParameter("name") ) 9 +#set( $lastNamePar = $context.getRequest().getParameter("surname") ) 11 11 ## which status 12 -#set( request.status.trim()11 +#set($statusPar = $context.getRequest().getParameter("status")) 13 13 ## 14 14 #### handle who 15 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 ) 15 +## from a personal page, "XWiki.PersonalSpace" $userName form 16 + #set( $oneAuthor = true ) 23 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") ) 18 + #set( $authorFirstName = $userdoc.display("first_name") ) 19 + #set( $authorLastName = $userdoc.display("last_name") ) 20 +#elseif( $userNamePar ) 21 +## from the URL, "user=PersonalSpace" parameter 22 + #set( $oneAuthor = true) 23 + #set( $userdoc = $xwiki.getDocument("XWiki.$userNamePar") ) 24 + #set( $authorFirstName = $userdoc.display("first_name") ) 25 + #set( $authorLastName = $userdoc.display("last_name") ) 45 45 #elseif( $firstNamePar && $lastNamePar ) 46 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 ) 28 + #set( $oneAuthor = true ) 29 + #set( $authorFirstName = $firstNamePar ) 30 + #set( $authorLastName = $lastNamePar ) 51 51 #else 52 - #set( $apiceUser = false ) 53 - #set( $oneUser = false ) 54 - #set( $userFirstName = "" ) 55 - #set( $userLastName = "" ) 32 + #set( $oneAuthor = false ) 33 + #set( $authorFirstName = "" ) 34 + #set( $authorLastName = "" ) 56 56 #end 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 66 66 ## 67 67 #### handle status 68 68 ## $oneStatus false gets a list of statuses, true just one 69 69 #set( $oneStatus = false ) 70 70 ## $statusList gets the list of statuses to be shown 71 -#set( $statusList = [] ) 72 72 ## default: all unpublished papers except Rejected ones 73 -#set( $ discard= $statusList.addAll($unpublishedStatuses))42 +#set( $statusList = $statusRangeUnpublished ) 74 74 #if( $statusPar.toLowerCase() == "all" ) 75 75 ## 'all' value gets all unpublished papers including "Rejected" ones 76 - #set( discard= $statusList.add("rejected"))45 + #set($statusList = $statusRangeUnpublishedFull) 77 77 #else 78 - #if( $ allStatusesPlus.contains($statusPar) )47 + #if( $statusRangeFull.contains($statusPar) ) 79 79 ## 'status' parameter is an admissible publication status value 80 - #set( 81 - #set( 49 + #set($oneStatus = true) 50 + #set($statusList = [$statusPar]) 82 82 #end 83 83 #end 84 84 ## 85 85 {{id name="top"/}} 86 -#if( $one User )#if( $oneStatus )87 ->**{{pubStatus uppercase='true' plural='true'}}$statusPar{{/pubStatus}}** / $u serFirstName $userLastName55 +#if( $oneAuthor )#if( $oneStatus ) 56 +>**{{pubStatus uppercase='true' plural='true'}}$statusPar{{/pubStatus}}** / $authorFirstName $authorLastName 88 88 #else 89 ->**{{pubStatus uppercase='true' plural='true'}}unpublished{{/pubStatus}}** / $u serFirstName $userLastName58 +>**{{pubStatus uppercase='true' plural='true'}}unpublished{{/pubStatus}}** / $authorFirstName $authorLastName 90 90 #end#elseif($oneStatus) 91 91 >{{pubStatus uppercase='true' plural='true'}}$statusPar{{/pubStatus}} 92 92 #else ... ... @@ -97,9 +97,10 @@ 97 97 (% style="font-size: smaller; padding:1em 1.5em 0.25em 1.5em; background-color:$theme.highlightColor" %)(((#foreach( $status in $statusList )#if( $foreach.index > 0 ) | #end[[{{pubStatus}}$status{{/pubStatus}}>>||anchor=$status]]#end))) 98 98 #end 99 99 ## 69 +$statusList 100 100 #foreach( $status in $statusList ) 101 - #set( $from = ", BaseObject as obj, LargeStringProperty as prop0, LargeStringProperty as prop1, StringProperty as prop2" )102 - #set( $where = "obj.name 2.id.id = obj.id and prop0.nameprop1.name = 'editor' and(serString' or( prop0.value=''andprop1.value like '$userString')and prop2.name = 'status' and prop2.value = '$status'" )71 + #set( $from = ", BaseObject as obj, LargeStringProperty as prop0, StringProperty as prop1" ) 72 + #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 prop0.name='author' and (prop0.value like '%$authorFirstName $authorLastName%' or prop0.value like '%$authorLastName, $authorFirstName%') and prop1.name = 'status' and prop1.value = '$status'" ) 103 103 #set( $sql = $from + " where " + $where ) 104 104 #set( $pubFound = $xwiki.searchDocuments($sql) ) 105 105 #set( $pubStatusNo = $pubFound.size() ) ... ... @@ -108,7 +108,7 @@ 108 108 (% style="border-style:solid hidden hidden solid; border-color:$theme.borderColor; text-align:left; font-style:oblique" %)|{{id name='$sort'/}}{{pubStatus plural='true' uppercase='true'}}$status{{/pubStatus}}{{id name="$status"/}} 109 109 #end 110 110 #foreach( $pub in $pubFound )#if( $xwiki.exists($pub) )#set( $pubDoc = $xwiki.getDocument($pub) )#if( $pubDoc.getObject("${objectSpace}.${objectClass}") )## handling visibility at show time 111 -|{{pub inline='false' linked='t itle'}}$pub{{/pub}}81 +|{{pub inline='false' linked='true'}}$pub{{/pub}} 112 112 #end#end#end 113 113 (% style="#if( !$oneStatus )border-style:hidden solid solid hidden;#end border-color:$theme.borderColor; text-align:right; font-style:oblique; font-weight:normal; font-size:smaller; color:gray" %)|($pubStatusNo #if( $pubStatusNo > 1 ){{pubStatus plural='true'}}$status{{/pubStatus}}#else{{pubStatus plural='false'}}$status{{/pubStatus}}#end) [[[top]>>||anchor="top"]] 114 114 #end