{= # # # get matching log source files (used in Config/LogSource) # # debug_message("#### get_matching_files.cfv \n"); include "templates.util.base_util"; include "templates.util.rbac.rbac_util"; include "templates.util.encoding"; string profile_name = internal.profile_name; string session_id = volatile.session_id; bool is_root_admin = get_is_root_admin(); string page_token = v.fp.page_token; # # Check RBAC permissions # if ((is_root_admin or get_config_feature_permission(session_id, profile_name, "log_source", "view")) and get_is_valid_page_token(session_id, "log_source", page_token)) then ( debug_message("\nget matching log source files:\n" . node_as_string("v.fp") . "\n"); # # Get matching files # # Note, we don't sort the matching files! delete_node("v.temp_matching_files"); v.temp_matching_files = ""; get_files_matching_log_source("v.fp.log_source", "v.temp_matching_files"); # We need to convert all pathnames from UTF8 to local code page! string label; string files_dat = "["; debug_message("\nmatching files:\n" . node_as_string("v.temp_matching_files") . "\n"); int number_of_matched_files = num_subnodes("v.temp_matching_files"); if (number_of_matched_files > 0) then ( node file; string file_name; foreach file "v.temp_matching_files" ( file_name = node_value(file); file_name = convert_local_code_page_to_utf8(file_name); files_dat .= '"' . encode_json(file_name) . '",'; ); files_dat = replace_last(files_dat, ",", "]"); label = expand(lang_admin.log_source_matching_files.matched_multiple_label); ) else ( files_dat .= "]"; label = lang_admin.log_source_matching_files.no_match_label; ); # # Response # string dat = "{"; dat .= add_json("label", label, "string"); dat .= add_json("files", files_dat, "obj"); dat = close_json(dat); debug_message("\nget matching log source files dat:\n" . dat . "\n"); 'showMatchingFilesResponse(' . dat . ')\n'; ) else ( # No permission to access this resource (URL) display_no_permission_html(); ); =}