From 0d8b5a3fefc235480ba5bf4543c00383f078d77f Mon Sep 17 00:00:00 2001 From: "stephen@cubedesigners.com" Date: Mon, 14 Nov 2022 15:56:14 +0000 Subject: [PATCH] Wait #5571 @3 --- .../controllers/AjaxController.php | 8 ++- framework/application/forms/Settings.php | 11 +++- .../views/helpers/AlertMessage.php | 25 ++++++++ .../views/helpers/ContactInfos.php | 9 +-- .../views/helpers/FooterContact.php | 11 ++-- .../views/scripts/common/body.phtml | 1 + js/alert-message.js | 11 ++++ less/alert-message.less | 58 +++++++++++++++++++ 8 files changed, 122 insertions(+), 12 deletions(-) create mode 100644 framework/application/views/helpers/AlertMessage.php create mode 100644 js/alert-message.js create mode 100644 less/alert-message.less diff --git a/framework/application/controllers/AjaxController.php b/framework/application/controllers/AjaxController.php index cbd5636..e2183c5 100644 --- a/framework/application/controllers/AjaxController.php +++ b/framework/application/controllers/AjaxController.php @@ -42,6 +42,10 @@ class AjaxController extends CubeIT_Controller_AjaxController { $this->_datas->addVariable("rea", $r); } -} + public function alertMessageDismiss() { + $session = Bootstrap::getInstance()->getSession(); + $session->hideAlertMessage = true; + return true; + } -?> +} diff --git a/framework/application/forms/Settings.php b/framework/application/forms/Settings.php index 36e87a0..afbf94a 100644 --- a/framework/application/forms/Settings.php +++ b/framework/application/forms/Settings.php @@ -63,7 +63,16 @@ class Cubedesigners_Form_Settings extends CubeIT_Form_Settings { $tags->setLabel(__('Tags')); $this->addElement($tags); + /* ALERT POPUP MESSAGE - used for important notifications */ + $alert_message_enabled = new Zend_Form_Element_Checkbox('alert_message_enabled'); + $alert_message_enabled->setLabel(__("Activer le message d'alerte")); + $alert_message_enabled->setValue(false); + $this->addElement($alert_message_enabled); + + $alert_message = new CubeIT_Form_Element_Markitup('alert_message'); + $alert_message->setLabel(__("Message d'alerte")); + $this->addElementLocalized($alert_message); } -} \ No newline at end of file +} diff --git a/framework/application/views/helpers/AlertMessage.php b/framework/application/views/helpers/AlertMessage.php new file mode 100644 index 0000000..d9f23ce --- /dev/null +++ b/framework/application/views/helpers/AlertMessage.php @@ -0,0 +1,25 @@ +getOpt('alert_message_enabled', false) || Bootstrap::getInstance()->getSession()->hideAlertMessage) { + return ''; + } + + $this->addScriptAndStyle('alert-message'); + + $message = $this->view->markupDotclear(Bootstrap::getInstance()->getOpt('alert_message'), [], ['class' => 'alert-message-text']); + + $content = $message; + $content .= ''; + + $res = $this->htmlElement($content, 'div', ['class' => 'alert-message-content']); + + return $this->htmlElement($res, 'div', ['id' => 'alertMessage', 'class' => 'alert-message-wrapper']); + } + +} + +?> diff --git a/framework/application/views/helpers/ContactInfos.php b/framework/application/views/helpers/ContactInfos.php index 2ff8d08..cfa4926 100644 --- a/framework/application/views/helpers/ContactInfos.php +++ b/framework/application/views/helpers/ContactInfos.php @@ -26,10 +26,11 @@ class Cubedesigners_View_Helper_ContactInfos extends Zend_View_Helper_Abstract { $res.=$this->view->linkGeo(__("Plan d'accès"), $bureau['coordonnees']['adresse'] . ',' . $bureau['coordonnees']['ville'] . ',' . Zend_Locale::getTranslation($bureau['coordonnees']['pays'], 'territory'), array('class' => 'but mobile')); $res.=''; - $res.='
'; - $res.='

' . __('Tel') . ' ' . $this->view->linkPhone($bureau['coordonnees']['tel']) . '

'; - //$res.='

' . __('Fax') . ' ' . $bureau['coordonnees']['fax'] . '

'; - $res.='
'; + // PHONE NUMBERS TEMPORARILY HIDDEN... + // $res.='
'; + // $res.='

' . __('Tel') . ' ' . $this->view->linkPhone($bureau['coordonnees']['tel']) . '

'; + // //$res.='

' . __('Fax') . ' ' . $bureau['coordonnees']['fax'] . '

'; + // $res.='
'; $res.=''; // .inner diff --git a/framework/application/views/helpers/FooterContact.php b/framework/application/views/helpers/FooterContact.php index 57cdb92..6cea4d8 100644 --- a/framework/application/views/helpers/FooterContact.php +++ b/framework/application/views/helpers/FooterContact.php @@ -16,11 +16,12 @@ class Cubedesigners_View_Helper_FooterContact extends Zend_View_Helper_Abstract $res .= '

' . sprintf(__('Bureaux de %s'), $bureau['coordonnees']['nom']) . '

'; - $res .= '

'; - $event = array('category' => 'phone', 'action' => 'call', 'label' => $bureau['coordonnees']['tel']); - $res .= '

' . __('Tel') . ' ' . $this->view->linkPhone($bureau['coordonnees']['tel'], null, array('data-event' => $event)) . '

'; - //$res.='

' . __('Fax') . ' ' . $this->view->linkPhone($bureau['coordonnees']['fax']) . '

'; - $res .= '
'; + /* TEMPORARILY HIDING PHONE NUMBERS AFTER FAKE JOB ADS WERE POSTED IN THE NAME OF CUBEDESIGNERS... */ + // $res .= '
'; + // $event = array('category' => 'phone', 'action' => 'call', 'label' => $bureau['coordonnees']['tel']); + // $res .= '

' . __('Tel') . ' ' . $this->view->linkPhone($bureau['coordonnees']['tel'], null, array('data-event' => $event)) . '

'; + // //$res.='

' . __('Fax') . ' ' . $this->view->linkPhone($bureau['coordonnees']['fax']) . '

'; + // $res .= '
'; //$res.= $this->view->microdataPlace($bureau['coordonnees']['adresse']); diff --git a/framework/application/views/scripts/common/body.phtml b/framework/application/views/scripts/common/body.phtml index 60fcfd9..776336f 100644 --- a/framework/application/views/scripts/common/body.phtml +++ b/framework/application/views/scripts/common/body.phtml @@ -2,6 +2,7 @@ echo '' . "\n"; echo $this->bannerCookies(); +echo $this->alertMessage(); echo $this->render('admin/mockup.phtml'); echo $this->render('admin/nav.phtml'); echo $this->render('common/content.phtml'); diff --git a/js/alert-message.js b/js/alert-message.js new file mode 100644 index 0000000..aa98272 --- /dev/null +++ b/js/alert-message.js @@ -0,0 +1,11 @@ +registerLoader(load_alert_message, true); + +function load_alert_message() { + $(document).on('click', '.alert-message-close', function() { + processAjaxURL('/ajax/alertMessageDismiss'); + $("#alertMessage").fadeOut(function () { + $(this).remove(); + }); + return false; + }); +} diff --git a/less/alert-message.less b/less/alert-message.less new file mode 100644 index 0000000..e0dc2fa --- /dev/null +++ b/less/alert-message.less @@ -0,0 +1,58 @@ +.alert-message { + &-wrapper { + background-color: rgba(0,0,0,0.7); + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: hidden; + display: flex; + align-items: center; + justify-content: center; + z-index: 9999; + } + + &-close { + position: absolute; + top: 2rem; + right: 2rem; + width: 2.5em; + height: 2.5em; + appearance: none; + border: none; + background: transparent; + cursor: pointer; + + svg { + width: 100%; + height: auto; + } + } + + &-content { + position: relative; + background-color: #fff; + padding: 2rem; + max-width: 68ch; + width: 95vw; + outline: 8px solid #fc0; + margin: 1rem; + font-size: 1.25em; + } + + &-text { + line-height: 1.5; + + & > * + * { + margin-top: 1em; + } + + h1, h2, h3 { + margin-bottom: 0; + text-align: center; + line-height: 1.2; + font-weight: 700; + } + } +} -- 2.39.5