Commit 91379d1e authored by Ghislain Loas's avatar Ghislain Loas

wip on theme store

parent 914e90d5
Pipeline #10032 passed with stage
in 44 minutes and 42 seconds
28/04/2020 - v8.0.55
- Magasin de thèmes : correction de l'ordre de chargement des fichiers CSS.
27/04/2020 - v8.0.54
- ticket #104297 : Ressources numériques : ToutApprendre : possibilité de lien (pkGroup) pointant sur des catégories spécifiques de ToutApprendre
......
......@@ -321,6 +321,7 @@ class Admin_ProfilController extends ZendAfi_Controller_Action {
}
$enreg = $this->_updateBannerWidgets($profil, $enreg);
$enreg = $this->_updateFooterWidgets($profil, $enreg);
if($profil->setCfgAccueil($enreg)->save()) {
$this->_helper->notify($this->view->_('Page ' . $profil->getLibelle() . ' sauvegardée'));
......@@ -345,6 +346,19 @@ class Admin_ProfilController extends ZendAfi_Controller_Action {
}
protected function _updateFooterWidgets($profil, $enreg) {
if(!$parent_profil = $profil->getParentProfil())
return $this->_injectDefaultsBannerWidgets($profil, $enreg);
$temp_profil = (new Class_Profil())->setCfgAccueil($enreg);
$parent_profil
->setFooterBoxes($temp_profil->getFooterBoxes())
->save();
return $enreg;
}
protected function _injectDefaultsBannerWidgets($profil, $enreg) {
$required_widgets = $this->getSearchAndLoginWidget($profil->getBoitesDivision(Class_Profil::DIV_BANNIERE));
foreach( $required_widgets as $id => $module) {
......
......@@ -613,15 +613,21 @@ class Class_Profil extends Storm_Model_Abstract {
return Class_Url::absolute('');
}
protected function isModulePreferencesSharedBetweenProfils($module, $type_module) {
protected function _isModulePreferencesSharedBetweenProfils($module, $type_module) {
if (isset($module['parent_id']))
return false;
return '';
return (
(isset($module['division']) && ($module['division'] == self::DIV_BANNIERE))
||
(!isset($module['division']) && ($this->isTypeBoiteInBanniere($type_module)))
);
if (isset($module['division']) && ($module['division'] == self::DIV_BANNIERE))
return self::DIV_BANNIERE;
if (isset($module['division']) && ($module['division'] == self::DIV_FOOTER))
return self::DIV_FOOTER;
if (!isset($module['division']) && ($this->isTypeBoiteInBanniere($type_module)))
return self::DIV_BANNIERE;
return '';
}
......@@ -637,8 +643,8 @@ class Class_Profil extends Storm_Model_Abstract {
$cfg_accueil['modules'][$id_module] :
['preferences' => []];
if ($this->isModulePreferencesSharedBetweenProfils($module, $type_module))
return $this->getModuleAccueilPreferencesByType($type_module, self::DIV_BANNIERE, $id_module);
if ($division_shared = $this->_isModulePreferencesSharedBetweenProfils($module, $type_module))
return $this->getModuleAccueilPreferencesByType($type_module, $division_shared, $id_module);
$preferences = [];
if (array_isset('preferences', $module))
......@@ -678,6 +684,15 @@ class Class_Profil extends Storm_Model_Abstract {
return $this;
}
if (isset($module_config['division'])
&& (self::DIV_FOOTER == $module_config['division'])
&& $this->hasParentProfil()) {
$this->getParentProfil()
->updateModuleConfigAccueil($id_module, $module_config)
->save();
return $this;
}
$cfg_accueil = $this->getCfgAccueilAsArray();
$cfg_accueil['modules'][$id_module] = $module_config;
$this->setCfgAccueil($cfg_accueil);
......@@ -755,8 +770,8 @@ class Class_Profil extends Storm_Model_Abstract {
: ['type_module' => $type_module,
'preferences' => Class_Systeme_ModulesAccueil::getInstance()->getValeursParDefaut($type_module)];
if ($this->isModulePreferencesSharedBetweenProfils($module, $type_module))
return $this->getModuleAccueilConfigByType($type_module, self::DIV_BANNIERE);
if ($division_shared = $this->_isModulePreferencesSharedBetweenProfils($module, $type_module))
return $this->getModuleAccueilConfigByType($type_module, $division_shared);
if ($local_config = $this->getLocalModuleAccueilConfig($id_module))
return $local_config;
......@@ -778,6 +793,18 @@ class Class_Profil extends Storm_Model_Abstract {
}
public function getFooterBoxes() {
$cfg_accueil = $this->getCfgAccueilAsArray();
$_boxes = [];
foreach ($cfg_accueil['modules'] as $id => $module) {
if (isset($module['division']) && ($module['division'] == self::DIV_FOOTER))
$_boxes[$id] = $module;
}
return $_boxes;
}
public function setBannerBoxes($widgets) {
$cfg_accueil = $this->getCfgAccueilAsArray();
foreach ($cfg_accueil['modules'] as $id => $module) {
......@@ -793,15 +820,33 @@ class Class_Profil extends Storm_Model_Abstract {
}
public function setFooterBoxes($widgets) {
$cfg_accueil = $this->getCfgAccueilAsArray();
foreach ($cfg_accueil['modules'] as $id => $module) {
if ($module['division'] == self::DIV_FOOTER)
unset($cfg_accueil['modules'][$id]);
}
foreach($widgets as $id => $config)
$cfg_accueil['modules'][$id] = $config;
$this->setCfgAccueil($cfg_accueil);
return $this;
}
/** @return array */
public function getLocalModuleAccueilConfig($id_module) {
$cfg_accueil = $this->getCfgAccueilAsArray();
$banner_boxes = [];
if ($this->hasParentProfil())
$footer_boxes = [];
if ($this->hasParentProfil()) {
$banner_boxes = $this->getParentProfil()->getBannerBoxes();
$footer_boxes = $this->getParentProfil()->getFooterBoxes();
}
$modules_config = $cfg_accueil['modules'] + $banner_boxes;
$modules_config = $cfg_accueil['modules'] + $banner_boxes + $footer_boxes;
$module = ['type_module' => null,
'preferences' => [],
......@@ -1570,9 +1615,15 @@ class Class_Profil extends Storm_Model_Abstract {
public function hasBoiteInDivision($division, $type_module) {
$cfg_accueil = null;
if ($division == self::DIV_BANNIERE and $this->hasParentProfil())
$cfg_accueil = $this->getParentProfil()->getCfgAccueilAsArray();
else
if ($division == self::DIV_FOOTER and $this->hasParentProfil())
$cfg_accueil = $this->getParentProfil()->getCfgAccueilAsArray();
if (!$cfg_accueil)
$cfg_accueil = $this->getCfgAccueilAsArray();
$boites = $this->_filterCfgAccueilByDivision($cfg_accueil, $division);
......@@ -1592,6 +1643,9 @@ class Class_Profil extends Storm_Model_Abstract {
if ($division == self::DIV_BANNIERE and $this->hasParentProfil())
return $this->getParentProfil()->getBoitesDivision($division);
if ($division == self::DIV_FOOTER and $this->hasParentProfil())
return $this->getParentProfil()->getBoitesDivision($division);
if ($division == '5' && Class_AdminVar::isBoitePanierAutoEnabled())
$this->setBoitePanierInDivisionFive();
......@@ -1964,10 +2018,15 @@ class Class_Profil extends Storm_Model_Abstract {
if(!$this->hasParentProfil())
return;
if(!$parent_banner_modules = $this->getParentProfil()->getBoitesDivision(self::DIV_BANNIERE))
$parent_modules = $this->getParentProfil()->getBoitesDivision(self::DIV_BANNIERE)
+ $this->getParentProfil()->getBoitesDivision(self::DIV_FOOTER);
$parent_modules = array_filter($parent_modules);
if (!$parent_modules)
return;
if(!$ids_used_by_parent_profil = array_keys($parent_banner_modules))
if(!$ids_used_by_parent_profil = array_keys($parent_modules))
return;
return $this->doNotUseIds($ids_used_by_parent_profil);
......
......@@ -104,4 +104,9 @@ class Class_Systeme_Widget_Section extends Class_Systeme_Widget_Abstract {
public function isMain() {
return $this->getResourcesDefinition()->isMain();
}
public function isShared() {
return false;
}
}
\ No newline at end of file
......@@ -30,4 +30,9 @@ class Class_Systeme_Widget_Section_Footer extends Class_Systeme_Widget_Section {
public function getResourcesDefinition() {
return new Class_Systeme_ModulesAccueil_Section_Footer;
}
public function isShared() {
return true;
}
}
\ No newline at end of file
......@@ -30,4 +30,9 @@ class Class_Systeme_Widget_Section_Header extends Class_Systeme_Widget_Section {
public function getResourcesDefinition() {
return new Class_Systeme_ModulesAccueil_Section_Header;
}
public function isShared() {
return true;
}
}
\ No newline at end of file
......@@ -19,7 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Template_Settings extends Storm_Model_Abstract {
protected
......
<?php
/**
* Copyright (c) 2012-2020, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Class_Template_Update {
public function run() {
$templates = (new Class_Template_Loader)->getTemplates();
array_walk($templates,
function($template)
{
$template->updateSettings();
});
}
}
......@@ -25,6 +25,6 @@ class ZendAfi_Form_Decorator_Custom extends Zend_Form_Decorator_HtmlTag {
public function render($content) {
$view = $this->_element->getView();
$render = $this->_element->getAttrib('render');
return parent::render($render());
return parent::render($render($view));
}
}
\ No newline at end of file
......@@ -22,6 +22,9 @@
class ZendAfi_View_Helper_Div extends ZendAfi_View_Helper_BaseHelper {
public function div($attributes = [], $content = '') {
if ( null === $content)
$content = '';
return $this->_tag('div',
$content,
$attributes);
......
......@@ -226,6 +226,10 @@ class ZendAfi_View_Helper_FonctionsAdmin extends ZendAfi_View_Helper_BaseHelper
&& ($parent = Class_Profil::getCurrentProfil()->getParentProfil()))
$id_profil = $parent->getId();
if(Class_Profil::DIV_FOOTER == $this->division
&& ($parent = Class_Profil::getCurrentProfil()->getParentProfil()))
$id_profil = $parent->getId();
return $id_profil;
}
}
\ No newline at end of file
......@@ -81,7 +81,7 @@ class Bokeh_Engine {
function setupConstants() {
defineConstant('BOKEH_MAJOR_VERSION','8.0');
defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.54');
defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.55');
defineConstant('BOKEH_REMOTE_FILES', 'https://git.afi-sa.net/afi/opacce/');
......
......@@ -246,6 +246,23 @@ pre {
background: none !important;
}
.transparent_background .breadcrumb,
.transparent_background {
background: var(--front-transparent-background) !important;
}
.limit_badges_10 .badge-group .badge:nth-child(n + 11) {
display: none;
}
.limit_badges_5 .badge-group .badge:nth-child(n + 6) {
display: none;
}
.limit_badges_3 .badge-group .badge:nth-child(n + 4) {
display: none;
}
.no_border,
.no_border * {
border: 0px solid rgba(0,0,0,0) !important;
......@@ -786,16 +803,10 @@ input[id^="select_record"] + * {
min-width: 1px;
}
.only_visible_in_viewnotice {
display: none;
.z_index_11 {
z-index: 11;
}
.recherche_viewnotice .only_visible_in_viewnotice {
display: block;
.menu_buttons .button_text {
display: none !important;
}
.badge.only_visible_in_viewnotice .text-truncate {
width: auto;
max-width: none;
white-space: normal;
}
\ No newline at end of file
......@@ -55,6 +55,29 @@ class Intonation_Library_FormCustomizer_Abstract {
['label' => $this->_('Classe CSS personnalisée'),
'separator' => ' ',
'multiOptions' => $css]]);
$this->_form
->addElement('custom',
'classes_documentation',
['render' => function($view)
{
$html =
$view->tagAnchor('http://wiki.bokeh-library-portal.org/index.php?title=Classes_CSS',
Class_Admin_Skin::current()->renderActionIconOn('help', $view),
['class' => 'ardans_help',
'style' => 'margin-left: 5px',
'title' => $this->_('Consulter la documentation sur les classes dans le Wiki Bokeh'),
'target' => '_blank']);
return $view->tag('script',
sprintf('$(function() {$("[data-name*=%s]").append("%s");});',
'boite',
str_replace('"', "'", $html)));
}]);
$this->_form
->addToStyleGroup(['boite',
'classes_documentation']);
return $this;
}
......@@ -327,7 +350,7 @@ class Intonation_Library_FormCustomizer_Abstract {
->addToDisplayGroup(array_map(function($element)
{
return $this->_template->withNameSpace($element);
},$elements),
}, $elements),
$this->_template->withNameSpace('group'));
return $this;
}
......@@ -336,7 +359,7 @@ class Intonation_Library_FormCustomizer_Abstract {
->addDisplayGroup(array_map(function($element)
{
return $this->_template->withNameSpace($element);
},$elements),
}, $elements),
$this->_template->withNameSpace('group'),
['legend' => $this->_('Thème'),
'order' => static::FIRST]);
......
......@@ -82,7 +82,24 @@ class Intonation_Library_FormCustomizer_Template extends Intonation_Library_Form
'fields' => [['name' => $this->_template->withNameSpace('custom_css_class'),
'label' => $this->_('classe')]],
'values' => [$this->_template->withNameSpace('custom_css_class') => $this->_template->getCustomCssClass()],
'deleteMessage' => $this->_('cette classe')]);
'deleteMessage' => $this->_('cette classe')])
->addElement('custom',
$this->_template->withNameSpace('classes_documentation'),
['render' => function($view)
{
$html =
$view->tagAnchor('http://wiki.bokeh-library-portal.org/index.php?title=Classes_CSS',
Class_Admin_Skin::current()->renderActionIconOn('help', $view),
['class' => 'ardans_help',
'style' => 'margin-left: 5px',
'title' => $this->_('Consulter la documentation sur les classes dans le Wiki Bokeh'),
'target' => '_blank']);
return $view->tag('script',
sprintf('$(function() {$("[for*=%s]").append("%s");});',
$this->_template->withNameSpace('custom_css_classes'),
str_replace('"', "'", $html)));
}]);
$this
->_addToTemplateGroup(['core_css',
......@@ -97,6 +114,7 @@ class Intonation_Library_FormCustomizer_Template extends Intonation_Library_Form
'custom_css',
'custom_js',
'nb_cols',
'classes_documentation',
'custom_css_classes'])
->_addHydratingMappingGroupTo()
->_addResponsiveGroupTo()
......
......@@ -38,6 +38,7 @@ class Intonation_Library_FormCustomizer_Widget_Default extends Intonation_Librar
$this->_template->withNameSpace('show_footer'),
['label' => $this->_('Afficher le pied'),
'value' => 1]);
$this->_addCustomElement();
$this->_addToTemplateGroup($this->_getDefaultElementsNames());
......
......@@ -54,9 +54,16 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'z_index_2',
'z_index_3',
'pt-3',
'pt-5',
'pl-2',
'pl-md-3',
'pr-md-3',
'pb-3',
'px-3',
'py-3',
'm-auto',
'ml-auto',
'mr-auto',
'mb-3',
'mt-3',
'align-items-center',
......@@ -71,7 +78,18 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'text-right',
'text_small',
'text_no_transform',
'admin_tools_invert_colors'
'admin_tools_invert_colors',
'border-primary',
'border-left',
'z_index_11',
'transparent_background',
'limit_badges_3',
'limit_badges_5',
'limit_badges_10',
'justify-content-start',
'justify-content-end',
'justify-content-center',
'menu_buttons'
],
'hydrating_mapping' => ['div id site_web_wrapper' => 'container align-self-center no_overflow',
......@@ -104,7 +122,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'img class img-thumbnail' => '',
'dl' => 'row',
'dt' => 'col-12 col-sm-3',
'dd' => 'col-12 col-sm-9 d-flex flex-wrap align-content-start',
'dd' => 'col-12 col-sm-9',
'dt class user_info' => 'col-12 col-sm-6',
'dd class user_info' => 'col-12 col-sm-6',
'a' => 'text-secondary',
......@@ -203,6 +221,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'more' => 'class fas fa-ellipsis-h',
'refresh' => 'class fas fa-sync-alt',
'lock' => 'class fas fa-unlock-alt',
'eye' => 'class far fa-eye',
'email' => 'class fas fa-at',
'phone' => 'class fas fa-phone',
......@@ -304,7 +323,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
protected function _mergeData($default, $data) {
$merged = array_merge($data, $default);
$merged = array_merge($default, $data);
if (count(array_filter(array_keys($default), 'is_string')))
return $merged;
......
......@@ -27,6 +27,7 @@ abstract class Intonation_Library_View_Wrapper_Abstract {
protected
$_view,
$_model,
$_context,
$_context_params = [],
$_rich_content,
$_in_js_search = false;
......@@ -56,8 +57,9 @@ abstract class Intonation_Library_View_Wrapper_Abstract {
}
public function setContextParams($params) {
$this->_context_params = $params;
public function setContext($instance) {
$this->_context = $instance;
$this->_context_params = $instance->getLinkToAllParams();
return $this;
}
......
......@@ -96,7 +96,8 @@ class Intonation_Library_View_Wrapper_ActivitySession extends Intonation_Library
public function getDescription() {
return
$this->getBadges()
. $this->_view->truncate($this->_model->getContenu());
. $this->_view->truncate($this->_model->getContenu(),
['class' => 'model_description_' . get_class($this->_model)]);
}
......@@ -169,7 +170,7 @@ class Intonation_Library_View_Wrapper_ActivitySession extends Intonation_Library
$main_title)));
}
return $this->_view->renderBadges($badges);
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -23,7 +23,10 @@
class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wrapper_Abstract {
public function getMainTitle() {
return $this->_model->getTitre();
return
$this->_model->getCacherTitre()
? ''
: $this->_model->getTitre();
}
......@@ -76,7 +79,8 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
public function getDescription() {
return $this->getBadges()
. $this->_view->truncate($this->_model->getSummary());
. $this->_view->truncate($this->_model->getSummary(),
['class' => 'model_description_' . get_class($this->_model)]);
}
......@@ -196,7 +200,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
$value));
}
return $this->_view->renderBadges($badges);
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -165,7 +165,8 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra
public function getDescription() {
return
$this->getBadges()
. $this->_view->truncate($this->getFullDescription());
. $this->_view->truncate($this->getFullDescription(),
['class' => 'model_description_' . get_class($this->_model)]);
}
......@@ -198,7 +199,7 @@ class Intonation_Library_View_Wrapper_Author extends Intonation_Library_View_Wra
$facet_label)));
}
return $this->_view->renderBadges($badges);
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -43,9 +43,14 @@ class Intonation_Library_View_Wrapper_Domain extends Intonation_Library_View_Wra
public function getMainLink() {
return new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'recherche',
'action' => 'simple',
'id_catalogue' => $this->_model->getId()]),
$url = ['controller' => 'recherche',
'action' => 'simple',
'id_catalogue' => $this->_model->getId()];
if ($this->_context)
$url ['id_module'] = $this->_context->getId();
return new Intonation_Library_Link(['Url' => $this->_view->url($url),
'Image' => Class_Template::current()->getIco($this->_view,
'read-document',
......
......@@ -207,7 +207,7 @@ class Intonation_Library_View_Wrapper_Hold extends Intonation_Library_View_Wrapp
->setTitle($this->_('Rang de la réservation: %s', $this->_model->getRang())))
];
return $this->_view->renderBadges($badges);
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -141,7 +141,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
$this->_model->getCodeBarres())))
];
return $this->_view->renderBadges($badges);
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -85,7 +85,8 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr
return
$this->getBadges()
. $this->_view->renderLibraryOpening($this->_model)
. $this->_view->truncate($this->_model->getInscription());
. $this->_view->truncate($this->_model->getInscription(),
['class' => 'model_description_' . get_class($this->_model)]);
}
......@@ -174,7 +175,7 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr
$value));
}
return $this->_view->renderBadges($badges);
return $this->_view->renderBadges($badges, $this);
}
......
......@@ -48,6 +48,11 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Navigation {
return $this->_list;
$this->_list = Class_Bib::findAllBy(['order' => 'libelle']);
$this->_list = array_filter($this->_list, function($library)
{
return null !== Class_Users::findFirstBy(['id_site' => $library->getId(),
'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB]);
});