# # # build_config_navbar() # # # This subroutine builds the config menu. subroutine(build_config_navbar( bool is_root_admin, bool is_lite, node super_role_config, string profile_name, string active_page), ( debug_message("\n#### build_config_navbar() START \n"); # debug_message("#### is_root_admin: " . is_root_admin . "\n"); # debug_message("#### is_lite: " . is_lite . "\n"); # debug_message("#### active_page: " . active_page . "\n"); # debug_message("#### super_role_config:\n" . node_as_string(super_role_config) ."\n"); node item; string feature_name; # # # Get final config navbar node # # node config_navbar; if (is_root_admin and !is_lite) then ( config_navbar = "templates.config_pages.config_navbar.pro_enterprise"; ) else if (!is_lite) then ( # Handle RBAC permissions # We clone the pro_enterprise config_navbar node to v.my_config_navbar # because we delete any navbar item where the user has no permission delete_node("v.my_config_navbar"); v.my_config_navbar = ""; clone_node("templates.config_pages.config_navbar.pro_enterprise", "v.my_config_navbar"); config_navbar = "v.my_config_navbar"; foreach item config_navbar ( feature_name = node_name(item); if ((feature_name ne active_page) and !super_role_config?{feature_name}) then ( delete_node(item); ); ); ) else ( # Lite version config_navbar = "templates.config_pages.config_navbar.lite"; ); # # # Start building the navbar # # # We show the More Options link if there are more than 9 config navbar items, # in this case we display maximum 7 items (or 8 items if the active page is form More Options) # and hide all other items in the More Options menu '
\n'; string feature_label; int item_count; int number_of_items = num_subnodes(config_navbar); int number_of_items_in_display = if (number_of_items > 9) then (7) else (number_of_items); # bool is_more_options_menu = (num_subnodes(config_navbar) > 9); bool active_page_has_been_set = false; bool is_active_item; string href; string more_options_items = ""; bool is_more_options_item; foreach item config_navbar ( feature_name = node_name(item); feature_label = @("lang_admin.general." . feature_name); is_active_item = (feature_name eq active_page); href = "?dp=config&page=" . feature_name . "&p=" . profile_name; is_more_options_item = (item_count >= number_of_items_in_display); # # Note, if the active item is from the more options menu then the item # is added to the regulat navbar as last item and to the more options menu! # if (is_active_item or !is_more_options_item) then ( '' . feature_label . ''; ); if (is_more_options_item) then ( more_options_items .= '
  • ' . feature_label . '
  • '; ); item_count++; ); if (more_options_items ne "") then ( # # Add More Options link and drop down # # Firefox does always underline the image, although we only want the text to be underlined. # Hence the span hack where we apply the underline to the span only! ''; '' . lang_admin.general.more_options . ''; ''; ''; '
    '; # admin_config_navbar # Drop down ''; ) else ( ''; # admin_config_navbar ); debug_message("\n#### build_config_navbar() END \n"); ));