Changes for page Per Status

From version 86.6
edited by Andrea Omicini
on 22/06/2023 12:15
Change comment: There is no comment for this version
To version 86.10
edited by Andrea Omicini
on 22/06/2023 12:52
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -107,22 +107,48 @@
107 107  #set( $itemNo = 0 )
108 108  ## cycle over sorts
109 109  #foreach( $status in $statusList )
110 - #set( $from = ", BaseObject as obj, LargeStringProperty as prop0, LargeStringProperty as prop1, StringProperty as prop2, StringProperty as prop3" )
111 - #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'#if( !$hasEdit ) and prop3.value <> 'hidden'#end" )
112 - #set( $sql = $from + " where " + $where )
113 - #set( $pubFound = $xwiki.searchDocuments($sql) )
114 - #set( $pubStatusNo = $pubFound.size() )
115 - #if( $pubStatusNo > 0 )
116 - #set( $pubMap[$status] = $pubFound )
117 - #set( $pubNo = $pubNo + $pubStatusNo )
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) )
113 +## set counters
114 + #set( $itemStatusNo = $itemFound.size() )
115 + #if( $itemStatusNo > 0 )
116 + #set( $itemMap[$status] = $itemFound )
117 + #set( $itemNo = $itemNo + $itemStatusNo )
118 118   #end
119 119  #end
120 +##
120 120  ## output results
121 121  ## page subtitle
122 -{{id name="top"/}}
123 ->(%%)$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}(%%)
123 +<div style="display: flex">
124 + <div class="mainheader">
125 +$itemNo
126 +#if( $oneStatus )
127 + #if( $itemNo == 1 )
128 + $services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}").toLowerCase()
129 + #else
130 +$services.localization.render("${objectSpace}.${objectClass}_status_${statusList[0]}_plural").toLowerCase() #end
131 +#else
132 + #if( $itemNo == 1 )
133 + $services.localization.render('yetunpublished_singular').toLowerCase()
134 + #else
135 + $services.localization.render('yetunpublished').toLowerCase()
136 + #end
137 +#end
138 +#if( $oneUser )
139 + <span class="textsecondary">&ensp;/&ensp;</span>
140 + $userFirstName $userLastName
141 +#end
142 + </div>
143 + <div style="flex-grow: 1">
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>
148 + </div>
149 +</div>
124 124  ## stop if no pubs are found
125 -#if( $pubNo == 0 || $pubMap.keySet().size() == 0 )
151 +#if( $itemNo == 0 || $itemMap.keySet().size() == 0 )
126 126  ## redundant double check
127 127   #stop
128 128  #end