$templates.shared.doctype {= include "templates.shared.util.encode_js"; # ------------------------ # check number of profiles # ------------------------ # If no profile exist then don't allow to open the scheduler! int number_of_profiles = num_subnodes("profiles"); # ---------------------------- # Check scheduler default view # ---------------------------- bool view_by_tasks = true; if (node_exists("preferences.miscellaneous.scheduler_view_by_tasks")) then ( view_by_tasks = node_value("preferences.miscellaneous.scheduler_view_by_tasks"); ); # -------------------------- # Subroutine build_view_node # -------------------------- subroutine(build_view_node(bool view_by_tasks), ( if (node_exists("volatile.temp.primary_fields")) then ( delete_node("volatile.temp.primary_fields"); ); node item; string action_name; string action_label; string profile_name; string profile_label; string profile_position; string schedule_id; int field_id; # is equal number of subnodes in secondary_fields node string volatile_path; foreach item "schedule" ( action_name = node_value(subnode_by_name(item, "action")); # For backward compatibility check for generate_all_report_files nodes! # generate_all_report_files become generate_report_files! if (action_name eq "generate_all_report_files") then ( action_name = "generate_report_files"; ); action_label = node_value("lang_options.command_line." . action_name . ".label"); profile_name = node_value(subnode_by_name(item, "profile")); schedule_id = node_name(item); if (profile_name eq "*") then ( profile_name = "esc_all_profiles"; profile_label = lang_admin.scheduler.all_profiles_label; profile_position = "0"; ) else ( if (node_exists("profiles." . profile_name)) then ( profile_label = node_value("profiles." . profile_name . ".label"); if (contains(profile_label, "$")) then (profile_label = replace_all(profile_label, "$", "$")); ) else ( profile_label = profile_name; profile_name = "esc_no_profile_" . profile_name; ); profile_position = profile_label; ); if (view_by_tasks) then ( # ---------------- # if view by tasks # ---------------- if (!node_exists("volatile.temp.primary_fields." . action_name . "label")) then ( "volatile.temp.primary_fields." . action_name . ".label" = action_label; "volatile.temp.primary_fields." . action_name . ".position" = action_label; ); if (!node_exists("volatile.temp.primary_fields." . action_name . ".secondary_fields")) then ( field_id = 0; ) else ( field_id = num_subnodes("volatile.temp.primary_fields." . action_name . ".secondary_fields"); ); volatile_path = "volatile.temp.primary_fields." . action_name . ".secondary_fields." . field_id; volatile_path . ".schedule_id" = schedule_id; volatile_path . ".label" = profile_label; volatile_path . ".position" = profile_position; ) else ( # ------------------- # if view by profiles # ------------------- if (!node_exists("volatile.temp.primary_fields." . profile_name . "label")) then ( "volatile.temp.primary_fields." . profile_name . ".label" = profile_label; "volatile.temp.primary_fields." . profile_name . ".position" = profile_position; ); if (!node_exists("volatile.temp.primary_fields." . profile_name . ".secondary_fields")) then ( field_id = 0; ) else ( field_id = num_subnodes("volatile.temp.primary_fields." . profile_name . ".secondary_fields"); ); volatile_path = "volatile.temp.primary_fields." . profile_name . ".secondary_fields." . field_id; volatile_path . ".schedule_id" = schedule_id; volatile_path . ".label" = action_label; volatile_path . ".position" = action_label; ); ); # foreach item # debug_message("NEW TEMP TASK NODE SORTED\n" . node_as_string("volatile.temp.primary_fields") . "\n"); )); # ------------------------------ # Subroutine get_schedule_string # ------------------------------ subroutine(get_schedule_string(string schedule_id), ( node schedule = "schedule." . schedule_id; string month = node_value(subnode_by_name(schedule, "month")); string day; string day_of_month = node_value(subnode_by_name(schedule, "day_of_month")); string day_of_week = node_value(subnode_by_name(schedule, "day_of_week")); string hour = node_value(subnode_by_name(schedule, "hour")); string minute = node_value(subnode_by_name(schedule, "minute")); if (month eq "*") then ( month = lang_admin.scheduler.any_month; ) else ( month = node_value("lang_stats.months." . month); ); day = lang_admin.scheduler.any_day; if (day_of_month ne "*") then ( day = lang_admin.scheduler.day . " " . day_of_month; ); if (day_of_week ne "*") then ( day = node_value("lang_stats.weekdays." . day_of_week); ); if (hour ne "*") then ( if (length(hour) == 1) then ( hour = "0" . hour; ); ) else ( hour = lang_admin.scheduler.any_hour; ); if (minute ne "*") then ( if (length(minute) == 1) then ( minute = "0" . minute; ); ) else ( minute = lang_admin.scheduler.any_minute; ); month . ", " . day . ", " . hour . ":" . minute; )); # --------------------------- # Subroutine build_view_table # --------------------------- subroutine(build_view_table(bool view_by_tasks), ( sort("volatile.temp.primary_fields", "field:position,alphabetical,ascending"); # debug_message("NEW TEMP TASK NODE SORTED\n" . node_as_string("volatile.temp.primary_fields") . "\n"); '\n'; node primary_field; string primary_field_name; string primary_field_label; foreach primary_field "volatile.temp.primary_fields" ( primary_field_name = node_name(primary_field); primary_field_label = node_value(subnode_by_name(primary_field, "label")); '\n'; '\n'; '\n'; node secondary_field; node secondary_fields_node = primary_field . ".secondary_fields"; string secondary_field_label; string schedule_id; string action_name; string profile_name; string report_name; string report_label; string recipient_email_address; string generate_html_to_directory; bool generate_pdf_friendly_files; string remove_database_data_filter; string number_of_days; string extra_options; string delete_label; # Sort the secondary field sort(secondary_fields_node, "field:position,alphabetical,ascending"); foreach secondary_field secondary_fields_node ( secondary_field_label = node_value(subnode_by_name(secondary_field, "label")); schedule_id = node_value(subnode_by_name(secondary_field, "schedule_id")); profile_name = node_value("schedule." . schedule_id . ".profile"); action_name = node_value("schedule." . schedule_id . ".action"); # delete_label = replace_all(primary_field_label, "'", "\'") . ", " . replace_all(secondary_field_label, "'", "\'"); delete_label = encode_js(primary_field_label) . ", " . encode_js(secondary_field_label); '\n'; '\n'; '\n'; '\n'; '\n'; '\n'; ); # foreach secondary_field ); # foreach primary_field; '
' . primary_field_label . ''; if (starts_with(primary_field_name, "esc_no_profile")) then ( ' [ ' . lang_admin.scheduler.profile_does_not_exist_info . ' ]'; ); '
\n'; '\n'; '\n'; '\n'; '\n'; '\n'; '\n'; '
 '; expand(``); '' . secondary_field_label . ''; if (view_by_tasks and (profile_name ne "*") and (!node_exists("profiles." . profile_name))) then ( ' [ ' . lang_admin.scheduler.profile_does_not_exist_info . ' ]'; ); ''; expand(`$lang_admin.general.edit_button | `); expand(`$lang_admin.general.delete_button\n`); '
\n'; '
\n'; '\n'; if ((node_exists("schedule." . schedule_id . ".options.rn")) or (action_name eq "generate_all_report_files")) then ( if (node_exists("schedule." . schedule_id . ".options.rn")) then ( report_name = node_value("schedule." . schedule_id . ".options.rn"); if (report_name ne "*") then ( if (node_exists("profiles." . profile_name . ".statistics.reports." . report_name)) then ( set_active_profile(profile_name); report_label = expand(node_value("profiles." . profile_name . ".statistics.reports." . report_name . ".label")); ) else ( report_label = report_name . "-"; ); ) else ( report_label = lang_admin.scheduler.all_reports_label; ); ) else ( # for backwards compatibility only, action is "generate_all_report_files" which # has been replaced by "generate_report_files", -rn * (star is equal all reports) report_label = lang_admin.scheduler.all_reports_label; ); '\n'; '\n'; '\n'; '\n'; '\n'; ); if (node_exists("schedule." . schedule_id . ".options.rca")) then ( recipient_email_address = node_value("schedule." . schedule_id . ".options.rca"); '\n'; '\n'; '\n'; '\n'; '\n'; ); if (node_exists("schedule." . schedule_id . ".options.ghtd")) then ( generate_html_to_directory = node_value("schedule." . schedule_id . ".options.ghtd"); '\n'; '\n'; '\n'; '\n'; '\n'; ); if (node_exists("schedule." . schedule_id . ".options.gpff") and node_exists("lang_admin.scheduler.generate_pdf_friendly_files_label")) then ( generate_pdf_friendly_files = node_value("schedule." . schedule_id . ".options.gpff"); '\n'; '\n'; '\n'; '\n'; '\n'; ); if ((action_name eq "remove_database_data") and (node_exists("schedule." . schedule_id . ".options.f"))) then ( if (!node_value("schedule." . schedule_id . ".filter.custom_expression")) then ( number_of_days = node_value("schedule." . schedule_id . ".filter.number_of_days"); string param1 = number_of_days; remove_database_data_filter = expand(lang_admin.scheduler.remove_database_data_older_than_n_days_info); ) else ( remove_database_data_filter = node_value("schedule." . schedule_id . ".options.f"); ); '\n'; '\n'; '\n'; '\n'; '\n'; ); if (node_exists("schedule." . schedule_id . ".extra_options")) then ( extra_options = node_value("schedule." . schedule_id . ".extra_options"); if (extra_options ne "") then ( '\n'; '\n'; '\n'; '\n'; '\n'; ); ); '\n'; '\n'; '\n'; '\n'; '\n'; '
 ' . lang_admin.scheduler.report_label . ':' . report_label . '
 ' . lang_admin.scheduler.recipient_email_address_short_label . ':' . recipient_email_address . '
 ' . capitalize(expand(lang_stats.directory)) . ':' . generate_html_to_directory . '
  '; ' ' . lang_admin.scheduler.generate_pdf_friendly_files_label . '
 ' . lang_admin.scheduler.filter_label . ':' . remove_database_data_filter . '
 ' . lang_admin.scheduler.extra_options_label . ':' . extra_options . '
 ' . lang_admin.scheduler.schedule_label . ':' . get_schedule_string(schedule_id) . '
\n'; '
\n'; )); =} {= expand(templates.shared.content_type); =}
$lang_admin.scheduler.label $lang_admin.scheduler.new_action_button
{= bool tasks_exists = false; if (node_exists("schedule")) then ( if (num_subnodes("schedule") >= 1) then ( tasks_exists = true; ); ); if (tasks_exists) then ( # --------------------- # Scheduler view switch # --------------------- '\n'; '\n'; '\n'; '\n'; '\n'; '
'; ''; ''; '\n'; '
\n'; '\n'; ' \n'; '  '; '\n'; ' \n'; '
\n'; '
\n'; # -------------------- # Tasks/Profiles table # -------------------- '\n'; # -------------------- # Profiles/Tasks table # -------------------- '\n'; ) else ( # ------------------- # No task in schedule # ------------------- '

' . lang_admin.scheduler.no_actions_defined_info . '

\n'; ); expand(templates.shared.copyright); '
\n'; =}