#* -------------------------------------------------------------- Global variables -- modify these as necessary to alter the behavior of the menu --------------------------------------------------------------- *# #set ( $maxMenuLevels = 3 ) #set ( $defaultPageName = "index" ) #* -------------------------------------------------------- DO NOT EDIT below this point -------------------------------------------------------- *# #* ----------------------------------------- Macros -- these MUST remain at the beginning of the file ----------------------------------------- *# #* setAssetName -- sets a global variable ($assetName) containing the best available name for the given asset. Looks, in order, for: display-name, title, system name. @param $asset -- a JDOM element representing a Cascade asset (i.e. system-page, system-folder, system-symlink, etc.) *# #macro ( setAssetName $asset ) #set ( $assetName = "" ) #if ( $asset.getChild("display-name") ) #set ( $assetName = $_SerializerTool.serialize($asset.getChild("display-name"),true).toUpperCase() ) #elseif ( $asset.getChild("title") ) #set ( $assetName = $_SerializerTool.serialize($asset.getChild("title"),true).toUpperCase() ) #else #set ( $assetName = $asset.getChild("name").value.toUpperCase() ) #end #end #* buildMenuItem -- Constructs the appropriate menu item link for the given asset. If the asset is a system-folder, this macro will recursively execute for all child assets of the folder, until reaching the $maxMenuLevels threshold defined in the global variable above. @param $asset -- a JDOM element representing a Cascade asset (i.e. system-page, system-folder, system-symlink, etc.) @param $topLevelItemNum -- the number of the top-level menu item under which this menu item resides. *# #macro ( buildMenuItem $asset $topLevelItemNum ) ## set the menu item display text -- $assetName #setAssetName ( $asset ) #set ( $id = "" ) #if ( $level == 1 ) #set ( $id = "id='item${topLevelItemNum}'" ) #end ## handle creation of menu item for folder assets #if ( $asset.getName().equals("system-folder") ) #set ( $folderIndex = false ) #set ( $folderIndex = $_XPathTool.selectSingleNode($asset,"system-page[name = '${defaultPageName}'] | system-symlink[name = '${defaultPageName}']") ) #* #set ( $href = "#" ) *# ## if the folder contains a landing page, set the href of the menu item to that page #if ( $folderIndex ) #set ( $href = $folderIndex.getChild("link").value ) #else #* if ( $level == $maxMenuLevel ) *# ## if we are at the last level, we will not have any child asset data ## in the index block, so if the folder has show-in-top-nav set to 'Yes' ## we will assume there is a landing page for the folder #set ( $href = $asset.getChild("link").value + "/${defaultPageName}" ) #end ## output the menu item for the folder itself #if ( $level == 1 ) #set( $subCheck = $subCheck - 1 )