{= # # # get_session_paths_rows.cfv # # # Called from client to add rows of a specific path item # # include "templates.util.base_util"; include "templates.util.encoding"; debug_message("\n\n\n#### get_session_paths_rows.cfv START \n"); string profile_name = internal.profile_name; string session_id = volatile.session_id; bool is_root_admin = get_is_root_admin(); bool is_access_reports = is_root_admin or get_access_reports_permission(session_id, profile_name); string page_token = v.fp.page_token; if (is_access_reports and get_is_valid_page_token(session_id, "statistics", page_token)) then ( debug_message("\n" . node_as_string("v.fp") . "\n\n"); # # Note, the short_report_element_id and the_path is re-send to the client as reference # string short_report_element_id = v.fp.short_report_element_id; string report_element_id = v.fp.report_element_id; string the_path = v.fp.the_path; # the path with underbars int starting_row = v.fp.starting_row; int ending_row = v.fp.ending_row; node raw_report_element = "profiles_cache." . profile_name . ".raw_report_elements." . report_element_id; # KHP-RC --> GET maximum_text_length FROM CLIENT! # node text_sizes = raw_report_element . ".options.sizes.session_path"; # int maximum_text_length = @text_sizes{"maximum_text_length"}; int maximum_text_length = 200; node next_pages; if (the_path ne "root") then ( next_pages = raw_report_element . ".data.next_pages." . replace_all(the_path, "_", ".next_pages.") . ".next_pages"; ) else ( # Load rows of root tree next_pages = raw_report_element . ".data.next_pages"; ); # # # Assemble rows in javascript object # # node item; string path_id; string page_name; string events; string item_dat; string next_pages_dat = "["; for (int i = starting_row - 1; i < ending_row; i++) ( item = subnode_by_number(next_pages, i); path_id = node_name(item); page_name = @item{"page"}; events = format(@item{"events"},"integer"); if (length(page_name) > maximum_text_length) then ( page_name = substr(page_name, 0, maximum_text_length) . "..."; ); item_dat = "{"; item_dat .= add_json("id", path_id, "string"); item_dat .= add_json("page", page_name, "string"); item_dat .= add_json("events", events, "string"); item_dat .= add_json("expanded", "false", "bool"); item_dat = close_json(item_dat) . ","; next_pages_dat .= item_dat; ); next_pages_dat = replace_last(next_pages_dat, ",", "]"); # # # Send response # # string dat = "{"; dat .= add_json("sid", short_report_element_id, "string"); dat .= add_json("thePath", the_path, "string"); dat .= add_json("nextPages", next_pages_dat, "obj"); dat = close_json(dat); debug_message("\n\n#### getSessionPathsItemsResponse dat:\n". dat . "\n\n"); "sessionPaths.addRowsResponse(" . dat . ")\n"; ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); =}