Portal: Added an environment banner in the portal like in the console. It warns the user when he is browsing in an other mode than "production".

SVN:trunk[4531]
This commit is contained in:
Guillaume Lajarige
2016-12-15 15:02:26 +00:00
parent fa9848d1be
commit 27c3facb2b
8 changed files with 44 additions and 1 deletions

View File

@@ -40,7 +40,9 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
'Portal:Button:Add' => 'Přidat',
'Portal:Button:Remove' => 'Odebrat',
'Portal:Button:Delete' => 'Smazat',
'Error:HTTP:404' => 'Stránka nenalezena',
'Portal:EnvironmentBanner:Title' => 'You are currently in <strong>%1$s</strong> mode~~',
'Portal:EnvironmentBanner:GoToProduction' => 'Go back to PRODUCTION mode~~',
'Error:HTTP:404' => 'Stránka nenalezena',
'Error:HTTP:500' => 'Jejda! Nastal problém',
'Error:HTTP:GetHelp' => 'Kontaktujte prosím administrátora, pokud problém přetrvá.',
'Error:XHR:Fail' => 'Data se nepodařilo načíst, kontaktujte prosím administrátora.',

View File

@@ -36,6 +36,8 @@ Dict::Add('EN US', 'English', 'English', array(
'Portal:Button:Add' => 'Add',
'Portal:Button:Remove' => 'Remove',
'Portal:Button:Delete' => 'Delete',
'Portal:EnvironmentBanner:Title' => 'You are currently in <strong>%1$s</strong> mode',
'Portal:EnvironmentBanner:GoToProduction' => 'Go back to PRODUCTION mode',
'Error:HTTP:404' => 'Page not found',
'Error:HTTP:500' => 'Oops! An error has occured.',
'Error:HTTP:GetHelp' => 'Please contact your iTop administrator if the problem keeps happening.',

View File

@@ -36,6 +36,8 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
'Portal:Button:Add' => 'Añadir',
'Portal:Button:Remove' => 'Eliminar',
'Portal:Button:Delete' => 'Borrar',
'Portal:EnvironmentBanner:Title' => 'You are currently in <strong>%1$s</strong> mode~~',
'Portal:EnvironmentBanner:GoToProduction' => 'Go back to PRODUCTION mode~~',
'Error:HTTP:404' => 'Página no encontrada',
'Error:HTTP:500' => '¡Vaya! Ha ocurrido un error.',
'Error:HTTP:GetHelp' => 'Póngase en contacto con el administrador de iTop si el problema persiste.',

View File

@@ -36,6 +36,8 @@ Dict::Add('FR FR', 'French', 'Français', array(
'Portal:Button:Add' => 'Ajouter',
'Portal:Button:Remove' => 'Enlever',
'Portal:Button:Delete' => 'Supprimer',
'Portal:EnvironmentBanner:Title' => 'Vous êtes dans le mode <strong>%1$s</strong>',
'Portal:EnvironmentBanner:GoToProduction' => 'Retourner au mode PRODUCTION',
'Error:HTTP:404' => 'Page non trouvée',
'Error:HTTP:500' => 'Oups ! Une erreur est survenue.',
'Error:HTTP:GetHelp' => 'Si le problème persiste, veuillez contacter votre administrateur iTop.',

View File

@@ -104,6 +104,17 @@
</head>
<body class="{% block pPageBodyClass %}{% endblock %}">
{% block pPageBodyWrapper %}
{% block pEnvBannerWrapper %}
{% if app['combodo.current_environment'] != 'production' %}
<div id="envbanner" class="alert alert-danger" role="alert">
{{ 'Portal:EnvironmentBanner:Title'|dict_format( app['combodo.current_environment']|upper )|raw }}
<button type="button" onclick="window;location.href='{{ app['url_generator'].generate('p_home', {'switch_env': 'production'}) }}'">
{{ 'Portal:EnvironmentBanner:GoToProduction'|dict_s|raw }}
</button>
</div>
{% endif %}
{% endblock %}
{% block pNavigationWrapper %}
{# Topbar navigation menu for mobile screens #}
<nav class="navbar navbar-fixed-top navbar-default visible-xs" id="topbar" role="navigation">

View File

@@ -15,6 +15,17 @@
footer {
margin: 5em 1em;
}
/* Environment banner */
#envbanner {
position: relative;
z-index: 10;
padding: 5px 15px;
text-align: center;
}
#envbanner > button {
margin-left: 5px;
color: #000;
}
/* Navigation menu */
.navbar-nav .dropdown-menu a .glyphicon, .user_infos .dropdown-menu a .glyphicon {
margin-right: 15px;

View File

@@ -19,6 +19,18 @@ footer{
margin: 5em 1em;
}
/* Environment banner */
#envbanner{
position: relative;
z-index: 10;
padding: 5px 15px;
text-align: center;
}
#envbanner > button{
margin-left: 5px;
color: #000;
}
/* Navigation menu */
.navbar-nav .dropdown-menu a .glyphicon,
.user_infos .dropdown-menu a .glyphicon{

View File

@@ -82,6 +82,7 @@ $oApp->register(new Silex\Provider\HttpFragmentServiceProvider());
// Configuring Silex application
$oApp['debug'] = $bDebug;
$oApp['combodo.current_environment'] = utils::GetCurrentEnvironment();
$oApp['combodo.absolute_url'] = utils::GetAbsoluteUrlAppRoot();
$oApp['combodo.portal.base.absolute_url'] = utils::GetAbsoluteUrlAppRoot() . 'env-' . utils::GetCurrentEnvironment() . '/itop-portal-base/portal/web/';
$oApp['combodo.portal.base.absolute_path'] = MODULESROOT . '/itop-portal-base/portal/web/';