# # # build_admin_navbar() # # # This subroutine builds the admin navigation bar. subroutine(build_admin_navbar( bool is_root_admin, bool is_lite, node super_admin, node admin_navbar, string active_page), ( debug_message("\n#### build_admin_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_admin:\n" . node_as_string(super_admin) ."\n"); # debug_message("#### admin_navbar:\n" . node_as_string(admin_navbar) ."\n"); node item; bool show_page_link; string page; # Note, page is equal the feature name string label; string href; # # # Note, always create the nav bar, even if the page is not valid, simply # add a non breaking space if there is no valid admin link! # At a minimum we show the active page label anyway! # '
\n'; ''; ''; ''; foreach item admin_navbar ( page = @item{"page"}; show_page_link = true; # # Check if we have permission. Note that we allow the active page # even if there is no permission so that we have the label in the navbar # if (page ne active_page) then ( if (!is_lite) then ( if (is_root_admin) then ( # Root admin handling, don't show the non-root-admin My Account page show_page_link = (page ne "my_account"); ) else ( # Non-root admin handling # Check the super_admin if we have view permission for the specific page show_page_link = (?(super_admin . "." . page . ".view")); ); ) else ( # This is the Lite version, check if we allow this page in Lite show_page_link = @item{"show_in_lite"}; ); ); # # # If permission to view this page # # if (show_page_link) then ( # Note, we allow reloading the active page, so it mus be an anchor too. ''; ); ); ''; '
 '; label = expand(@item{"label"}); '' . label . ''; '
'; '
\n'; # admin_config_navbar debug_message("\n#### build_admin_navbar() END \n"); ));