# Header Templates

## Introduction

Header templates are html files with some macros in it. These files can be used as header menu in the maps. The header templates are located at `share/userfiles/templates/pages/` relative to the nagvis root directory. The templates are named like this: `*.header.html`.
Since NagVis 1.5 the template format has been changed to be more flexible. Therefore all templates need to be recoded to be NagVis 1.5 compatible.

## Macros

The following macros are available in the header templates:

Macro | Description
--- | ---
{$currentMap} (was [current_map]) | Name of the current map (e.g. demo,demo2)
{$currentMapAlias} (was [current_map_alias]) | Alias of the current map
{$currentLanguage} (was [current_language]) | String representing the current language (For example en_US). This is needed for link to documentation.
{$currentUser} | Name of the current user.
{$mod} | The current Module (Map, AutoMap, Overview, Welcome, ...).
{$act} | The current Action (view, edit, ...).
{$bRotation} | Is true when currently viewing a rotation. Otherwise it is False..
{$permittedOverview} | Is true when the user is permitted to access the overview page. Otherwise it is False..
{$permittedEdit} | Is true when the user is permitted to edit the current map. Otherwise it is False..
{$permittedEditAnyMap} | Is true when the user is allowed to edit at least one map. Otherwise it is False..
{$permittedChangePassword} | Is true when the user is permitted to change the own password. Otherwise it is False..
{$permittedEditMainCfg} | Is true when the user is permitted to edit the main configuration file. Otherwise it is False..
{$permittedManageBackgrounds} | Is true when the user is permitted to manage backgrounds. Otherwise it is False..
{$permittedManageMaps} | Is true when the user is permitted to manage maps. Otherwise it is False..
{$permittedManageShapes} | Is true when the user is permitted to manage shapes. Otherwise it is False..
{$permittedUserMgmt} | Is true when the user is permitted to manage user accounts. Otherwise it is False..
{$permittedRoleMgmt} | Is true when the user is permitted to manage roles. Otherwise it is False..
{$permittedLogout} | Is true when the user is permitted to log out. Otherwise it is False..
{$supportedChangePassword} | Is true when the current auth module supports changing passwords. Otherwise it is False..

{foreach $maps map}
{$map.mapName}
{/foreach}

A list of all maps defined in NagVis. The code between `{foreach $maps map}` and `{/foreach}` is repeated for each map. For an example have a look at `share/userfiles/templates/pages/default.header.html`.
Within the BEGIN/END-Tags the following macros are available:
* {$map.mapName} (Was [map_name]): Name of the map
* {$map.mapAlias} (Was [map_alias]): Alias of the map
* {$map.permittedEdit}: Is the user permitted to edit this map?

{foreach $langs lang}
{$lang.language}
{/foreach}

A list of all languages available to the users in NagVis. The code between `{foreach $langs lang}` and `{/foreach}` is repeated for each language. For an example have a look at `share/userfiles/templates/pages/default.header.html`.
Within the BEGIN/END-Tags the following macros are available:
* {$lang.language}: Internal name of the language
* {$lang.classUnderline}: Underline the language
* {$lang.langLanguageLocated}: Located name of the language.

{if $viewType == 'Map' || $viewType == 'Automap'} | To be more flexible in the templates we added some sort of if statements. These can be used as in native PHP. For an example have a look at `share/userfiles/templates/pages/default.header.html`.
{$pathBase} (was [html_base]) | URL to HTML-Base (/nagvis)
{$pathImages} (was [html_images]) | URL to HTML-Images (/nagvis/images)
{$pathHeaderJs} | Path to header specific javascript file
{$pathTemplates} (was [html_templates]) | Path to header templates (/nagvis/userfiles/templates)
{$pathTemplateImages} (was [html_template_images]) | Path to header template images (/nagvis/userfiles/images/templates)
{$langOpen} (was [lang_select_map]) | Label for opening new views
{$langEditMap} (was [lang_edit_map]) | Label for edit map link
{$langNeedHelp} (was [lang_need_help]) | Label for help selection
{$langOnlineDoc} (was [lang_online_doc]) | Label for link to online documentation
{$langForum} (was [lang_forum]) | Label for link to NagVis forum
{$langSupportInfo} (was [lang_support_info]) | Label for link to support information
{$langOverview} (was [lang_overview]) | Label for overview string
{$langInstance} (was [lang_instance]) | Label for the instance string
{$langRotationStart} (was [lang_rotation_start]) | Label for starting the map rotation
{$langRotationStop} (was [lang_rotation_stop]) | Label for stopping the map rotation
{$langSearch} | Label for searching an object on the map.
{$langToggleGrid} | Label for enabling/disabling the grid.
{$langActions} | Label for choosing the available actions.
{$langUser} | Label for the user.
{$langLoggedIn} | Label for "Logged in as".
{$langChangePassword} | Label for changing the user's password.
{$langUserMgmt} | Label for managing users.
{$langManageRoles} | Label for managing user roles.
{$langLogout} | Label for logging out.
{$langChooseLanguage} | Label for choosing the user's language.