{= # # # get_directory_items.cfv # # include "templates.util.base_util"; include "templates.util.encoding"; include "templates.util.rbac.rbac_util"; include "templates.file_manager.file_manager_util"; # This subroutine gets the directory items of the given pathname debug_message("\n#### get_directory_items.cfv START\n"); string session_id = volatile.session_id; bool is_file_manager_permission = get_is_file_manager_permission(); string page_token = v.fp.page_token; if (is_file_manager_permission and get_is_valid_page_token(session_id, "file_manager", page_token)) then ( string item_id = v.fp.item_id; bool is_image_actor = v.fp.is_image_actor; # Required for client only! bool is_anchor_actor = v.fp.is_anchor_actor; # Required for client only! string pathname_in_utf8 = v.fp.pathname; pathname_in_utf8 = replace_all(pathname_in_utf8, "__HexEsc__5C", "\\"); string pathname_in_local_code_page = convert_utf8_to_local_code_page(pathname_in_utf8); # # # Make sure that the client pathname still exists (it could have been renamed or deleted) # # bool is_valid_pathname = file_exists(pathname_in_local_code_page); # # # Get directory items # # string items_dat; if (is_valid_pathname) then ( string id_prefix = item_id; items_dat = get_directory_contents_dat(id_prefix, pathname_in_local_code_page, ""); ) else ( items_dat = "[]"; ); # # # # Send response # # # string dat = "{"; dat .= add_json("itemId", item_id, "string"); dat .= add_json("isImageActor", is_image_actor, "bool"); dat .= add_json("isAnchorActor", is_anchor_actor, "bool"); dat .= add_json("isValidPathname", is_valid_pathname, "bool"); dat .= add_json("items", items_dat, "obj"); dat = close_json(dat); 'fileManager.getDirectoryItemsResponse(' . dat . ')\n'; ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); =}