From: vincent@cubedesigners.com Date: Wed, 13 Jan 2021 17:17:28 +0000 (+0000) Subject: wait #4191 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=22de04706a2384deb99ed68bebde80ec72426ec8;p=fluidbook-v3.git wait #4191 @0.75 --- diff --git a/framework/application/configs/application.ini b/framework/application/configs/application.ini index 150b72d..6b904f8 100644 --- a/framework/application/configs/application.ini +++ b/framework/application/configs/application.ini @@ -91,6 +91,7 @@ httpauth.username = fluidbook httpauth.password = fb2016 httpauth.ip_whitelist[] = 82.66.245.49 httpauth.ip_whitelist[] = 82.216.164.184 +httpauth.ip_whitelist[] = 82.66.120.161 httpauth.ip_whitelist[] = 78.193.201.107 robots = false diff --git a/framework/application/forms/CMS/Sub/Features/Feature.php b/framework/application/forms/CMS/Sub/Features/Feature.php index 2ddc078..0595908 100644 --- a/framework/application/forms/CMS/Sub/Features/Feature.php +++ b/framework/application/forms/CMS/Sub/Features/Feature.php @@ -1,44 +1,52 @@ setLabel('Titre du bloc'); - $this->addElement($title); - - $content = new CubeIT_Form_Element_Markitup('content'); - $content->setLabel('Contenus'); - $this->addElement($content); - - $icon = new Fluidbook_Form_Element_Picto('icon'); - $icon->setLabel('Pictogramme reference (CSS class)'); - $this->addElement($icon); - - $bg_gradient = new Fluidbook_Form_CMS_Sub_Gradient(); - $bg_gradient->setLegend('Background Gradient'); - $this->addSubForm($bg_gradient, 'background_gradient'); - - $bg_image = new CubeIT_Form_Element_File_Image('background_image'); - $bg_image->setLabel('Background Image'); - $this->addElement($bg_image); - - $layout = new Zend_Form_Element_Select('layout'); - $layout->setLabel('Layout'); - $layout->setMultiOptions(array( - 'square-top' => 'Square block with image top', - 'square-bottom' => 'Square block with image bottom', - 'rectangle-right' => 'Large rectangle with image right', - 'rectangle-bottom' => 'Large rectangle with image bottom', - 'small-rectangle-tall' => 'Small rectangle (tall)', - 'small-rectangle-wide' => 'Small rectangle (wide)', - )); - $this->addElement($layout); - - $link = new CubeIT_Form_Element_Link('link'); - $link->setLabel('Lien'); - $this->addSubForm($link, 'link'); - } +class Fluidbook_Form_CMS_Sub_Features_Feature extends CubeIT_Form_SubForm +{ + + public function init() + { + parent::init(); + + $title = new CubeIT_Form_Element_Text('title'); + $title->setLabel('Titre du bloc'); + $this->addElement($title); + + $content = new CubeIT_Form_Element_Markitup('content'); + $content->setLabel('Contenus'); + $this->addElement($content); + + $icon = new Fluidbook_Form_Element_Picto('icon'); + $icon->setLabel('Pictogramme reference (CSS class)'); + $this->addElement($icon); + + $bg_gradient = new Fluidbook_Form_CMS_Sub_Gradient(); + $bg_gradient->setLegend('Background Gradient'); + $this->addSubForm($bg_gradient, 'background_gradient'); + + $textColor = new Zend_Form_Element_Select('text_color'); + $textColor->setLabel('Text color'); + $textColor->setMultiOptions(['auto' => 'Automatic', + 'light' => 'Light', 'dark' => 'Dark']); + $this->addElement($textColor); + + $bg_image = new CubeIT_Form_Element_File_Image('background_image'); + $bg_image->setLabel('Background Image'); + $this->addElement($bg_image); + + $layout = new Zend_Form_Element_Select('layout'); + $layout->setLabel('Layout'); + $layout->setMultiOptions(array( + 'square-top' => 'Square block with image top', + 'square-bottom' => 'Square block with image bottom', + 'rectangle-right' => 'Large rectangle with image right', + 'rectangle-bottom' => 'Large rectangle with image bottom', + 'small-rectangle-tall' => 'Small rectangle (tall)', + 'small-rectangle-wide' => 'Small rectangle (wide)', + )); + $this->addElement($layout); + + $link = new CubeIT_Form_Element_Link('link'); + $link->setLabel('Lien'); + $this->addSubForm($link, 'link'); + } } \ No newline at end of file diff --git a/framework/application/views/helpers/FeaturesSection.php b/framework/application/views/helpers/FeaturesSection.php index 90bcfa7..66608bc 100644 --- a/framework/application/views/helpers/FeaturesSection.php +++ b/framework/application/views/helpers/FeaturesSection.php @@ -1,152 +1,169 @@ headScript()->addMasonry()->addJQueryTransform(); - - $res = '
'; - $res .= $this->title($title, $heading_element, array('class' => 'col-6')); - $res .= '
'; - - foreach ($blocks as $block) { - - // Generate ID for CSS - $id = 'block-' . strtolower(CubeIT_Util_Text::str2URL($block['title'])); - - // Text colour is based on whether block has a gradient or not - $text_colour = $this->hasGradient($block) ? 'light' : 'dark'; - - $res .= '
'; - $link = $this->linkCMS($block['link'], ['class' => 'button']); - if ($link) { - $res .= $this->htmlElement($link, 'div', ['class' => 'more']); - } - - $res .= $this->_CSS($id, $block); - - $res .= '
'; - - if (!empty($block['icon'])) { - $res .= '
'; - } - - $res .= '
'; - $res .= '

' . $block['title'] . '

'; - $res .= $this->markupDotclear($block['content']); - $res .= '
'; // .feature-text - - $res .= '
'; // .feature-inner - $res .= '
'; // .feature-block - } - - $res .= '
'; // .feature-blocks - $res .= '
'; // .content-wrapper - - return $res; - } - - protected function hasGradient($block) { - $gradient = $block['background_gradient']; - return !(empty($gradient['color1']) || empty($gradient['color2'])); - } - - protected function hasBGImage($block) { - return is_array($block['background_image']); - } - - protected function _layoutData($layout) { - - switch ($layout) { - case 'square-top': - case 'square-bottom': - $w = 2; - $h = 2; - break; - case 'rectangle-right': - case 'rectangle-bottom': - $w = 3; - $h = 2; - break; - case 'small-rectangle-tall': - $w = 1; - $h = 2; - break; - case 'small-rectangle-wide': - $w = 2; - $h = 1; - } - - if (!$w || !$h) - return ''; - - return 'data-w="' . $w . '" data-h="' . $h . '"'; - } - - protected function _CSS($id, $block) { - $res = ''; - - return $res; - } - - protected function _backgroundColour($block) { - if (empty($block['background_gradient']['color1'])) { - return ''; - } - - return 'background-color: ' . $block['background_gradient']['color1'] . ';'; - } - - protected function _backgroundImage($block) { - if (!is_array($block['background_image'])) - return ''; - - $path = CubeIT_View_Helper_ImageCms::getPath($block['background_image']); - - return "background-image: url('$path');"; - } - - protected function _gradient($block) { - - $gradient = $block['background_gradient']; - - if (empty($gradient['color1']) || empty($gradient['color2'])) { - return ''; - } - - $angle = '45deg'; - $c1 = $gradient['color1']; - $c2 = $gradient['color2']; - - return "background-image: -moz-linear-gradient($angle, $c1 0%, $c2 100%); +class Fluidbook_View_Helper_FeaturesSection extends CubeIT_View_Helper_Abstract +{ + + public function featuresSection($title, $blocks, $heading_element = 'h2') + { + + $this->headScript()->addMasonry()->addJQueryTransform(); + + $res = '
'; + $res .= $this->title($title, $heading_element, array('class' => 'col-6')); + $res .= '
'; + + foreach ($blocks as $block) { + + // Generate ID for CSS + $id = 'block-' . strtolower(CubeIT_Util_Text::str2URL($block['title'])); + + // Text colour is based on whether block has a gradient or not + $text_colour = (!isset($block['text_color']) || $block['text_color'] === 'auto') ? ($this->hasGradient($block) ? 'light' : 'dark') : $block['text_color']; + + $res .= '
'; + $link = $this->linkCMS($block['link'], ['class' => 'button']); + if ($link) { + $res .= $this->htmlElement($link, 'div', ['class' => 'more']); + } + + $res .= $this->_CSS($id, $block); + + $res .= '
'; + + if (!empty($block['icon'])) { + $res .= '
'; + } + + $res .= '
'; + $res .= '

' . $block['title'] . '

'; + $res .= $this->markupDotclear($block['content']); + $res .= '
'; // .feature-text + + $res .= '
'; // .feature-inner + $res .= '
'; // .feature-block + } + + $res .= '
'; // .feature-blocks + $res .= '
'; // .content-wrapper + + return $res; + } + + protected function hasGradient($block) + { + $gradient = $block['background_gradient']; + if (empty($gradient['color1']) && empty($gradient['color2'])) { + return false; + } + $c1 = mb_strtolower($gradient['color1']); + $c2 = mb_strtolower($gradient['color2']); + if ($c1 === $c2) { + return false; + } + return true; + } + + protected function hasBGImage($block) + { + return is_array($block['background_image']); + } + + protected function _layoutData($layout) + { + + switch ($layout) { + case 'square-top': + case 'square-bottom': + $w = 2; + $h = 2; + break; + case 'rectangle-right': + case 'rectangle-bottom': + $w = 3; + $h = 2; + break; + case 'small-rectangle-tall': + $w = 1; + $h = 2; + break; + case 'small-rectangle-wide': + $w = 2; + $h = 1; + } + + if (!$w || !$h) + return ''; + + return 'data-w="' . $w . '" data-h="' . $h . '"'; + } + + protected function _CSS($id, $block) + { + $res = ''; + + return $res; + } + + protected function _backgroundColour($block) + { + if (empty($block['background_gradient']['color1'])) { + return ''; + } + + return 'background-color: ' . $block['background_gradient']['color1'] . ';'; + } + + protected function _backgroundImage($block) + { + if (!is_array($block['background_image'])) + return ''; + + $path = CubeIT_View_Helper_ImageCms::getPath($block['background_image']); + + return "background-image: url('$path');"; + } + + protected function _gradient($block) + { + + $gradient = $block['background_gradient']; + + if (empty($gradient['color1']) || empty($gradient['color2'])) { + return ''; + } + + $angle = '45deg'; + $c1 = $gradient['color1']; + $c2 = $gradient['color2']; + + return "background-image: -moz-linear-gradient($angle, $c1 0%, $c2 100%); background-image: -webkit-linear-gradient($angle, $c1 0%, $c2 100%); background-image: linear-gradient($angle, $c1 0%, $c2 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='$c1', endColorstr='$c2',GradientType=1);"; - } + } }