[% USE date %]

var thruk_version       = '[% thrukversion %]';
var thruk_extra_version = '[% c.config.extra_version %]';
var refresh_rate        = [% IF refresh_rate %][% refresh_rate %][% ELSE %]null[% END %];
var server_time         = new Date([% date.now * 1000 %]);
var client_time         = new Date();
var delta_time          = client_time.getTime() - server_time.getTime();
var url_prefix          = '[% url_prefix %]';
var logo_path_prefix    = '[% logo_path_prefix %]';
var product_prefix      = '[% product_prefix %]';
var perf_bar_mode       = '[% perf_bar_mode %]';
var thruk_debug_js      = [% IF thruk_author %]true[% ELSE %]false[% END %];
var theme               = '[% theme %]';
var remote_user         = '[% remote_user %]';
var cookie_path         = '[% cookie_path %]';
var cookie_auth         = [% IF cookie_auth %]true[% ELSE %]false[% END %];
var base                = url_prefix+'plugins/panorama';
var CSRFtoken           = '[% get_user_token(c) %]';
var contactgroups       = [% json_encode(c.user.groups) %];
var downtime_duration   = [% downtime_duration %];
var fav_counter         = false;
var readonly            = [% IF readonly %]true[% ELSE %]false[% END %];
var one_tab_only        = [% IF one_tab_only %]'[% one_tab_only %]'[% ELSE %]false[% END %];
var use_feature_bp      = [% IF use_feature_bp %]true[% ELSE %]false[% END %];
var hide_passive_icon   = [% IF hide_passive_icon %]true[% ELSE %]false[% END %];
var strict_passive_mode = [% IF strict_passive_mode %]true[% ELSE %]false[% END %];
var thruk_is_admin      = [% IF is_admin %]true[% ELSE %]false[% END %];
var thruk_demo_mode     = [% IF c.config.demo_mode %]true[% ELSE %]false[% END %];
var cmd_sticky_ack           = [% IF c.config.cmd_defaults.sticky_ack %]true[% ELSE %]false[% END %];
var cmd_send_notification    = [% IF c.config.cmd_defaults.send_notification %]true[% ELSE %]false[% END %];
var cmd_persistent           = [% IF c.config.cmd_defaults.persistent_ack %]true[% ELSE %]false[% END %];
var start_unlocked           = [% IF c.req.parameters.exists('unlocked') %]false[% ELSE %]true[% END %];
var show_notification_number = [% IF show_notification_number %]true[% ELSE %]false[% END %];
var dashboard_ignore_changes = [% IF dashboard_ignore_changes %]true[% ELSE %]false[% END %];
var default_nagvis_base_url  = '[% default_nagvis_base_url %]';
var usercontent_folder       = '[% usercontent_folder %]';
var thruk_wms_provider       = [% json_encode(wms_provider) %];
var thruk_shape_data         = [% json_encode(shape_data) %];
var thruk_iconset_data       = [% json_encode(iconset_data) %];
var thruk_trendiconset_data  = [% json_encode(trendiconset_data) %];
var action_menu_actions      = [% json_encode(action_menu_actions) %];
var action_menu_items        = [% json_encode(action_menu_items) %];
var default_map_zoom         = [% default_map_zoom %];
var default_map_lon          = [% default_map_lon %];
var default_map_lat          = [% default_map_lat %];
var default_maintenance_text = "[% escape_quotes(default_maintenance_text) %]";
var available_fonts          = [% json_encode(fonts) %];
var omd_site                 = '[% omd_site %]';
var grafana_default_panelId  = "[% c.config.grafana_default_panelId %]";
var enable_shinken_features  = [% enable_shinken_features %];
var escape_html_tags         = [% IF escape_html_tags %]true[% ELSE %]false[% END %];
var jquery_ui_css            = '[% url_prefix %]vendor/jquery-ui-[% c.config.jquery_ui %]/css/smoothness/jquery-ui-[% c.config.jquery_ui %].custom.min.css';
var jquery_ui_url            = '[% url_prefix %]vendor/jquery-ui-[% c.config.jquery_ui %]/js/jquery-ui-[% c.config.jquery_ui %].custom.min.js';

[%+ PROCESS _header_initial_states.tt +%]
var contactgroupsHash = {};
for(var x = 0; x < contactgroups.length; x++) {
    var g = contactgroups[x];
    contactgroupsHash[g] = true;
}

[% action_menu_items_js %]
