# 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/*.header.html` 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 (New in 1.5).
{$mod} | The current Module (Map, AutoMap, Overview, Welcome, ...) (New in 1.5).
{$act} | The current Action (view, edit, ...) (New in 1.5).
{$bEnableFade} | Tells the hover menu to use fading menus or quickly opening slide menus (New in 1.5.2).
{$bRotation} | Is true when currently viewing a rotation. Otherwise it is False. (New in 1.5).
{$permittedOverview} | Is true when the user is permitted to access the overview page. Otherwise it is False. (New in 1.5).
{$permittedEdit} | Is true when the user is permitted to edit the current map. Otherwise it is False. (New in 1.5).
{$permittedEditAnyMap} | Is true when the user is allowed to edit at least one map. Otherwise it is False. (New in 1.5).
{$permittedChangePassword} | Is true when the user is permitted to change the own password. Otherwise it is False. (New in 1.5).
{$permittedEditMainCfg} | Is true when the user is permitted to edit the main configuration file. Otherwise it is False. (New in 1.5.3).
{$permittedManageBackgrounds} | Is true when the user is permitted to manage backgrounds. Otherwise it is False. (New in 1.5.3).
{$permittedManageMaps} | Is true when the user is permitted to manage maps. Otherwise it is False. (New in 1.5.3).
{$permittedManageShapes} | Is true when the user is permitted to manage shapes. Otherwise it is False. (New in 1.5.3).
{$permittedUserMgmt} | Is true when the user is permitted to manage user accounts. Otherwise it is False. (New in 1.5).
{$permittedRoleMgmt} | Is true when the user is permitted to manage roles. Otherwise it is False. (New in 1.5).
{$permittedLogout} | Is true when the user is permitted to log out. Otherwise it is False. (New in 1.5).
{$supportedChangePassword} | Is true when the current auth module supports changing passwords. Otherwise it is False. (New in 1.5).

{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.urlParams}: Special parameters to hand over to the NagVis frontend like search strings.
* {$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`. (New in 1.5).
{$pathBase} (was [html_base]) | URL to HTML-Base (/nagvis)
{$pathImages} (was [html_images]) | URL to HTML-Images (/nagvis/images) (New in 1.5)
{$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 (New in 1.5).
{$langToggleGrid} | Label for enabling/disabling the grid (New in 1.5).
{$langActions} | Label for choosing the available actions (New in 1.5).
{$langWui} | Label for the WUI (New in 1.5).
{$langUser} | Label for the user (New in 1.5).
{$langLoggedIn} | Label for "Logged in as" (New in 1.5).
{$langChangePassword} | Label for changing the user's password (New in 1.5).
{$langUserMgmt} | Label for managing users (New in 1.5).
{$langManageRoles} | Label for managing user roles (New in 1.5).
{$langLogout} | Label for logging out (New in 1.5).
{$langChooseLanguage} | Label for choosing the user's language (New in 1.5).