From 8204dbb6ae006220dbe33cfe1efb79bad8e6b845 Mon Sep 17 00:00:00 2001
From: Stephen Abello
Date: Wed, 24 Mar 2021 17:18:34 +0100
Subject: [PATCH] =?UTF-8?q?N=C2=B03857=20Replace=20old=20welcome=20popup?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
core/config.class.inc.php | 1 +
css/backoffice/pages/_all.scss | 3 +-
css/backoffice/pages/_welcome-popup.scss | 45 +++++++++++++++++++
dictionaries/en.dictionary.itop.ui.php | 8 ++++
images/illustrations/undraw_relaunch_day.svg | 1 +
pages/UI.php | 29 ++----------
.../welcome_popup/welcome_popup.html.twig | 14 ++++++
.../welcome_popup/welcome_popup.ready.js.twig | 16 +++++++
8 files changed, 90 insertions(+), 27 deletions(-)
create mode 100644 css/backoffice/pages/_welcome-popup.scss
create mode 100644 images/illustrations/undraw_relaunch_day.svg
create mode 100644 templates/pages/backoffice/welcome_popup/welcome_popup.html.twig
create mode 100644 templates/pages/backoffice/welcome_popup/welcome_popup.ready.js.twig
diff --git a/core/config.class.inc.php b/core/config.class.inc.php
index a32e5bae0..997330807 100644
--- a/core/config.class.inc.php
+++ b/core/config.class.inc.php
@@ -23,6 +23,7 @@
define('ITOP_APPLICATION', 'iTop');
define('ITOP_APPLICATION_SHORT', 'iTop');
define('ITOP_VERSION', '3.0.0-dev');
+define('ITOP_VERSION_NAME', 'Fullmoon');
define('ITOP_REVISION', 'svn');
define('ITOP_BUILD_DATE', '$WCNOW$');
define('ITOP_VERSION_FULL', ITOP_VERSION.'-'.ITOP_REVISION);
diff --git a/css/backoffice/pages/_all.scss b/css/backoffice/pages/_all.scss
index 5cb07654d..cc9d6d0ae 100644
--- a/css/backoffice/pages/_all.scss
+++ b/css/backoffice/pages/_all.scss
@@ -11,4 +11,5 @@
@import "data-synchro";
@import "datamodel-viewer";
@import "csv-import";
-@import "global-search";
\ No newline at end of file
+@import "global-search";
+@import "welcome-popup";
\ No newline at end of file
diff --git a/css/backoffice/pages/_welcome-popup.scss b/css/backoffice/pages/_welcome-popup.scss
new file mode 100644
index 000000000..512d8669a
--- /dev/null
+++ b/css/backoffice/pages/_welcome-popup.scss
@@ -0,0 +1,45 @@
+$ibo-welcome-popup--image--width: 30% !default;
+
+$ibo-welcome-popup--image--svg--height: 100% !default;
+$ibo-welcome-popup--image--svg--padding: 20px !default;
+
+$ibo-welcome-popup--text--padding: 15px !default;
+
+$ibo-welcome-popup--text--subdiv--padding-bottom: 20px !default;
+$ibo-welcome-popup--text--first-subdiv--padding-bottom: 25px !default;
+
+$ibo-welcome-popup--text--options--bottom: 10px !default;
+
+#welcome_popup{
+ display: flex;
+
+}
+.ibo-welcome-popup--image{
+ display: flex;
+ justify-content: center;
+ align-self: center;
+
+ width: $ibo-welcome-popup--image--width;
+ >svg{
+ height: $ibo-welcome-popup--image--svg--height;
+ padding: $ibo-welcome-popup--image--svg--padding;
+ }
+}
+.ibo-welcome-popup--text{
+ flex-grow:1;
+ align-self: center;
+ padding: $ibo-welcome-popup--text--padding;
+
+ @extend %ibo-font-ral-nor-250;
+ >div>div{
+ padding-bottom: $ibo-welcome-popup--text--subdiv--padding-bottom;
+ &:first-child{
+ @extend %ibo-font-ral-sembol-300;
+ padding-bottom: $ibo-welcome-popup--text--first-subdiv--padding-bottom;
+ }
+ }
+}
+.ibo-welcome-popup--text--options{
+ position: absolute;
+ bottom: $ibo-welcome-popup--text--options--bottom;
+}
\ No newline at end of file
diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php
index 905b32d89..53d8a0f49 100644
--- a/dictionaries/en.dictionary.itop.ui.php
+++ b/dictionaries/en.dictionary.itop.ui.php
@@ -367,6 +367,14 @@ Dict::Add('EN US', 'English', 'English', array(
Manage the most important asset of your IT: Documentation.
',
+ 'UI:WelcomeMenu:Text'=> 'Congratulations, you landed on '.ITOP_APPLICATION.' '.ITOP_VERSION_NAME.'!
+
+This version features a modern brand new accessible and responsive backoffice design.
+
+We kept iTop core functions that you liked and modernized them to make you love them.
+We hope you’ll enjoy this version as much as we enjoyed imagining and creating it.
+
+Customize your iTop preferences for a personalized experience.
',
'UI:WelcomeMenu:AllOpenRequests' => 'Open requests: %1$d',
'UI:WelcomeMenu:MyCalls' => 'My requests',
'UI:WelcomeMenu:OpenIncidents' => 'Open incidents: %1$d',
diff --git a/images/illustrations/undraw_relaunch_day.svg b/images/illustrations/undraw_relaunch_day.svg
new file mode 100644
index 000000000..330d0f481
--- /dev/null
+++ b/images/illustrations/undraw_relaunch_day.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/pages/UI.php b/pages/UI.php
index c171200bf..643cb56d1 100644
--- a/pages/UI.php
+++ b/pages/UI.php
@@ -4,6 +4,7 @@
* @license http://opensource.org/licenses/AGPL-3.0
*/
+use Combodo\iTop\Application\TwigBase\Twig\TwigHelper;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Form\Form;
use Combodo\iTop\Application\UI\Base\Component\Form\FormUIBlockFactory;
@@ -36,32 +37,8 @@ function DisplayWelcomePopup(WebPage $oP)
$bPopup = appUserPreferences::GetPref('welcome_popup', true);
if ($bPopup)
{
- $sTemplate = @file_get_contents('../application/templates/welcome_popup.html');
- if ($sTemplate !== false)
- {
- $oTemplate = new DisplayTemplate($sTemplate);
- $oP->add("\n");
- $sTitle = addslashes(Dict::S('UI:WelcomeMenu:Title'));
- $oP->add_ready_script(
-<< ($(window).height()-70))
- {
- $('#welcome_popup').height($(window).height()-70);
- }
-EOF
-);
- $_SESSION['welcome'] = 'ok';
- }
+ TwigHelper::RenderIntoPage($oP, APPROOT.'/', 'templates/pages/backoffice/welcome_popup/welcome_popup');
+ $_SESSION['welcome'] = 'ok';
}
}
}
diff --git a/templates/pages/backoffice/welcome_popup/welcome_popup.html.twig b/templates/pages/backoffice/welcome_popup/welcome_popup.html.twig
new file mode 100644
index 000000000..382d4558b
--- /dev/null
+++ b/templates/pages/backoffice/welcome_popup/welcome_popup.html.twig
@@ -0,0 +1,14 @@
+
diff --git a/templates/pages/backoffice/welcome_popup/welcome_popup.ready.js.twig b/templates/pages/backoffice/welcome_popup/welcome_popup.ready.js.twig
new file mode 100644
index 000000000..64d9e6810
--- /dev/null
+++ b/templates/pages/backoffice/welcome_popup/welcome_popup.ready.js.twig
@@ -0,0 +1,16 @@
+console.log('a');
+
+$('#welcome_popup').dialog( { width:'60%', height: 'auto', title: '{{ 'UI:WelcomeMenu:Title'|dict_s }}', autoOpen: true, modal:true,
+ close: function() {
+ var bDisplay = $('#display_welcome_popup:checked').length;
+ SetUserPreference('welcome_popup', bDisplay, true);
+ },
+ buttons: [{
+ text: "{{ 'UI:Button:Ok'|dict_s }}", click: function() {
+ $(this).dialog( "close" ); $(this).remove();
+ }}],
+});
+if ($('#welcome_popup').height() > ($(window).height()-70))
+{
+ $('#welcome_popup').height($(window).height()-70);
+}