Changes for page 3D Printing
Last modified by Josh McGee on 2026/01/21 13:23
From version 51.1
edited by Josh McGee
on 2025/11/19 10:48
on 2025/11/19 10:48
Change comment:
There is no comment for this version
To version 37.1
edited by Josh McGee
on 2025/11/19 10:36
on 2025/11/19 10:36
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -15,38 +15,36 @@ 15 15 16 16 17 17 {{velocity}} 18 -## List all direct subpages of Areas > Upstairs > 3D Printers 19 -#macro(list3DPrintersSubpages) 20 - ## Current wiki name 21 - #set($wikiName = $xcontext.database) 18 +## 19 +## Velocity macro to list all subpages of the "Areas" page 20 +## 21 +#macro(listAreasSubpages) 22 + ## Full name of the parent document (top-level page "Areas") 23 + #set($parentDocFullName = 'Areas.WebHome') 22 22 23 - ## Build a document reference for Areas.Upstairs."3D Printers".WebHome 24 - #set($parentRef = $services.model.createDocumentReference( 25 - $wikiName, 26 - ['Areas', 'Upstairs', '3D Printers'], 27 - 'WebHome' 28 - )) 25 + ## HQL: get all non-hidden children whose parent is Areas.WebHome 26 + #set($hql = 27 + "select doc.fullName " + 28 + "from XWikiDocument doc " + 29 + "where doc.parent = :parent and doc.hidden <> true " + 30 + "order by doc.name asc" 31 + ) 29 29 30 - ## Get the parent document 31 - #set($parentDoc = $xwiki.getDocument($parentRef)) 33 + #set($children = $services.query.hql($hql) 34 + .bindValue('parent', $parentDocFullName) 35 + .execute()) 32 32 33 - ## Get its direct children 34 - #set($children = $parentDoc.getChildren()) 35 - 36 - #if(!$children || $children.isEmpty()) 37 - No subpages found under [[Areas.Upstairs.3D Printers]]. 37 + #if($children.isEmpty()) 38 + No subpages found under **Areas**. 38 38 #else 39 - #foreach($childRef in $children) 40 - ## Resolve each child reference to a document 41 - #set($childDoc = $xwiki.getDocument($childRef)) 42 - * [[$childDoc.getDisplayTitle()>>$childDoc]] 40 + #foreach($childFullName in $children) 41 + #set($childDoc = $xwiki.getDocument($childFullName)) 42 + * [[$childDoc.displayTitle>>$childDoc.getURL('view')]] 43 43 #end 44 44 #end 45 45 #end 46 46 47 47 ## Call the macro 48 -#list 3DPrintersSubpages()48 +#listAreasSubpages() 49 49 {{/velocity}} 50 50 51 - 52 -