$templates.shared.doctype
{=
include "templates.shared.util.get_licensing_features";
include "templates.admin.system.user_name_cleanup";
include "templates.admin.system.convert_graphs";
# ----------------
# Maintenance only
# ----------------
if (node_exists("volatile.temp")) then (
delete_node("volatile.temp")
);
# -------------------------------------
# Maintenance only - unser_name_cleanup
# -------------------------------------
if (!node_exists("system.maintenance.user_name_cleanup")) then (
if (node_exists("users") and (num_subnodes("users") > 0)) then (
user_name_cleanup();
);
);
# ---------------------------------
# Maintenance only - convert_graphs
# ---------------------------------
if (!node_exists("system.maintenance.convert_graphs")) then (
if (num_subnodes("profiles") > 1) then (
convert_graphs();
)
else (
# This is a new installation or no profiles exist, except the default profile
# Set system.maintenance.convert_graphs to be done
system.maintenance.convert_graphs = true;
save_node("system");
);
);
# -------------------------------------
# Check for profile use in schedule.cfg
# -------------------------------------
if (node_exists("schedule") and (num_subnodes("schedule") > 0)) then (
node item;
string profile_name;
foreach item "schedule" (
profile_name = node_value(subnode_by_name(item, "profile"));
if ((profile_name ne "*") and
!node_exists("volatile.temp.profiles_in_schedule." . profile_name)) then (
"volatile.temp.profiles_in_schedule." . profile_name = true;
);
);
);
# ----------------------------------
# Check for profile use in users.cfg
# ----------------------------------
if (node_exists("users") and (num_subnodes("users") > 0)) then (
node item;
bool administrator;
string profile_name;
foreach item "users" (
administrator = node_value(subnode_by_name(item, "administrator"));
if (!administrator and node_exists(item . ".profiles")) then (
node subitem;
node subitem_node = item . ".profiles";
foreach subitem subitem_node (
profile_name = node_name(subitem);
if (!node_exists("volatile.temp.profiles_in_users." . profile_name)) then (
"volatile.temp.profiles_in_users." . profile_name = true;
);
);
);
);
);
# debug_message("#### profiles used:\n" . node_as_string("volatile.temp") . "\n");
# -------------
# Profiles view
# -------------
node profiles_node = "profiles";
node profile;
string profile_name;
string profile_label;
string profile_label_js;
bool profile_in_schedule;
bool profile_in_users;
sort(profiles_node, "field:label,alphabetical,ascending", false);
# TEMP START
# this is a temporary function to avoid displaying duplicate profile names in the profile list
if node_exists("volatile.profile_list") then (
delete_node("volatile.profile_list");
);
foreach profile profiles_node (
profile_name = node_name(profile);
profile_label = node_value(subnode_by_name(profile, "label"));
if (contains(profile_label, "$")) then (
profile_label = replace_all(profile_label, "$", "__HexEsc__24");
);
if node_exists("volatile.profile_list." . profile_name) then (
debug_message("#### #### removed duplicate profile from list: " . profile_name . "\n");
)
else (
"volatile.profile_list." . profile_name = true;
"volatile.profile_list." . profile_name . ".label" = profile_label;
);
);
int number_of_profiles = num_subnodes("volatile.profile_list");
# debug_message("temp profile list: \n" . node_as_string("volatile.profile_list") . "\n");
# debug_message("number of profiles including default: " . number_of_profiles . "\n");
# TEMP END
# ----
# html
# ----
'\n';
'
\n';
'
{=
# --------------------
# profiles list header
# --------------------
'\n';
if (number_of_profiles > 1) then (
string licensing_features = get_licensing_features();
# -------------
# profiles list
# -------------
'
\n';
'\n';
'\n';
'\n';
'\n';
string url;
foreach profile "volatile.profile_list" (
profile_name = node_name(profile);
url = "?dp+templates.profile.index";
url .= "+p+" . profile_name;
if (profile_name ne "default_profile") then (
profile_label = node_value(subnode_by_name(profile, "label"));
profile_label_js = replace_all(profile_label, "'", "\'");
if (contains(profile_label, "__HexEsc__24")) then (
profile_label = replace_all(profile_label, "__HexEsc__24", "$");
profile_label_js = replace_all(profile_label_js, "__HexEsc__24", "\u0024");
);
# debug_message("profile name / label: " . profile_name . " / " . profile_label . "\n");
profile_in_schedule = false;
profile_in_users = false;
# profile_in_schedule and profile_in_users are used when deleting a profile,
# so that the client side already knows if there are dependencies or not.
if (node_exists("volatile.temp.profiles_in_schedule." . profile_name)) then (
profile_in_schedule = true;
);
if (node_exists("volatile.temp.profiles_in_users." . profile_name)) then (
profile_in_users = true;
);
'\n';
'' . profile_label . ' | \n';
'';
'';
lang_admin.profiles.show_reports_button . '';
' | \n';
'';
if (licensing_features ne "lite") then (
'' . lang_admin.profiles.show_config_button . '\n';
)
else (
`` . lang_admin.profiles.show_config_button . `\n`;
);
' | \n';
'';
``;
lang_admin.general.delete_button;
'\n';
' | \n';
'
\n';
);
); # foreach profile
'
\n';
)
else (
# ------------------------
# Start here section START
# ------------------------
'
' . lang_admin.profiles.no_profile_exist_info . '
\n';
# '
\n';
# Round corner box table
'
\n';
# Start here section END
);
# ------------
# Upgrade info
# ------------
# Check if we should show the upgrade info
node license;
bool show_upgrade_info = false;
int profiles;
node show_upgrade_info_license;
foreach license 'licenses' (
if (subnode_exists(license, 'show_upgrade_info')) then (
show_upgrade_info = true;
show_upgrade_info_license = license;
);
); # for licenses
# Show the upgrade info if a license called for it
if (show_upgrade_info) then (
string store_link = node_value(subnode_by_name(show_upgrade_info_license, "upgrade_url"));
string param1 = '
' . lang_admin.upgrade_info.the_product_store_link_label . '';
'
' . expand(lang_admin.upgrade_info.limited_version_info) . '
';
'
';
'';
' | ';
'' . lang_admin.upgrade_info.this_version_label . ' | ';
'' . lang_admin.upgrade_info.full_version_label . ' | ';
'
';
'';
'' . lang_admin.upgrade_info.max_num_of_profiles_label . ' | ';
'' . node_value(subnode_by_name(show_upgrade_info_license, "profiles")) . ' | ';
'' . lang_admin.upgrade_info.any_num_of_profiles_label . ' | ';
'
';
# Show the supported log formats.
'';
'' . lang_admin.upgrade_info.log_formats_supported_label . ' | ';
'';
node log_format;
int log_format_number = 1;
foreach log_format subnode_by_name(show_upgrade_info_license, "log_formats") (
if (node_name(log_format) eq "all_syslog_formats") then next;
log_format_number;
". ";
node_value("log_formats." . node_name(log_format) . ".log.format.format_label");
" ";
log_format_number++;
);
' | ';
string param1 = '' . num_subnodes("log_formats") . '';
'';
expand(lang_admin.upgrade_info.num_of_all_supported_log_formats_label);
'';
'- ' . lang_admin.upgrade_info.web_servers . '
';
'- ' . lang_admin.upgrade_info.proxy_servers . '
';
'- ' . lang_admin.upgrade_info.firewalls . '
';
'- ' . lang_admin.upgrade_info.network_devices . '
';
'- ' . lang_admin.upgrade_info.mail_servers . '
';
'- ' . lang_admin.upgrade_info.media_server . '
';
'- ' . lang_admin.upgrade_info.spam_filters . '
';
'- ' . lang_admin.upgrade_info.and_more . '
';
' ';
' | ';
'
';
# Show the tier
string tier = capitalize(node_value(subnode_by_name(show_upgrade_info_license, "type")));
'';
'' . lang_admin.upgrade_info.license_tier_label . ' | ';
'' . tier . ' | ';
'' . lang_admin.upgrade_info.lite_pro_enterprise_label . ' | ';
'
';
'
\n';
);
# --------------
# copyright info
# --------------
expand(templates.shared.copyright);
=}