Commit de5a9144 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#99489_magasin_de_themes_bases_sur_bootstrap' into 'master'

on theme store

See merge request !3556
parents bf469fdc e7e90cfc
Pipeline #10531 passed with stage
in 44 minutes and 1 second
......@@ -496,6 +496,17 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
if ($this->notice->isArticleCms())
return $this->_forward('render', 'cms', 'opac', ['id' => $this->notice->getArticleId()]);
if ((new Class_Notice_Sso($this->notice))->isValid())
return $this->_forward('sso-resources');
$first_item = $this->notice->getExemplaires()[0];
if ($url = $first_item->getUrl())
return $this->_forward('url-resources');
if ($bundle = $first_item->getBundle())
return $this->_forward('bundle-resources');
$this->notice->isRessourceNumerique()
? $this->_forward('digital-resources')
: $this->_forward('items-resources');
......@@ -513,6 +524,52 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
}
public function ssoResourcesAction() {
$callback = function() {
return $this->view->tagAnchor($this->view->url(['module' => 'opac',
'controller' => 'modules',
'action' => 'sso',
'id' => $this->notice->getId()],
null,
true),
$this->view->_('Consulter en ligne'),
['class' => 'btn btn-lg btn-primary m-3']);
};
return $this->_helper->ajax($callback);
}
public function urlResourcesAction() {
$first_item = $this->notice->getExemplaires()[0];
$callback = function() use ($first_item) {
return $this->view->tagAnchor($first_item->getUrl(),
$this->view->_('Description en ligne'),
['class' => 'btn btn-lg btn-primary m-3']);
};
return $this->_helper->ajax($callback);
}
public function bundleResourcesAction() {
$first_item = $this->notice->getExemplaires()[0];
$callback = function() use ($first_item) {
if ( ! $bundle = $first_item->getBundle())
return $this->_('Lot introuvable');
return $this->view->tagAnchor($this->view->urlNotice($bundle),
$this->view->_('Fait partie du lot %s',
$bundle->getTitrePrincipal()),
['class' => 'btn btn-lg btn-primary m-3']);
};
return $this->_helper->ajax($callback);
}
public function digitalResourcesAction() {
$callback = function() {
if ($digital_resource = new Intonation_Library_Record_DigitalResources($this->notice,
......
......@@ -69,7 +69,11 @@ class Class_ProfilePrefs extends Class_Entity {
public function getItemBundleIdField() {
return $this->getItemPrefs()[Class_IntProfilDonnees::FIELD_ITEM_BUNDLE_ID];
$item_prefs = $this->getItemPrefs();
return isset($item_prefs[Class_IntProfilDonnees::FIELD_ITEM_BUNDLE_ID])
? $item_prefs[Class_IntProfilDonnees::FIELD_ITEM_BUNDLE_ID]
: '';
}
......
......@@ -25,7 +25,8 @@ class Class_Template_Loader {
public function getTemplates() {
return [new Historic_Template,
return [new Chili_Template,
new Historic_Template,
new Intonation_Template,
new Muscle_Template,
new MyBibApp_Template,
......
......@@ -151,8 +151,13 @@ class TypeDocLoader extends Storm_Model_Loader {
public function findUsedTypeDocIds() {
$rows = Class_Notice::getTable()
->getAdapter()
if ( ! $table = Class_Notice::getTable())
return [];
if ( ! $adapter = $table->getAdapter())
return [];
$rows = $adapter
->fetchAll('select distinct(type_doc) from notices');
return array_map(function($row){return $row['type_doc'];},
$rows);
......
This diff is collapsed.
<?php
/**
* Copyright (c) 2012-2019, 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 Chili_Library_FormCustomizer extends Intonation_Library_FormCustomizer {
public function getTemplateForm($form) {
return (new Chili_Library_FormCustomizer_Template($this->_template, $form))->getForm();
}
}
<?php
/**
* Copyright (c) 2012-2019, 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 Chili_Library_FormCustomizer_Template extends Intonation_Library_FormCustomizer_Template {
public function getForm() {
parent::getForm();
$this->_form
->addElement('checkbox',
$this->_template->withNameSpace('chili_css'),
['label' => $this->_('chili.css'),
'order' => 3]);
$this->_addToTemplateGroup(['chili_css']);
return $this;
}
}
This diff is collapsed.
<?php
/**
* Copyright (c) 2012-2019, 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 Chili_Library_Settings extends Intonation_Library_Settings {
protected function _getDefaultSettings() {
$settings = parent::_getDefaultSettings();
$settings[$this->_template->withNameSpace('chili_css')] = 1;
$custom_css_classes = $settings[$this->_template->withNameSpace('custom_css_class')];
$custom_css_classes = array_merge($custom_css_classes,
['chili_widget',
'fond_gris',
'fond_bleu',
'fond_rouge',
'fond_blanc',
'py_4rem',
'ml-3',
'mr-3']);
$settings[$this->_template->withNameSpace('custom_css_class')] = $custom_css_classes;
$hydrating_mapping = $settings[$this->_template->withNameSpace('hydrating_mapping')];
$hydrating_mapping['div id site_web_wrapper'] = 'container align-self-center';
$hydrating_mapping['li class result_count_results'] = 'order-1';
$hydrating_mapping['li class result_search_order'] = 'order-2';
$hydrating_mapping['li class result_list_mod'] = 'order-3';
$hydrating_mapping['li class result_wall_mod'] = 'order-4';
$hydrating_mapping['li class result_page_size'] = 'order-5';
$hydrating_mapping['li class result_pager'] = 'order-6';
$hydrating_mapping['li class result_select_records'] = 'order-7';
$hydrating_mapping['li class result_follow_search'] = 'order-8';
$hydrating_mapping['li class result_more_actions'] = 'order-9';
$hydrating_mapping['div class wrapper_zendafi_form_custommultifacetsdoctype'] = 'col-2 order-1';
$hydrating_mapping['div class zendafi_form_search_submit_button'] = 'col-2';
$hydrating_mapping['div class wrapper_zendafi_form_expressionrecherche'] = 'order-2 col-md-5 col-lg-6';
$settings[$this->_template->withNameSpace('hydrating_mapping')] = $hydrating_mapping;
return $settings;
}
}
<?php
/**
* Copyright (c) 2012-2019, 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 Chili_Library_WidgetTemplates extends Intonation_Library_WidgetTemplates {
protected function _getDefaultStyles() {
return ['no_background',
'no_border',
'no_border_radius',
'no_shadow',
'm-auto',
'auto_col',
'pt-3',
'pb-3',
'chili_widget'];
}
protected function _getMenuDefaultStyles() {
return ['no_border',
'no_border_radius',
'no_shadow',
'justify-content-start',
'pt-3'];
}
}
<?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 Chili_Template extends Intonation_Template {
const ID = 'CHILI';
public function __construct() {
$this->setId(static::ID)
->setTitle($this->_('Chili (en cours de développement)'))
->setSettings(new Chili_Library_Settings($this))
->setPatcher(new Chili_Library_ProfilePatcher($this));
}
public function getProfile() {
if ($this->_profile)
return $this->_profile;
if ($this->_profile = Class_Profil::findFirstBy(['template' => $this->getId()]))
return $this->_profile;
$this->createFrom(Class_Profil::getPortail());
return $this->_profile = Class_Profil::getCurrentProfil();
}
public function renderOpac($view) {
return (new Chili_View_Opac($this, $view))->render();
}
public function renderSubModal($view) {
return (new Chili_View_SubModal($this, $view))->render();
}
public function customTemplateForm($form) {
$helper = new Chili_Library_FormCustomizer($this);
return $helper->getTemplateForm($form);
}
public function getWidgetTemplates() {
return (new Chili_Library_WidgetTemplates)->getTemplates();
}
public function addHelperPath($view) {
parent::addHelperPath($view);
$view->addHelperPath('templates/Chili/View', 'Chili_View');
return $this;
}
public function addAdminHelperPath($view) {
parent::addAdminHelperPath($view);
$view->addHelperPath('templates/Chili/View/Admin', 'Chili_View_Admin');
return $this;
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2019, 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 Chili_View_Opac extends Intonation_View_Opac {
protected function _addTemplateCss($script_loader) {
if ($this->_template->getChiliCss())
$script_loader->addStyleSheet(Class_Url::absolute('/library/templates/Chili/Assets/css/chili.css'));
}
}
<?php
/**
* Copyright (c) 2012-2019, 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 Chili_View_SubModal extends Intonation_View_SubModal {
protected function _headContent() {
Class_ScriptLoader::getInstance()
->addStyleSheet(Class_Url::absolute('/library/templates/Chili/Assets/css/chili.css'));
return parent::_headContent();
}
}
......@@ -31,6 +31,13 @@ class Intonation_Library_FormCustomizer_Profile extends Intonation_Library_FormC
$banner_group->clearElements();
$this->_form->removeDisplayGroup('banner_group');
$this->_form
->addElement('userfile',
'favicon',
['label' => $this->_('Icône du navigateur'),
'folder' => 'image'])
->addToHeadGroup(['favicon']);
return $this->_form;
}
}
\ No newline at end of file
......@@ -313,6 +313,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'track' => 'class fas fa-music',
'video' => 'class fas fa-video',
'image' => 'class far fa-image',
'play' => 'class fas fa-play',
]
];
......
......@@ -72,7 +72,7 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr
public function getFullDescription() {
return
$this->getBadges()
. $this->_view->renderLibraryOpening($this->_model)
. $this->_renderOpening()
. $this->_view->taq('p', $this->_model->getInscription())
. $this->_view->tag('p', $this->_model->getPret())
. $this->_view->tag('p', $this->_model->getFonds())
......@@ -84,12 +84,19 @@ class Intonation_Library_View_Wrapper_Library extends Intonation_Library_View_Wr
public function getDescription() {
return
$this->getBadges()
. $this->_view->renderLibraryOpening($this->_model)
. $this->_renderOpening()
. $this->_view->truncate($this->_model->getInscription(),
['class' => 'model_description_' . get_class($this->_model)]);
}
protected function _renderOpening() {
return ($openings = $this->_model->getHoraire())
? $openings
: $this->_view->renderLibraryOpening($this->_model);
}
public function getDescriptionTitle() {
return '';
}
......
......@@ -51,21 +51,17 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Details extends Intona
protected function _renderInformations() {
$html = [];
$column_map = ['getInscription' => $this->_('Modalités d\'inscription'),
'getPret' => $this->_('Modalités des prêts'),
'getFond' => $this->_('Fonds'),
'getProcure' => $this->_('Comment se procurer un document'),
'getAnnexe' => $this->_('Annexe'),
'getResetPassword' => $this->_('Comment modifier mon mot de passe')];
if ($inscription = $this->_model->getInscription())
$html [] = $this->_view->div(['class' => 'col-12'],
$this->_view->tag('h4',
$this->_('Modalités d\'inscription'))
. $this->_view->tag('p',
$inscription));
$html = [];
if ($pret = $this->_model->getPret())
$html [] = $this->_view->div(['class' => 'col-12'],
$this->_view->tag('h4',
$this->_('Modalités des prêts'))
. $this->_view->tag('p',
$pret));
foreach ($column_map as $attrib => $label)
$html = $this->_addAttributAsHtml($attrib, $label, $html);
$count = 0;
foreach($this->_model->getAllCustomFields()->getFieldValues() as $field) {
......@@ -92,6 +88,18 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Details extends Intona
}
protected function _addAttributAsHtml($attrib, $label, $html) {
if ($value = $this->_model->$attrib())
$html [] = $this->_view->div(['class' => 'col-12'],
$this->_view->tag('h4',
$label)
. $this->_view->tag('p',
$value));
return $html;
}
protected function _renderBlock($content, $title, $class_name, $display = true) {
$style = ($display) ? [] : ['style' => 'display:none;'];
return $this->_view->tag('div',
......
......@@ -378,18 +378,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
public function getActions() {
$actions = [];
if (!$this->_model->isRessourceNumerique())
$actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne',
'action' => 'reserver',
'record_id' => $this->_model->getId()]),
'Text' => $this->_('Réserver'),
'Image' => (Class_Template::current()
->getIco($this->_view,
'hold',
'library')),
'Title' => $this->_('Réserver le document %s',
$this->getMainTitle()),
'Popup' => true]);
$actions = $this->_getNiceAction($actions);
foreach((new Intonation_Library_UserPatcher)->getDefaultSelections() as $selection) {
$selection
......@@ -409,6 +398,74 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
}
protected function _getNiceAction($actions) {
if ($this->_model->isRessourceNumerique())
return [];
if ((new Class_Notice_Sso($this->_model))->isValid()) {
$actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['module' => 'opac',
'controller' => 'modules',
'action' => 'sso',
'id' => $this->_model->getId()],
null,
true),
'Text' => $this->_('Consulter en ligne'),
'Image' => (Class_Template::current()
->getIco($this->_view,
'play',
'utils')),
'Title' => $this->_('Consulter le document %s en ligne',
$this->getMainTitle())]);
return $actions;
}
if ( ! $items = $this->_model->getExemplaires())
return $actions;
if ( ! $first_item = reset($items))
return $actions;
if ($url = $first_item->getUrl()) {
$actions [] = new Intonation_Library_Link(['Url' => $url,
'Text' => $this->_('Description en ligne'),
'Image' => (Class_Template::current()
->getIco($this->_view,
'play',
'utils')),
'Title' => $this->_('Description de %s en ligne',
$this->getMainTitle())]);
return $actions;
}
if ($bundle = $first_item->getBundle()) {
$actions [] = new Intonation_Library_Link(['Url' => $this->_view->urlNotice($bundle),
'Text' => $this->_('Fait partie du lot %s',
$bundle->getTitrePrincipal()),
'Image' => (Class_Template::current()
->getIco($this->_view,
'list',
'utils')),
'Title' => $this->_('Le document %s fait partie du lot %s',
$bundle->getTitrePrincipal())]);
return $actions;
}
$actions [] = new Intonation_Library_Link(['Url' => $this->_view->url(['controller' => 'abonne',
'action' => 'reserver',
'record_id' => $this->_model->getId()]),
'Text' => $this->_('Réserver'),
'Image' => (Class_Template::current()
->getIco($this->_view,
'hold',
'library')),
'Title' => $this->_('Réserver le document %s',
$this->getMainTitle()),
'Popup' => true]);
return $actions;
}
protected function _moreActions() {
$actions = array_merge([$this->_addToSelectionAction()],
$this->_socialNetworksActions(),
......
......@@ -204,12 +204,12 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help
return $this->view->renderHorizontalList($elements, $content_callback);
if (Intonation_Library_Widget_Carousel_Definition::MULTIPLE_CAROUSEL_PLUS == $layout)
return $this->view->renderMultipleCarousel($elements, $content_callback, 5);
return $this->view->renderMultipleCarousel($elements, $content_callback);
if (Intonation_Library_Widget_Carousel_Definition::GRID == $layout)
return $this->view->renderWallGrid($elements, $content_callback);
return $this->view->renderMultipleCarousel($elements, $content_callback);
return $this->view->renderMultipleCarousel($elements, $content_callback, 3);
}
......
......@@ -43,6 +43,8 @@ class Intonation_Library_Widget_Image_Form extends ZendAfi_Form_Configuration_Wi
'placeholder' => $this->_('Accéder à %s')])
->addToSelectionGroup(['image',
'link']);
'image_alt',
'link',
'link_title' ]);
}
}
\ No newline at end of file
......@@ -29,6 +29,11 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas
$_menu;
public function getHtml() {
$this->titre = $this->_settings->getTitre();
}
public function getContent() {
$menu = $this->preferences['menu'];
list($this->_profile_id, $this->_menu_id) =
......@@ -92,7 +97,7 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas
['class' => 'navbar-light navbar-toggler collapsed',
'type' => 'button',
'data-toggle' => 'collapse',
'data-target' => '#navbar_' . $this->_menu_id]);
'data-target' => '#navbar_' . $this->id_module . '_' . $this->_menu_id]);
}
......@@ -129,7 +134,7 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas
return $this->_tag('div',