#* -------------------------------------------------------------- Global variables -- modify these as necessary to alter the behavior of the menu --------------------------------------------------------------- *# #set ( $defaultPageName = "index" ) #* -------------------------------------------------------- DO NOT EDIT below this point -------------------------------------------------------- *# #* ----------------------------------------- Macros -- these MUST remain at the beginning of the file ----------------------------------------- *# #* outputAssetLabel -- Macro for showing a given asset's display-name or title. Looks, in order, for: title, display-name, system name. @param $asset -- a JDOM element representing a Cascade asset (i.e. system-page, system-folder, system-symlink, etc.) *# #macro ( outputAssetLabel $asset ) ## Grab "title" #set ( $assetTitle = $asset.getChild("title") ) ## Grab "display-name" #set ( $assetDisplayName = $asset.getChild("display-name") ) #if ( $assetTitle && $assetTitle.value != "" ) #set ( $theAssetTitle = $assetTitle ) #elseif ( $assetDisplayName && $assetDisplayName.value != "" ) #set ( $theAssetTitle = $assetDisplayName ) #else #set ( $theAssetTitle = $asset.getChild("name") ) #end ## Cascade Server version 6.10+ ## Use $_SerializerTool.serialize($theAssetTitle, true) for versions previous to 6.10 $_EscapeTool.xml($theAssetTitle.value) #end #* loopFolder -- Macro for looping over a folder. Recursive calls for each "level" of the navigation. After each recusrion, the level is reset for the next item in line. @param $theFolder -- a JDOM element representing a Cascade folder (i.e. system-folder) *# #macro ( loopFolder $theFolder ) #set ( $children = $_XPathTool.selectNodes($theFolder, "system-folder[dynamic-metadata[name = 'show-in-top-nav']/value = 'Yes'] | system-page[dynamic-metadata[name = 'show-in-top-nav']/value = 'Yes'] | system-symlink[dynamic-metadata[name = 'show-in-top-nav']/value = 'Yes']") ) ## Check for assets #if ( $children.size() > 0 ) #if ( $level == 1 ) #set ( $column = 1 ) ## Loop through folder #foreach ( $item in $children ) #if ( $column > 4 ) #break #end
#outputAssetLabel($item) #set ( $level = $level + 1 ) #loopFolder($item) #set ( $level = 1 )
## Reset the level for the next first level item. #set ( $column = $column + 1 ) #end #elseif ( $level == 2 ) #elseif ( $level == 3 ) #end #end #end #* -------------------------------------- Main rendering construct -------------------------------------- *# ## Defines the current menu level #set ( $level = 0 ) ## Abstract out the "system-index-block" node #set ( $sib = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block") ) ## Gather "system-page" and "system-folder" nodes #set ( $items = $_XPathTool.selectNodes($sib, "system-folder[dynamic-metadata[name = 'show-in-top-nav']/value = 'Yes']") ) ## Make the site map #if ( $items.size() > 0 ) #end