$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
);
expand(templates.shared.copyright);
=}