$templates.shared.doctype {= expand(templates.shared.content_type); =} {= # debug_message(node_as_string("volatile.form_processing") . "\n"); string form_type = volatile.form_processing.form_type; string action_name = volatile.form_processing.action_name; string schedule_id; if (form_type eq "new") then ( # generate new unique node name (schedule_id) # Find an unused task number int schedule_id = 1; while (subnode_exists("schedule", schedule_id)) ( schedule_id++; ); ) else ( schedule_id = volatile.form_processing.schedule_id; # Delete existing schedule node if (node_exists("schedule." . schedule_id)) then ( delete_node("schedule." . schedule_id); ); save_changes(); ); # ------------------------------------------------------------- # Decompose day value, split into day_of_month and day_of_week; # ------------------------------------------------------------- int day = volatile.form_processing.day; string day_of_month = "*"; string day_of_week = "*"; if (day > 0) then ( if (day > 100) then ( day_of_week = day; day_of_week = replace_first(day_of_week, "10", ""); ) else ( day_of_month = day; ); ); # debug_message("day: " . day . "\n"); # debug_message("day_of_month: " . day_of_month . "\n"); # debug_message("day_of_week: " . day_of_week . "\n"); # ------------------- # Write schedule_node # ------------------- string schedule_path = "schedule." . schedule_id; string schedule_options_path = "schedule." . schedule_id . ".options"; schedule_path . ".action" = action_name; schedule_path . ".profile" = volatile.form_processing.profile_name; schedule_path . ".month" = volatile.form_processing.month; schedule_path . ".day_of_month" = day_of_month; schedule_path . ".day_of_week" = day_of_week; schedule_path . ".hour" = volatile.form_processing.hour; schedule_path . ".minute" = volatile.form_processing.minute; schedule_path . ".extra_options" = volatile.form_processing.extra_options; if ((action_name eq "send_report_by_email") or (action_name eq "generate_report_files")) then ( schedule_path . ".language" = volatile.form_processing.language; schedule_options_path . ".rn" = volatile.form_processing.report_name; string schedule_date_time_filter_path = "schedule." . schedule_id . ".date_time_filter"; if (node_exists(schedule_date_time_filter_path)) then ( delete_node(schedule_date_time_filter_path); ); bool date_time_filter_active = volatile.form_processing.date_time_filter_active; schedule_date_time_filter_path . ".active" = date_time_filter_active; if (date_time_filter_active) then ( schedule_date_time_filter_path . ".back_count" = volatile.form_processing.date_time_filter_back_count; schedule_date_time_filter_path . ".back_count_unit" = volatile.form_processing.date_time_filter_back_count_unit; schedule_date_time_filter_path . ".include_scheduler_execution_date" = volatile.form_processing.include_scheduler_execution_date; ); ); if (action_name eq "send_report_by_email") then ( schedule_options_path . ".rca" = volatile.form_processing.recipient_email_address; schedule_options_path . ".rna" = volatile.form_processing.return_email_address; schedule_options_path . ".res" = volatile.form_processing.email_subject; schedule_options_path . ".ss" = volatile.form_processing.smtp_server_hostname; ); if ((action_name eq "generate_report_files") or (action_name eq "generate_all_report_files")) then ( schedule_options_path . ".ghtd" = volatile.form_processing.generate_html_to_directory; schedule_options_path . ".gpff" = volatile.form_processing.generate_pdf_friendly_files; ); if (action_name eq "remove_database_data") then ( string schedule_filter_path = "schedule." . schedule_id . ".filter"; bool custom_expression = volatile.form_processing.remove_db_data_custom_expression; schedule_options_path . ".f" = volatile.form_processing.remove_db_data_filter_expression; schedule_filter_path . ".custom_expression" = custom_expression; if (custom_expression) then ( schedule_filter_path . ".number_of_days" = ""; ) else ( schedule_filter_path . ".number_of_days" = volatile.form_processing.remove_db_data_number_of_days; ); ); save_changes(); =}