{=
subroutine(generate_submenu(string itemsnode, bool expanded, string profile_name), (
# itemsnode;
string item;
foreach item (itemsnode) (
# If this is a "leaf", display the view button
if ($(item . ".type") eq "view") then (
# Start the div
"
\n";
# Recursively generate the submenu (hidden)
generate_submenu(item . ".items", false, profile_name);
); # if group
); # foreach item
)); # generate_submenu()
# Generate the left menu from the statistics.report_menu node
generate_submenu("templates.config.left_navigation_structure", true, profile_name);
# debug_message("building report menu complete\n");
clear_session_changes();
=}