# # particular_file_access snapon # # This snapon tracks the number of accesses on a particular file. # particular_file_access = { label = "$lang_admin.snapons.particular_file_access.label" comment = "$lang_admin.snapons.particular_file_access.comment" config_snapon_category = "" parameters = { page_field = { parameter_value = "page" validation_type = "string" form_element_label = "$lang_admin.snapons.particular_file_access.parameters.page_field.form_element_label" form_element_type = "select" select_options_source = "database_fields" description = "" } # page_field pathname = { parameter_value = "$lang_admin.snapons.particular_file_access.parameters.pathname.parameter_value" validation_type = "string" form_element_label = "$lang_admin.snapons.particular_file_access.parameters.pathname.form_element_label" form_element_type = "text" form_element_width = "380" description = "" } # pathname counting_field = { parameter_value = "$lang_admin.snapons.particular_file_access.parameters.counting_field.parameter_value" validation_type = "field_label" validate_field_label_for = { database_fields = true report_fields = true } form_element_label = "$lang_admin.snapons.particular_file_access.parameters.counting_field.form_element_label" form_element_type = "text" form_element_width = "380" description = "This is the label for the database field and report field added by the snapon, to count accesses on the file." } # counting_field } # parameters parameters_form = { group_1 = { description = "$lang_admin.snapons.particular_file_access.parameters_form.group_1.description" parameters = { page_field = true pathname = true counting_field = true } # parameters } # group 1 } # parameters_form attach_operations = { # When attaching: Add the particular_file_accesses database field add_counting_field_database_field = { type = "add_database_fields" fields = { "{= @parameters{'counting_field'}{'final_node_name'} =}" = { label = "{= @parameters{'counting_field'}{'parameter_value'} =}" type = "int" database_field = "{= @parameters{'counting_field'}{'final_node_name'} =}" derivation_method = "database_filter" category = "" aggregation_method = "sum" index = "true" suppress_top = "0" suppress_bottom = "2" integer_bits = "0" } # particular_file_access } # fields } # add_counting_field_database_field # When attaching: Add a database filter to set counting_field to 1 whenever page_field contains the pathname add_database_filter = { type = "add_database_filters" filters = { "{= @parameters{'counting_field'}{'final_node_name'} =}" = { expression = `if ({= @parameters{'page_field'}{'parameter_value'} =} eq "{= @parameters{'pathname'}{'parameter_value'} =}") then {= @parameters{'counting_field'}{'final_node_name'} =} = 1;` } # particular_file_access } # filters } # add_database_filter # When attaching: Add the particular_file_access report field add_counting_field_report_field = { type = "add_report_fields" fields = { "{= @parameters{'counting_field'}{'final_node_name'} =}" = { label = "{= @parameters{'counting_field'}{'parameter_value'} =}" column_label = "" column_info = "" database_field = "{= @parameters{'counting_field'}{'final_node_name'} =}" display_format_type = "integer" show_remainder_value = true show_average_value = true show_min_value = true show_max_value = true show_total_value = true percent_calculation = "sum" } # particular_file_access } # fields } # add_counting_field_report_field # When attaching: Add the particular_file_access field to all xref groups add_counting_field_xref_fields = { type = "add_xref_fields" xref_group = "*" fields = { "{= @parameters{'counting_field'}{'final_node_name'} =}" = "" } # fields } # add_counting_field_xref_fields # When attaching: Add the particular_file_access column to all report elements add_counting_field_report_column = { type = "add_report_element_columns" report = "*" report_element = "*" columns = { "{= @parameters{'counting_field'}{'final_node_name'} =}" = { report_field = "{= @parameters{'counting_field'}{'final_node_name'} =}" show_column = true show_percent_column = false show_bar_column = false show_graph = true } # particular_file_access } # columns } # add_counting_field_report_column } # attach_operations } # particular_file_access