{= # # # # get_log_format_options.cfv # # # include "templates.util.base_util"; include "templates.util.encoding"; include "templates.util.rbac.rbac_util"; debug_message("\n#### get_log_format_options.cfv START \n"); 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_admin_feature_permission(session_id, "profiles", "add")) and get_is_valid_page_token(session_id, "new_profile_wizard", page_token)) then ( string log_format = v.fp.log_format; string create_profile_wizard_options_path = "log_formats." . log_format . ".create_profile_wizard_options"; # # # check for numerical log format options # # string numerical_fields_array = '['; string numerical_field_item; if (node_exists("log_formats." . log_format . ".database.numerical_fields")) then ( # log_fields_path is used to lookup numerical field labels, espically in the case # of custom log formats where labels do not depend on lang_stats! string log_fields_path = "log_formats." . log_format . ".log.fields"; node numerical_fields_node = "log_formats." . log_format . ".database.numerical_fields"; node numerical_field; string label; string name; bool add_field; foreach numerical_field numerical_fields_node ( name = node_name(numerical_field); if (node_exists(log_fields_path . "." . name . ".label") and (node_value(log_fields_path . "." . name . ".label") ne "")) then ( label = node_value(log_fields_path . "." . name . ".label"); ) else if (subnode_exists(numerical_field, "label")) then ( label = node_value(subnode_by_name(numerical_field, "label")); ) else if node_exists("lang_stats.field_labels." . name) then ( label = node_value("lang_stats.field_labels." . name); ) else ( label = name; ); label = capitalize(expand(label)); add_field = node_value(subnode_by_name(numerical_field, "default")); numerical_field_item = "{"; numerical_field_item .= add_json("name", name, "string"); numerical_field_item .= add_json("label", label, "string"); numerical_field_item .= add_json("add_field", add_field, "bool"); numerical_field_item = close_json(numerical_field_item); numerical_fields_array .= numerical_field_item . ","; ); numerical_fields_array = replace_last(numerical_fields_array, ",", "]"); ) else ( numerical_fields_array .= ']'; ); debug_message("log format options - numerical_fields_array:\n " . numerical_fields_array . "\n"); # # Server response # 'server_response_log_format_options(' . numerical_fields_array . ')\n'; ) else ( # No permission to view this resource (URL) display_no_permission_html(); ); =}