diff --git a/.gitmodules b/.gitmodules index a17826c40d12815d562853c5a940aa40a339ab71..2d99c647dae08b16a9fa1529b2bad661acd88e8a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,21 +1,21 @@ [submodule "tests_js/lib/qunit-phantomjs-runner"] path = tests_js/lib/qunit-phantomjs-runner - url = http://git.afi-sa.fr/afi/qunit-phantomjs-runner.git + url = https://git.afi-sa.net/afi/qunit-phantomjs-runner.git [submodule "library/storm"] path = library/storm - url = http://git.afi-sa.fr/afi/storm.git + url = https://git.afi-sa.net/afi/storm.git [submodule "library/Redmine"] path = library/Redmine - url = http://git.afi-sa.fr/afi/php-redmine-api.git + url = https://git.afi-sa.net/afi/php-redmine-api.git [submodule "library/iCal"] path = library/iCal - url = http://git.afi-sa.net/afi/iCal.git + url = https://git.afi-sa.net/afi/iCal.git [submodule "library/PhpParser"] path = library/PhpParser - url = http://git.afi-sa.net/afi/PHP-Parser.git + url = https://git.afi-sa.net/afi/PHP-Parser.git [submodule "library/matomo-php-tracker"] path = library/matomo-php-tracker - url = http://git.afi-sa.fr/afi/matomo-php-tracker.git + url = https://git.afi-sa.net/afi/matomo-php-tracker.git [submodule "library/phpseclib"] path = library/phpseclib url = https://git.afi-sa.net/afi/phpseclib.git diff --git a/application/modules/admin/controllers/WidgetController.php b/application/modules/admin/controllers/WidgetController.php index 16ce8049c49eeff49dfd97c04278d950f5591294..36cbc13bbe34c5a9eb667d78937029f68fc2801b 100644 --- a/application/modules/admin/controllers/WidgetController.php +++ b/application/modules/admin/controllers/WidgetController.php @@ -48,11 +48,10 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { public function addAction() { $this->view->titre = $this->_('Ajouter une boite'); - if (!$profil = Class_Profil::find($this->_getParam('id_profil'))) return $this->_redirectClose($this->_getReferer()); - if (($template_section = $this->_getParam('template')) + if (('' != ($template_section = $this->_getParam('template'))) || ($this->_request->isPost() && ('' != $this->_getParam('module_type')))) { return $this->_addNewWidget($profil, $template_section); } @@ -64,7 +63,7 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { protected function _addNewWidget($profil, $template_section) { - if ($template_section) { + if ('' != $template_section) { $template_no = $this->_getParam('template_no'); $template = $this->_readTemplates()['sections'][$template_section]['templates'][$template_no]; } @@ -84,6 +83,12 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { ? $template['configuration'] : []; + $preferences = array_merge(Class_Systeme_ModulesAccueil::getInstance() + ->getModuleByCode($type_module) + ->getDefaultValues(), + $preferences, + $this->_getPost()); + $new_id = $profil->createNewModuleAccueilId(); $profil->updateModuleConfigAccueil($new_id, @@ -102,10 +107,7 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { ->setProfileId($this->_getParam('id_profil')) ->setParent($this->_getParam('parent')) ->load() - ->setNewDatas(array_merge(Class_Systeme_ModulesAccueil::getInstance() - ->getModuleByCode($this->_getParam('module_type')) - ->getDefaultValues(), - $this->_request->getPost())); + ->setNewDatas($preferences); $edit_widget_url = Class_Url::assemble(['module' => 'admin', 'controller' => 'widget', @@ -213,8 +215,7 @@ class Admin_WidgetController extends ZendAfi_Controller_Action { protected function _readTemplates() { - $templates = file_get_contents(ROOT_PATH . 'public/opac/js/widget_templates/widget_templates.json'); - return json_decode($templates, true); + return Class_Template::current()->getWidgetTemplates(); } diff --git a/application/modules/admin/views/scripts/widget/add-from-template.phtml b/application/modules/admin/views/scripts/widget/add-from-template.phtml index 2014f2c98269725b4eb4594028a3a1e05a80b236..144151304decac57c735901f99cd91d121bc4138 100644 --- a/application/modules/admin/views/scripts/widget/add-from-template.phtml +++ b/application/modules/admin/views/scripts/widget/add-from-template.phtml @@ -1,3 +1,2 @@ <?php echo $this->renderWidgetTemplates($this->templates); -?> diff --git a/application/modules/opac/controllers/BibController.php b/application/modules/opac/controllers/BibController.php index f7fbbbc5831898316f0cfad8a9f4bcb193a77cb2..6524a6972fb057d6cdd507c357e1411516c1b44f 100644 --- a/application/modules/opac/controllers/BibController.php +++ b/application/modules/opac/controllers/BibController.php @@ -33,7 +33,7 @@ class BibController extends ZendAfi_Controller_Action { return $this->_helper->json($this->_getJsonLibraries()); if (!empty((new Class_Session_Libraries)->getIds())) - $this->_redirect('opac/bib?geo_zone=reset'); + $this->_redirect('opac/bib?geo_zone=reset'); $zones = Class_Zone::getLoader()->findAll(); $bibs = []; @@ -273,6 +273,31 @@ class BibController extends ZendAfi_Controller_Action { } + public function renderAllAction() { + $id_module = $this->_getParam('id_module'); + $module = Class_Profil::getCurrentProfil()->getModuleAccueilPreferences($id_module, 'LIBRARY'); + $module_library = new Class_Systeme_ModulesAccueil_Library(); + + $preferences = array_merge($module_library->getDefaultValues(), + $module); + $preferences['ID_MODULE'] = $id_module; + + $this->view->titre = $preferences['titre']; + + $this->view->content = $this->view->librariesLinkToAll($preferences); + + if ($this->_getParam('render') === 'ajax') { + $script_loader = Class_ScriptLoader::getInstance(); + $scripts = $script_loader + ->addAdminScript('onload_utils') + ->addJQueryReady('setupAnchorsTarget();') + ->html(); + + $this->_helper->HTMLAjaxResponse($scripts . $this->view->content); + } + } + + protected function _getSelectedFilters() { $filter_keys = (new Class_Systeme_ModulesAccueil_Library())->getStaticFiltersKeys(); return $this->_helper->selectedFilters($filter_keys); diff --git a/application/modules/opac/controllers/CmsController.php b/application/modules/opac/controllers/CmsController.php index 058197752e5ea0c147bdbbcca409a3fccd5b0634..9e6f5e59c23425d3ef16267a088b05b3cd0bf465 100644 --- a/application/modules/opac/controllers/CmsController.php +++ b/application/modules/opac/controllers/CmsController.php @@ -243,6 +243,24 @@ class CmsController extends ZendAfi_Controller_Action { } + public function renderAllAction() { + $this->_initCalendarAndPreferences(); + + if ($this->_getParam('render') === 'ajax') { + $content = $this->view->calendarLinkToAll($this->view->calendar, + $this->view->preferences); + + $script_loader = Class_ScriptLoader::getInstance(); + $scripts = $script_loader + ->addAdminScript('onload_utils') + ->addJQueryReady('setupAnchorsTarget();') + ->html(); + + $this->_helper->HTMLAjaxResponse($scripts . $content); + } + } + + protected function _initCalendarAndPreferences() { $id_module = $this->_getParam('id_module'); diff --git a/application/modules/opac/controllers/WidgetController.php b/application/modules/opac/controllers/WidgetController.php index 56b1f4af739147091ef79d20dd755969aff75814..d149358e0f1efa562f5a4cdc4909e7757e080056 100644 --- a/application/modules/opac/controllers/WidgetController.php +++ b/application/modules/opac/controllers/WidgetController.php @@ -40,4 +40,73 @@ class WidgetController extends ZendAfi_Controller_Action { return $this->_helper->iframe($callback); } + + + public function renderAllAction() { + if (!$id = $this->_getParam('widget_id')) + return $this->getResponse()->setHttpResponseCode(404); + + if (!$profile_id = $this->_getParam('profile_id')) + return $this->getResponse()->setHttpResponseCode(404); + + Class_Template::setCurrentFrom($profile_id); + + if (!$widget = ((new Class_Systeme_Widget_Widget) + ->setId($id) + ->setProfileId($profile_id) + ->load())) + return $this->getResponse()->setHttpResponseCode(404); + + $this->view->widget = $widget; + } + + + public function previewAction() { + session_write_close(); + $callback = function() { + + if (null === ($section = $this->_getParam('section', null))) + return ''; + + if (null === ($index = $this->_getParam('index', null))) + return ''; + + $profile_id = Class_Profil::getCurrentProfil()->getId(); + + Class_Template::setCurrentFrom($profile_id); + + $widget_templates = Class_Template::current()->getWidgetTemplates(); + + $template = $widget_templates['sections'][$section]['templates'][$index]; + + $type_module = isset($template) + ? $template['type'] + : ''; + + if (!$type_module) + return ''; + + if ('NOTIFY' == $type_module) { + (new ZendAfi_Controller_Action_Helper_FlashMessenger)->addNotification($this->_('1 nouvelle notification'), ['status' => 'success']); + ZendAfi_Controller_Action_Helper_FlashMessenger::reset(); + } + + $settings = isset($template) + ? $template['configuration'] + : []; + + $settings = array_merge(Class_Systeme_ModulesAccueil::getInstance() + ->getModuleByCode($type_module) + ->getDefaultValues(), + $settings); + + if ($widget = ((new Class_Systeme_Widget_Widget) + ->loadFromSettings(['type_module' => $type_module, + 'profile_id' => Class_Profil::getCurrentProfil()->getId(), + 'preferences' => $settings]))) + return Class_Template::current()->renderWidget($widget, $this->view); + }; + + return $this->_helper->iframe($callback); + } } \ No newline at end of file diff --git a/application/modules/opac/views/scripts/widget/render-all.phtml b/application/modules/opac/views/scripts/widget/render-all.phtml new file mode 100644 index 0000000000000000000000000000000000000000..b4452f37431e6d9e63730de4b279c4e701b53fc7 --- /dev/null +++ b/application/modules/opac/views/scripts/widget/render-all.phtml @@ -0,0 +1,2 @@ +<?php +echo $this->renderWidgetAll($this->widget); \ No newline at end of file diff --git a/library/Class/Systeme/Widget/Abstract.php b/library/Class/Systeme/Widget/Abstract.php index b9d868a9d3478e7bf23bf88f42672e3d1ee8c4ac..0393de4c93ebe066e742564c4b9873db8c0b93e2 100644 --- a/library/Class/Systeme/Widget/Abstract.php +++ b/library/Class/Systeme/Widget/Abstract.php @@ -42,6 +42,18 @@ abstract class Class_Systeme_Widget_Abstract extends Class_Entity { } + public function loadFromSettings($settings) { + return $this + ->setProfileId(Class_Profil::getCurrentProfil()->getId()) + ->setId('no') + ->init() + ->_transmute($settings) + ->setTitle($this->_getTitle()) + ->setForm($this->_getForm()) + ->setViewHelper($this->_getViewHelper()); + } + + public function init() { if(!$this->getProfileId()) return; diff --git a/library/Class/Template.php b/library/Class/Template.php index 68fa9b7b9990e2698bad1a1966bd26351479314d..56dad7c2dd62ecff33800e3807f494510fc3c665 100644 --- a/library/Class/Template.php +++ b/library/Class/Template.php @@ -454,4 +454,9 @@ class Class_Template { public function isLegacy() { return false; } + + + public function getWidgetTemplates() { + return ''; + } } \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/Accueil/Base.php b/library/ZendAfi/View/Helper/Accueil/Base.php index edc2820b0065acc28f828a7028753a049fc61f83..517378ee6fd78d52766d00c6365a83649abc7a0b 100644 --- a/library/ZendAfi/View/Helper/Accueil/Base.php +++ b/library/ZendAfi/View/Helper/Accueil/Base.php @@ -479,7 +479,7 @@ class ZendAfi_View_Helper_Accueil_Base extends ZendAfi_View_Helper_ModuleAbstrac $instance ->addOPACScript('renderFilters/ajaxifyFilters.js') - ->addJQueryReady('$("#boite_' . $this->getIdModule() . '").ajaxifyFilters('. $opts .');'); + ->addJQueryReady('$("#boite_' . $this->getIdModule() . ',main .ajaxable").ajaxifyFilters('. $opts .');'); $filter_settings->isDisplayModeList() ? $instance->addStyleSheet(Class_Url::baseUrl() . '/public/opac/js/renderFilters/list.css') diff --git a/library/ZendAfi/View/Helper/RenderWidgetTemplates.php b/library/ZendAfi/View/Helper/RenderWidgetTemplates.php index 9687f725f5423e51a0c463818c2e6e81fb09e89f..7232549bfe9ff95c5363a783a4b838f1fe9b8778 100644 --- a/library/ZendAfi/View/Helper/RenderWidgetTemplates.php +++ b/library/ZendAfi/View/Helper/RenderWidgetTemplates.php @@ -21,10 +21,11 @@ class ZendAfi_View_Helper_RenderWidgetTemplates extends ZendAfi_View_Helper_BaseHelper { + public function renderWidgetTemplates($templates) { Class_ScriptLoader::getInstance() ->addJQueryReady('var widget = $(".widget_templates");' - .'widget.accordion({heightStyle: "content"});' + .'widget.accordion({heightStyle: "content", collapsible: true, active: false});' .'widget.find("a").click(function() {widget.html("<div class=\'saving-process\'><p>' . $this->_('Ajout en cours') . str_replace('"', '\'', $this->view->tagLoadingImg()) . '</p></div>");});') ->addStylesheet(URL_JS . 'widget_templates/widget_templates.css'); @@ -35,6 +36,7 @@ class ZendAfi_View_Helper_RenderWidgetTemplates extends ZendAfi_View_Helper_Base ['class' => 'widget_templates']); } + public function renderSection($section_key, $section) { return $this->_tag('h3', @@ -70,6 +72,4 @@ class ZendAfi_View_Helper_RenderWidgetTemplates extends ZendAfi_View_Helper_Base $this->_tag('img', null, ['src' => URL_JS . 'widget_templates/' . $template['icon']]), ['href' => $action_url]); } - -} -?> \ No newline at end of file +} \ No newline at end of file diff --git a/library/startup.php b/library/startup.php index d34c9152e350d2e4774e0dfab786dc2e79539f26..bdc08b66e40b810d2b8543f0d5bc9d64b403e48e 100644 --- a/library/startup.php +++ b/library/startup.php @@ -83,7 +83,7 @@ class Bokeh_Engine { defineConstant('BOKEH_MAJOR_VERSION','8.0'); defineConstant('BOKEH_RELEASE_NUMBER', BOKEH_MAJOR_VERSION . '.32'); - defineConstant('BOKEH_REMOTE_FILES', 'http://git.afi-sa.fr/afi/opacce/'); + defineConstant('BOKEH_REMOTE_FILES', 'https://git.afi-sa.net/afi/opacce/'); defineConstant('ROOT_PATH', realpath(dirname(__FILE__).'/..').'/'); diff --git a/library/storm b/library/storm index 617a9a9d7502fe498442f9e45b7561d2579341e7..e999f53a9da4da9331fdb78f62a597afbffd453a 160000 --- a/library/storm +++ b/library/storm @@ -1 +1 @@ -Subproject commit 617a9a9d7502fe498442f9e45b7561d2579341e7 +Subproject commit e999f53a9da4da9331fdb78f62a597afbffd453a diff --git a/library/templates/Historic/Template.php b/library/templates/Historic/Template.php index 30b2d18724c6619f1ea5f08e48b649a80746be56..b96f0849c13fff41b51ae74f9105c0e4a5238d19 100644 --- a/library/templates/Historic/Template.php +++ b/library/templates/Historic/Template.php @@ -114,4 +114,10 @@ class Historic_Template extends Class_Template { public function isLegacy() { return true; } + + + public function getWidgetTemplates() { + $templates = file_get_contents(ROOT_PATH . 'public/opac/js/widget_templates/widget_templates.json'); + return json_decode($templates, true); + } } \ No newline at end of file diff --git a/library/templates/Intonation/Assets/css/intonation.css b/library/templates/Intonation/Assets/css/intonation.css index 9eb6520155f9396fcd26393fb221db628bd938eb..15222195c2496bdd53759bbf9a00e561218b6942 100644 --- a/library/templates/Intonation/Assets/css/intonation.css +++ b/library/templates/Intonation/Assets/css/intonation.css @@ -1,5 +1,3 @@ -/* Global */ - :root { --front-text: black; --front-text-white: white; @@ -18,7 +16,6 @@ --front-widget-background: #FFF; --front-navbar-background: #CCC; --front-background-overlay: rgba(0, 0 , 0 ,0.7); - --front-background-modale: rgba(0, 0 , 0 ,0.95); --front-background-youtube: #ff0000; --front-card-background: linear-gradient(to right, rgba(0,0,0,0), white, white); --front-card-footer-background: linear-gradient(rgba(255, 255, 255, 0), white); @@ -584,17 +581,6 @@ dl.row { overflow: hidden; } -.section_content_wrapper .ui-sortable-placeholder { - visibility: visible !important; - background-color: var(--front-background-modale); - height: 200px; -} - -.section_content_wrapper .ui-sortable { - height: 100%; - min-height: 50px; -} - .img-thumbnail { overflow: hidden; text-align: center; @@ -706,4 +692,8 @@ dl.row { -moz-column-count: 5; column-count: 5; } +} + +.navbar-nav.flex-column .dropdown-menu { + position: initial; } \ No newline at end of file diff --git a/library/templates/Intonation/Library/FormCustomizer/Abstract.php b/library/templates/Intonation/Library/FormCustomizer/Abstract.php index 8031e24e346a23b137e800cd10b1cbd5cd8c68aa..9d65774d5052d85229ae44b502d0b5703ae1d722 100644 --- a/library/templates/Intonation/Library/FormCustomizer/Abstract.php +++ b/library/templates/Intonation/Library/FormCustomizer/Abstract.php @@ -77,7 +77,7 @@ class Intonation_Library_FormCustomizer_Abstract { $this->_template->withNameSpace('expand_breakpoint'), ['label' => $this->_('Déplié à partir de la taille'), 'value' => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL, - 'order' => 1, + 'order' => 0, 'multiOptions' => [Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL => $this->_('très petite ( inférieur à 575px )'), Intonation_Library_Constants::RESPONSIVE_MODE_SMALL => $this->_('petite ( entre 575px et 767px )'), Intonation_Library_Constants::RESPONSIVE_MODE_MEDIUM => $this->_('moyenne ( entre 768px et 991px )'), diff --git a/library/templates/Intonation/Library/ProfilePatcher.php b/library/templates/Intonation/Library/ProfilePatcher.php index c91d1490015287df45663117cbae1b13550fddcf..942afbd23e0857f08d1103cd4558ece54c8b4335 100644 --- a/library/templates/Intonation/Library/ProfilePatcher.php +++ b/library/templates/Intonation/Library/ProfilePatcher.php @@ -43,6 +43,11 @@ class Intonation_Library_ProfilePatcher extends Class_Template_ProfilePatcher { protected function _upgradeProfile() { $this->_profile ->setCfgSiteParam('skin', '') + ->setCfgSiteParam('browser', 'opac') + ->setCfgSiteParam('parent_id', 'null') + ->setCfgSiteParam('header_js', '') + ->setCfgSiteParam('page_css', '') + ->setCfgSiteParam('header_css', '') ->setCfgSiteParam('nb_divisions', '3') ->setCfgSiteParam('largeur_division1', '10') ->setCfgSiteParam('largeur_division2', '10') @@ -141,7 +146,6 @@ class Intonation_Library_ProfilePatcher extends Class_Template_ProfilePatcher { Class_Profil::DIV_BANNIERE, ['titre' => 'logo', 'boite' => ['no_border', 'no_border_radius', 'no_shadow', 'no_background'], - 'image' => '/userfiles/bannieres/logo_header.png', 'link' => '', $this->_template->withNameSpace('width_xsmall') => 12, $this->_template->withNameSpace('width_medium') => 3, diff --git a/library/templates/Intonation/Library/Widget/Carousel/Agenda/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Agenda/Definition.php index 652eb49c2258cb4c44001f190af338abd6e4aaa2..725bca92659abab987e8d4e7c65c7c4c8b57d609 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Agenda/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Agenda/Definition.php @@ -33,20 +33,16 @@ class Intonation_Library_Widget_Carousel_Agenda_Definition extends Intonation_Li public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite agenda'); $this->_form = 'Intonation_Library_Widget_Carousel_Agenda_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Agenda_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'enabled_filters' => 'day;date;place', - 'event_filter' => 'none', - 'rendering' => static::CARD, - 'layout' => static::WALL, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => static::SORT_EVENT, - 'size' => 9]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'enabled_filters' => 'day;date;place', + 'event_filter' => 'none', + 'order' => static::SORT_EVENT]); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php b/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php index b092a12d18405c306ceb2e5d93a23ebce4f7b39d..19bc91d969678b58ad08c558b035b42dc1b76101 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Agenda/View.php @@ -84,6 +84,14 @@ class Intonation_Library_Widget_Carousel_Agenda_View extends Intonation_Library_ } + public function getLinkToAllContent() { + $this->view->titre = $this->_settings->getTitre(); + + $this->_initCalendar(); + return $this->view->calendarLinkToAll($this->_calendar, $this->_settings); + } + + protected function _emptyListMessage() { return $this->view->tag('p', $this->_('Aucun événement')); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Article/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Article/Definition.php index 616dd50e9f97030a5bb0c8fc276dac1c1a2c4251..a996c48063262d237380a6eab54e120703acec83 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Article/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Article/Definition.php @@ -37,16 +37,12 @@ class Intonation_Library_Widget_Carousel_Article_Definition extends Intonation_L public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite d\'articles'); $this->_form = 'Intonation_Library_Widget_Carousel_Article_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Article_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'rendering' => static::CARD_OVERLAY, - 'layout' => static::WALL, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => static::SORT_RANDOM, - 'size' => 9]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'order' => static::SORT_RANDOM]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.php index 292039295c8355087a94523ba28f4a58990b80d7..147c1e3e308b22df49a9ba4893cafed5b5bc3821 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Author/Definition.php @@ -29,20 +29,16 @@ class Intonation_Library_Widget_Carousel_Author_Definition extends Intonation_Li public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite auteurs'); $this->_form = 'Intonation_Library_Widget_Carousel_Author_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Author_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'layout' => static::WALL, - 'rendering' => static::CARD_OVERLAY, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => Class_Systeme_ModulesAccueil_Authors::SORT_RANDOM, - 'size' => 9, - 'id_panier' => '', - 'id_catalogue' => '', - 'with_thumbnail' => true, - 'authors_selection_mode' => Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_ALL]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'order' => Class_Systeme_ModulesAccueil_Authors::SORT_RANDOM, + 'id_panier' => '', + 'id_catalogue' => '', + 'with_thumbnail' => true, + 'authors_selection_mode' => Class_Systeme_ModulesAccueil_Authors::AUTHORS_SELECTION_MODE_ALL]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Author/View.php b/library/templates/Intonation/Library/Widget/Carousel/Author/View.php index f6efb523db6f50baad5962e3165580e3bdb15ebc..c0311c5d6717bfc5907796c887f5bde475a5a04b 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Author/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Author/View.php @@ -24,7 +24,7 @@ class Intonation_Library_Widget_Carousel_Author_View extends Intonation_Library_ protected function _findElements() { - return Class_CodifAuteur::filterByValidThumbnail(Class_CodifAuteur::findAllByPreferences($this->_settings->getPreferences())); + return Class_CodifAuteur::filterByValidThumbnail(Class_CodifAuteur::findAllByPreferences($this->_settings->toArray())); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Definition.php index cfb77f522b7063b6f06e2fd40919ea10af02b616..1503fda448e252ee64605a2332d7d3865301fd12 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Definition.php @@ -36,4 +36,17 @@ class Intonation_Library_Widget_Carousel_Definition extends Class_Systeme_Module CARD = 'card'; protected $_isPhone = false; + + + public function __construct() { + $this->_defaultValues = ['layout' => static::WALL, + 'rendering' => static::CARD_OVERLAY, + 'size' => 9, + 'rss' => false, + 'embeded_code' => false, + 'link_to_all' => false, + 'all_layout' => static::LISTING, + 'all_rendering' => static::HORIZONTAL_CARD + ]; + } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php index 52d111661dda9ddd2a0bf2588644d859267aab77..6410ffbd7fcf6f7ede9bd2c9d98d780dcce6629c 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Domain/Definition.php @@ -29,17 +29,13 @@ class Intonation_Library_Widget_Carousel_Domain_Definition extends Intonation_Li public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite domaines'); $this->_form = 'Intonation_Library_Widget_Carousel_Domain_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Domain_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'layout' => static::WALL, - 'rendering' => static::CARD_OVERLAY, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => Class_CriteresRecherche::SORT_PUBLICATION_DESC, - 'size' => 9, - 'root_domain_id' => '']; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'order' => Class_CriteresRecherche::SORT_PUBLICATION_DESC, + 'root_domain_id' => '']); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Form.php b/library/templates/Intonation/Library/Widget/Carousel/Form.php index 242a412f74e8c9ef3259e53ac8b2d067d29a679f..c0d4f06950a21c53932d76ce99e65d16c31d7255 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Form.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Form.php @@ -62,7 +62,20 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration 'rss', ['label' => $this->_('Proposer un fil RSS'), 'value' => 0]) + + ->addElement('select', + 'all_layout', + ['label' => $this->_('Disposition de la liste'), + 'multiOptions' => $this->getLayouts()]) + + ->addElement('select', + 'all_rendering', + ['label' => $this->_('Rendu d\'un document'), + 'multiOptions' => $this->getRenderings()]) ; + + Class_ScriptLoader::getInstance() + ->addJQueryReady('checkBoxToggleVisibilityForElement("#link_to_all", $("#all_order, #all_layout, #all_rendering").closest("tr"), true);'); } @@ -80,7 +93,9 @@ class Intonation_Library_Widget_Carousel_Form extends ZendAfi_Form_Configuration ->addToShareGroup(['rss', 'embeded_code', - 'link_to_all']); + 'link_to_all', + 'all_rendering', + 'all_layout']); return $this; } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Library/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Library/Definition.php index fd647714688eaa92fd31fa832721992627e7762f..a5ca1d9fac5d3300710e46ce8c01c371a3b3a2bb 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Library/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Library/Definition.php @@ -28,22 +28,18 @@ class Intonation_Library_Widget_Carousel_Library_Definition extends Intonation_L public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite des bibliothèques'); $this->_form = 'Intonation_Library_Widget_Carousel_Library_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Library_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'layout' => static::CAROUSEL, - 'rendering' => static::HORIZONTAL_CARD, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'osm_map' => 1, - 'osm_layer' => 1, - 'default_filters' => [], - 'filters' => '', - 'filters_display_modes' => Class_Systeme_ModulesAccueil_Library::DISPLAY_LIST, - 'filters_position' => Class_Systeme_ModulesAccueil_Library::POSITION_RIGHT, - 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA, - 'size' => 9]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'osm_map' => 1, + 'osm_layer' => 1, + 'default_filters' => [], + 'filters' => '', + 'filters_display_modes' => Class_Systeme_ModulesAccueil_Library::DISPLAY_LIST, + 'filters_position' => Class_Systeme_ModulesAccueil_Library::POSITION_RIGHT, + 'order' => Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Library/View.php b/library/templates/Intonation/Library/Widget/Carousel/Library/View.php index adae55b2d9d0d8ffa75ebf017dd1d37f7f650fd0..b267c8ab4a98a210f2483115526aacfb9bf645ba 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Library/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Library/View.php @@ -62,6 +62,12 @@ class Intonation_Library_Widget_Carousel_Library_View extends Intonation_Library protected function _getHTML() { - return $this->view->librariesWidget($this->preferences); + return $this->view->librariesWidget($this->_settings); + } + + + public function getLinkToAllContent() { + $this->view->titre = $this->_settings->getTitre(); + return $this->view->librariesLinkToAll($this->_settings); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Newsletter/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Newsletter/Definition.php index b9ea99dccea741b99d4556c4abed56e42781b19b..cb3df967994dea8e07e213cf78a55f260a1a2bba 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Newsletter/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Newsletter/Definition.php @@ -30,16 +30,12 @@ class Intonation_Library_Widget_Carousel_Newsletter_Definition extends Intonatio public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite lettres d\'informations'); $this->_form = 'Intonation_Library_Widget_Carousel_Newsletter_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Newsletter_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'layout' => static::WALL, - 'rendering' => static::CARD, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => static::SORT_TITLE_ASC, - 'size' => 9]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'order' => static::SORT_TITLE_ASC]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php index c16f78ce9fd65face58b6e70325f9323efe05957..7cf200bc3a117f95c6dd45af600ec6da5079e297 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Record/Definition.php @@ -28,16 +28,12 @@ class Intonation_Library_Widget_Carousel_Record_Definition extends Intonation_Li public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite de notices'); $this->_form = 'Intonation_Library_Widget_Carousel_Record_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_Record_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'layout' => static::WALL, - 'rendering' => static::CARD_OVERLAY, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => Class_CriteresRecherche::SORT_RANDOM, - 'size' => 9]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'order' => Class_CriteresRecherche::SORT_RANDOM]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/Record/View.php b/library/templates/Intonation/Library/Widget/Carousel/Record/View.php index 87dd001bdc3c668d38c4d09da69364f1a72e684f..3e611b75a09d990988a2fa4184fb8185242b3f0a 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Record/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Record/View.php @@ -98,7 +98,7 @@ class Intonation_Library_Widget_Carousel_Record_View extends Intonation_Library_ protected function _getLinkToAllTitle() { - return $this->_('Voir les documents de la boite "%s" dans le résultat de recherche', $this->titre); + return $this->_('Voir tous les documents de la liste %s', $this->titre); } diff --git a/library/templates/Intonation/Library/Widget/Carousel/Review/Definition.php b/library/templates/Intonation/Library/Widget/Carousel/Review/Definition.php index 50207368ad125b9d7ec315f3fc403897e29d24b7..e1e92d8377a7d038f303342f4ff1b3997717dd18 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/Review/Definition.php +++ b/library/templates/Intonation/Library/Widget/Carousel/Review/Definition.php @@ -36,16 +36,12 @@ class Intonation_Library_Widget_Carousel_Review_Definition extends Intonation_Li public function __construct() { + parent::__construct(); $this->_libelle = $this->_('Boite d\'avis'); $this->_form = 'Intonation_Library_Widget_Carousel_Review_Form'; $this->_view_helper = 'Intonation_Library_Widget_Carousel_ReviewsByRecord_View'; - $this->_defaultValues = ['titre' => $this->_libelle, - 'rendering' => static::CARD_OVERLAY, - 'layout' => static::WALL, - 'rss' => false, - 'embeded_code' => false, - 'link_to_all' => false, - 'order' => static::SORT_RANDOM, - 'size' => 9]; + $this->_defaultValues = array_merge($this->_defaultValues, + ['titre' => $this->_libelle, + 'order' => static::SORT_RANDOM]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Carousel/View.php b/library/templates/Intonation/Library/Widget/Carousel/View.php index f2daa854122b1a77006f98f15b9fa2e262491365..106ded36de674f0d0b27472d7b215d35f62955c7 100644 --- a/library/templates/Intonation/Library/Widget/Carousel/View.php +++ b/library/templates/Intonation/Library/Widget/Carousel/View.php @@ -113,21 +113,30 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help if (!$elements = $this->_findElements()) return $this->_emptyListMessage(); - $content_callback = $this->_getContentCallback(); + $content_callback = $this->_getContentCallback($this->_settings->getRendering()); $elements = array_slice($elements, 0, $this->_settings->getSize()); - $elements = array_map(function($element) - { - $wrapper = $this->_getWrapper(); - return (new $wrapper) - ->setView($this->view) - ->setModel($element) - ->setContextParams($this->_getLinkToAllParams()); - }, $elements); - $elements = new Storm_Collection($elements); + $elements = $this->_wrapElements($elements); + + return $this->_renderLayout($this->_settings->getLayout(), $elements, $content_callback); + } - $layout = $this->_settings->getLayout(); + + protected function _wrapElements($elements) { + return array_map(function($element) + { + $wrapper = $this->_getWrapper(); + return (new $wrapper) + ->setView($this->view) + ->setModel($element) + ->setContextParams($this->_getLinkToAllParams()); + }, $elements); + } + + + protected function _renderLayout($layout, $elements, $content_callback) { + $elements = new Storm_Collection($elements); if (Intonation_Library_Widget_Carousel_Definition::WALL == $layout) return $this->view->renderWall($elements, $content_callback); @@ -148,26 +157,26 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help } - protected function _getContentCallback() { - if ($this->_settings->getRendering() == Intonation_Library_Widget_Carousel_Definition::CARD_OVERLAY) + protected function _getContentCallback($rendering) { + if ($rendering == Intonation_Library_Widget_Carousel_Definition::CARD_OVERLAY) return function ($element) { return $this->view->cardifyWithOverlay($element); }; - if ($this->_settings->getRendering() == Intonation_Library_Widget_Carousel_Definition::CARD) + if ($rendering == Intonation_Library_Widget_Carousel_Definition::CARD) return function ($element) { return $this->view->cardify($element); }; - if ($this->_settings->getRendering() == Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION) + if ($rendering == Intonation_Library_Widget_Carousel_Definition::CARD_DESCRIPTION) return function ($element) { return $this->view->cardifyOnlyDescription($element); }; - if ($this->_settings->getRendering() == Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_CARD) + if ($rendering == Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_CARD) return function ($element) { return $this->view->cardifyHorizontal($element); @@ -178,7 +187,11 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help protected function _getLinkToAllUrl() { - return $this->view->url($this->_getLinkToAllParams(), null, true); + return $this->view->url(['module' => 'opac', + 'controller' => 'widget', + 'action' => 'render-all', + 'profile_id' => Class_Profil::getCurrentProfil()->getId(), + 'widget_id' => $this->getId()], null, true); } @@ -187,9 +200,25 @@ abstract class Intonation_Library_Widget_Carousel_View extends Zendafi_View_Help } + public function getLinkToAllContent() { + $this->view->titre = $this->_settings->getTitre(); + + if (!$elements = $this->_findElements()) + return $this->_emptyListMessage(); + + return $this->_renderLayout($this->_settings->getAllLayout(), + $this->_wrapElements($elements), + $this->_getContentCallback($this->_settings->getAllRendering())); + } + + + public function getHandleLinkToAll() { + return true; + } + + abstract protected function _findElements(); abstract protected function _getWrapper(); - abstract protected function _getLinkToAllParams(); abstract protected function _getLinkToAllTitle(); abstract protected function _getRSSUrl(); } \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Free/View.php b/library/templates/Intonation/Library/Widget/Free/View.php index ac27f2f909cbd8e50dd56113ee55f2524c0184e9..fb8c82dcf77cf0ffeb12ee310384cc34b56c6468 100644 --- a/library/templates/Intonation/Library/Widget/Free/View.php +++ b/library/templates/Intonation/Library/Widget/Free/View.php @@ -30,12 +30,8 @@ class Intonation_Library_Widget_Free_View extends Zendafi_View_Helper_Accueil_Ba protected function _getHTML() { - $id = isset($this->preferences['id_items']) - ? $this->preferences['id_items'] - : []; - - if (!$id) - return ''; + if (! isset($this->preferences['id_items'])) + $this->preferences ['size'] = 1; if (!$articles = Class_Article::getArticlesByPreferences($this->preferences)) return ''; diff --git a/library/templates/Intonation/Library/Widget/Image/View.php b/library/templates/Intonation/Library/Widget/Image/View.php index 3c2b39811b0d4fc292d0448b46fd0dda187a9978..eb9a30c8a64e0edb53774adf573eac3bf2276765 100644 --- a/library/templates/Intonation/Library/Widget/Image/View.php +++ b/library/templates/Intonation/Library/Widget/Image/View.php @@ -30,7 +30,15 @@ class Intonation_Library_Widget_Image_View extends Zendafi_View_Helper_Accueil_B protected function _getHTML() { - $img = ($image = $this->_settings->getImage()) + if (!$image = $this->_settings->getImage()) { + Class_FileManager::beOpenBar(); + $files = Class_FileManager::files(USERFILES . '/bannieres/'); + $files = array_filter($files, function($file) { return $file->isImage();}); + $file = reset($files); + $image = $file ? $file->getUrl() : ''; + } + + $img = $image ? $this->view->tagImg(Class_Url::absolute($image), ['class' => 'image_widget']) : ''; diff --git a/library/templates/Intonation/Library/Widget/Login/View.php b/library/templates/Intonation/Library/Widget/Login/View.php index d983a081dd60b6131a1ac28e75d697ba7ef1e8f3..b2a89fde274758888cdf09357d28205affbecae0 100644 --- a/library/templates/Intonation/Library/Widget/Login/View.php +++ b/library/templates/Intonation/Library/Widget/Login/View.php @@ -251,7 +251,7 @@ class IntonationLoginRenderInline extends IntonationLoginRenderAbstract { if ($disconection = $this->_settings->getLienDeconnection()) $links [] = $this->_view->button((new Class_Entity()) - ->setText() + ->setText($disconection) ->setAttribs(['class' => 'btn btn-sm btn-danger', 'title' => $this->_('Se déconnecter de la session %s', $user->getNomComplet())]) ->setUrl($this->_view->url(['controller'=>'auth', diff --git a/library/templates/Intonation/Library/Widget/Menu/Definition.php b/library/templates/Intonation/Library/Widget/Menu/Definition.php new file mode 100644 index 0000000000000000000000000000000000000000..dc8a4973cd859e98431626f0c1faa481000885a2 --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Menu/Definition.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright (c) 2012-2017, 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 Intonation_Library_Widget_Menu_Definition extends Class_Systeme_ModulesAccueil_Null { + + const + CODE = 'MENU', + LAYOUT_VERTICAL = 'vertical', + LAYOUT_HORIZONTAL = 'horizontal'; + + protected + $_group = Class_Systeme_ModulesAccueil::GROUP_SITE, + $_isPhone = false; + + public function __construct() { + $this->_libelle = $this->_('Boite menu'); + $this->_form = 'Intonation_Library_Widget_Menu_Form'; + $this->_view_helper = 'Intonation_Library_Widget_Menu_View'; + $this->_defaultValues = ['titre' => $this->_libelle, + 'menu' => '', + 'layout' => static::LAYOUT_HORIZONTAL, + 'logo' => '']; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Menu/Form.php b/library/templates/Intonation/Library/Widget/Menu/Form.php new file mode 100644 index 0000000000000000000000000000000000000000..491a95ca4d0acf3c39077ca107f183b524235fbe --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Menu/Form.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright (c) 2012-2017, 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 Intonation_Library_Widget_Menu_Form extends ZendAfi_Form_Configuration_Widget_Base { + public function init() { + parent::init(); + $this + ->addElement('select', + 'menu', + ['label' => $this->_('Menu utilisé'), + 'registerInArrayValidator' => false, + 'multiOptions' => (new Class_Systeme_ModulesAccueil_MenuVertical())->getMenus()]) + + ->addElement('select', + 'layout', + ['label' => $this->_('Disposition'), + 'multiOptions' => [Intonation_Library_Widget_Menu_Definition::LAYOUT_HORIZONTAL => $this->_('horizontale'), + Intonation_Library_Widget_Menu_Definition::LAYOUT_VERTICAL => $this->_('verticale')]]) + + ->addToSelectionGroup(['menu']) + ->addToDisplaySettingsGroup(['layout']); + + Class_Template::current()->customMenuForm($this); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Menu/View.php b/library/templates/Intonation/Library/Widget/Menu/View.php new file mode 100644 index 0000000000000000000000000000000000000000..95b7cd7692b0cb0584aacd5a2abf3b965256cd28 --- /dev/null +++ b/library/templates/Intonation/Library/Widget/Menu/View.php @@ -0,0 +1,41 @@ +<?php +/** + * Copyright (c) 2012-2017, 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 Intonation_Library_Widget_Menu_View extends Intonation_Library_Widget_Nav_View { + + + protected function _renderNav() { + return $this->_tag('div', + $this->_navbarHeader() + . $this->_navBarEntries(), + ['class' => implode(' ', + ['navbar', + $this->_addExpandBreakPoint()])]); + } + + + protected function _getLayout() { + return $this->_settings->getLayout() == Intonation_Library_Widget_Menu_Definition::LAYOUT_VERTICAL + ? 'flex-column' + : ''; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/Library/Widget/Nav/View.php b/library/templates/Intonation/Library/Widget/Nav/View.php index 0c71d03499dc1ae230bf3d3a588f9f3cc5503ab9..991a1b491b5fab18166b0ada0c7a4da15d032a9d 100644 --- a/library/templates/Intonation/Library/Widget/Nav/View.php +++ b/library/templates/Intonation/Library/Widget/Nav/View.php @@ -147,7 +147,7 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas $classes = $dropdown ? 'dropdown-menu' - : 'nav navbar-nav'; + : 'nav navbar-nav ' . $this->_getLayout(); return $this->_tag('ul', implode($html), @@ -155,6 +155,11 @@ class Intonation_Library_Widget_Nav_View extends Zendafi_View_Helper_Accueil_Bas } + protected function _getLayout() { + return ''; + } + + protected function _renderRow($id, $parent, $params = []) { $child = new Class_Systeme_Widget_Menu(); if(!$child diff --git a/library/templates/Intonation/Library/Widget/Notify/View.php b/library/templates/Intonation/Library/Widget/Notify/View.php index 71b89c838af703628b61dc3793321f948fd09314..19b82205828a977ed48148ce69e7246ccc10046f 100644 --- a/library/templates/Intonation/Library/Widget/Notify/View.php +++ b/library/templates/Intonation/Library/Widget/Notify/View.php @@ -48,8 +48,6 @@ $("#%1$s .alert").on("closed.bs.alert", function() { $("#%1$s").remove(); });', $this->_getBoxId())); - $alerts = $this->_getNotifications(); - $html = $alerts->injectInto([], function($html, $alert) { diff --git a/library/templates/Intonation/Library/Widget/Search/Definition.php b/library/templates/Intonation/Library/Widget/Search/Definition.php index a6a2d412f64d2b368b4edfc44116b4f333314ba9..5d71a9849807030edaf990dfb42061f361240dda 100644 --- a/library/templates/Intonation/Library/Widget/Search/Definition.php +++ b/library/templates/Intonation/Library/Widget/Search/Definition.php @@ -25,6 +25,10 @@ class Intonation_Library_Widget_Search_Definition extends Class_Systeme_ModulesA parent::__construct(); $this->_view_helper = 'Intonation_Library_Widget_Search_View'; $this->_defaultValues = array_merge($this->_defaultValues, - [Class_Template::current()->withNameSpace('FormStyle') => 'default']); + [Class_Template::current()->withNameSpace('FormStyle') => 'inline', + 'search_button' => $this->_('Rechercher'), + 'placeholder' => $this->_('Titre, auteur…'), + 'type_doc' => '' + ]); } } \ No newline at end of file diff --git a/library/templates/Intonation/Library/WidgetTemplates.php b/library/templates/Intonation/Library/WidgetTemplates.php new file mode 100644 index 0000000000000000000000000000000000000000..bdffc943c62768075533b682a75182384fb03387 --- /dev/null +++ b/library/templates/Intonation/Library/WidgetTemplates.php @@ -0,0 +1,208 @@ +<?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 Intonation_Library_WidgetTemplates { + + use Trait_Translator; + + + public function getTemplates() { + $sections = + [$this->_('Agenda') => ['CALENDAR' => ['carousel', + 'multiple_carousel', + 'list', + 'wall']], + + $this->_('Articles') => ['NEWS' => ['carousel', + 'multiple_carousel', + 'list', + 'horizontal_list', + 'wall']], + + $this->_('Auteurs') => ['AUTHORS' => ['carousel', + 'multiple_carousel', + 'horizontal_list', + 'wall']], + + $this->_('Avis') => ['CRITIQUES' => ['carousel', + 'multiple_carousel']], + + $this->_('Bibliothèques') => ['LIBRARY' => ['carousel', + 'multiple_carousel', + 'list']], + + $this->_('Connexion') => ['LOGIN' => ['' => ['title' => $this->_('Formulaire de connexion')]]], + + $this->_('Domaines') => ['DOMAIN_BROWSER' => ['carousel', + 'multiple_carousel', + 'list', + 'horizontal_list', + 'wall']], + + $this->_('Lettres d\'informations') => ['NEWSLETTERS' => ['carousel', + 'multiple_carousel', + 'list', + 'list_with_options']], + + $this->_('Navigation et menus') => ['ARIANE' => ['' => ['title' => $this->_('Fil d\'Ariane'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'MENU' => ['' => ['title' => $this->_('Menu'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'NAV' => ['' => ['title' => $this->_('Menu principal'), + Class_Template::current()->withNameSpace('show_header') => 0]]], + + $this->_('Notices') => ['KIOSQUE' => ['carousel', + 'multiple_carousel', + 'list', + 'horizontal_list', + 'wall']], + + $this->_('Site') => ['ACCESSIBILITY' => ['' => ['title' => $this->_('Accessibilité'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'FREE' => ['' => ['title' => $this->_('Contenu HTML'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'CREDITS' => ['' => ['title' => $this->_('Crédits'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'SCROLL' => ['' => ['title' => $this->_('Défiler vers le haut'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'IMAGE' => ['' => ['title' => $this->_('Image'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'LANGUE' => ['' => ['title' => $this->_('Langues'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'NOTIFY' => ['' => ['title' => $this->_('Notifications')]], + 'ADMIN_TOOLS' => ['' => ['title' => $this->_('Outils d\'administration'), + Class_Template::current()->withNameSpace('show_header') => 0]], + 'SHARE' => ['' => ['title' => $this->_('Partager la page'), + Class_Template::current()->withNameSpace('show_header') => 0]]], + + $this->_('Recherche') => ['RECH_SIMPLE' => ['' => ['title' => $this->_('Rechercher')]]] + ]; + + $sections_content = []; + foreach ($sections as $title => $settings) + $sections_content [] = ['title' => $title, + 'templates' => $this->_createTemplatesFrom($settings)]; + + return ['sections' => $sections_content]; + } + + + protected function _createTemplatesFrom($settings) { + $templates = []; + foreach ($settings as $type => $layouts) + $templates = $this->_createTemplateFor($type, $layouts, $templates); + + return $templates; + } + + + protected function _createTemplateFor($type, $layouts, $templates) { + foreach($layouts as $layout) + $templates = $this->_createWidgetFor($type, $layout, $templates); + + return $templates; + } + + + protected function _createWidgetFor($type, $layout, $templates) { + $title = ''; + $rendering = ''; + $size = 9; + + if (is_array($layout)) { + $title = $layout['title']; + + $boite = ((($type == 'NAV') + || ($type == 'MENU')) + ? $this->_getMenuDefaultStyles() + : $this->_getDefaultStyles()); + + unset($layout['title']); + $templates [] = ['title' => $title, + 'icon' => Class_Template::current()->getId() . '_' . $type . '.jpg', + 'type' => $type, + 'configuration' => array_merge($layout, + ['boite' => $boite])]; + return $templates; + } + + if ('wall' == $layout) { + $title = $this->_('Mur'); + $rendering = 'card-overlay'; + } + + if ('list' == $layout) { + $title = $this->_('Liste verticale'); + $rendering = 'card-horizontal'; + } + + if ('list_with_options' == $layout) { + $title = $this->_('Liste verticale à interactions'); + $rendering = 'card-horizontal'; + } + + if ('horizontal_list' == $layout) { + $title = $this->_('Liste horizontale'); + $rendering = 'card'; + $size = 5; + } + + if ('carousel' == $layout) { + $title = $this->_('Carousel à une colonnne'); + $rendering = 'card'; + } + + if ('multiple_carousel' == $layout) { + $title = $this->_('Carousel à plusieurs colonnes'); + $rendering = 'card'; + } + + $templates [] = ['title' => $title, + 'icon' => Class_Template::current()->getId() . '_' . $type . '_' . $layout . '.jpg', + 'type' => $type, + 'configuration' => ['rendering' => $rendering, + 'layout' => $layout, + 'size' => $size, + 'boite' => $this->_getDefaultStyles()]]; + + return $templates; + } + + + protected function _getDefaultStyles() { + return ['no_background', + 'no_border', + 'no_border_radius', + 'no_shadow', + 'men_in_black', + 'mb-3']; + } + + + protected function _getMenuDefaultStyles() { + return ['no_background', + 'no_border', + 'no_border_radius', + 'no_shadow', + 'black_and_white']; + } +} diff --git a/library/templates/Intonation/System/Abstract.php b/library/templates/Intonation/System/Abstract.php index 1ab28208b9a5f231829f04fc846fa78da8bfb1d1..ad0b51d0c265d5d91b0163a0e220495f49e78c4b 100644 --- a/library/templates/Intonation/System/Abstract.php +++ b/library/templates/Intonation/System/Abstract.php @@ -176,6 +176,7 @@ abstract class Intonation_System_Abstract { $controllers [] = 'recherche'; $controllers [] = 'record'; $controllers [] = 'author'; + $controllers [] = 'widget'; } if($this->isVisibleForUserController()) @@ -184,10 +185,13 @@ abstract class Intonation_System_Abstract { if($this->isVisibleForCmsController()) { $controllers [] = 'cms'; $controllers [] = 'bib'; + $controllers [] = 'widget'; } - if($this->isVisibleForBlogController()) + if($this->isVisibleForBlogController()) { $controllers [] = 'blog'; + $controllers [] = 'widget'; + } if($this->isVisibleForAuthController()) $controllers [] = 'auth'; diff --git a/library/templates/Intonation/Template.php b/library/templates/Intonation/Template.php index e51ca3dedee8a57756468ed8da20d8babacb6601..260bfb4f30052c4ffea2a55f9996f22a946a0188 100644 --- a/library/templates/Intonation/Template.php +++ b/library/templates/Intonation/Template.php @@ -161,7 +161,9 @@ class Intonation_Template extends Class_Template { Intonation_Library_Widget_Carousel_Domain_Definition::CODE => new Intonation_Library_Widget_Carousel_Domain_Definition, - Intonation_Library_Widget_Carousel_Newsletter_Definition::CODE => new Intonation_Library_Widget_Carousel_Newsletter_Definition + Intonation_Library_Widget_Carousel_Newsletter_Definition::CODE => new Intonation_Library_Widget_Carousel_Newsletter_Definition, + + Intonation_Library_Widget_Menu_Definition::CODE => new Intonation_Library_Widget_Menu_Definition ]; } @@ -331,4 +333,9 @@ class Intonation_Template extends Class_Template { return $this->_helper_cache = new Intonation_Library_FormCustomizer($this); } + + + public function getWidgetTemplates() { + return (new Intonation_Library_WidgetTemplates)->getTemplates(); + } } \ No newline at end of file diff --git a/library/templates/Intonation/View/Calendar/Table.php b/library/templates/Intonation/View/Calendar/Table.php new file mode 100644 index 0000000000000000000000000000000000000000..63316ce4d04ee75d445ebe407895f57eba4fa67f --- /dev/null +++ b/library/templates/Intonation/View/Calendar/Table.php @@ -0,0 +1,29 @@ +<?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 Intonation_View_Calendar_Table extends ZendAfi_View_Helper_Calendar_Table { + protected function buildUrl($url = []) { + $params = parent::buildUrl($url); + unset($params['action']); + return $params; + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/Calendar/TableFilter.php b/library/templates/Intonation/View/Calendar/TableFilter.php new file mode 100644 index 0000000000000000000000000000000000000000..be040b2dd060b3a85699ea2151a03022a50a2bad --- /dev/null +++ b/library/templates/Intonation/View/Calendar/TableFilter.php @@ -0,0 +1,27 @@ +<?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 Intonation_View_Calendar_TableFilter extends Intonation_View_Calendar_Table { + public function calendar_TableFilter($calendar) { + return parent::calendar_Table($calendar); + } +} \ No newline at end of file diff --git a/library/templates/Intonation/View/CalendarContent.php b/library/templates/Intonation/View/CalendarContent.php index 38c9c9e86c6fcf5bbc2546f877d2ac8c4c266dd9..4160c675b006602fd1f508ce78638bd0bae23af4 100644 --- a/library/templates/Intonation/View/CalendarContent.php +++ b/library/templates/Intonation/View/CalendarContent.php @@ -21,6 +21,7 @@ class Intonation_View_CalendarContent extends ZendAfi_View_Helper_CalendarContent { + public function calendarContent($calendar, $settings = []) { Class_ScriptLoader::getInstance()->addOPACScript('calendrier'); @@ -51,9 +52,14 @@ class Intonation_View_CalendarContent extends ZendAfi_View_Helper_CalendarConten ->setFilters($this->calendar->getEnabledFilters()) ->setSelectedFilters($this->calendar->getActiveFilters()) ->setModelLabel('Article') - ->setUrlParams($this->calendar->getBaseUrl()) + ->setUrlParams($this->_getBaseUrl()) ->setCalendar($this->calendar); return $this->view->filters_Render($filter_settings); } + + + protected function _getBaseUrl() { + return $this->calendar->getBaseUrl(); + } } diff --git a/library/templates/Intonation/View/CalendarLinkToAll.php b/library/templates/Intonation/View/CalendarLinkToAll.php new file mode 100644 index 0000000000000000000000000000000000000000..fbff5ab69e2656d6674bc3668183fcd1cf423d48 --- /dev/null +++ b/library/templates/Intonation/View/CalendarLinkToAll.php @@ -0,0 +1,46 @@ +<?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 Intonation_View_CalendarLinkToAll extends Intonation_View_CalendarContent { + public function calendarLinkToAll($calendar, $settings) { + $temp_settings = []; + if (is_array($settings)) { + foreach($settings as $key => $value) + $temp_settings[Storm_Inflector::camelize(Storm_Inflector::underscorize($key))] = $value; + + $settings = Class_Template::current()->getWidgetSettingsWrapper($temp_settings); + } + + $settings + ->setRendering($settings->getAllRendering()) + ->setLayout($settings->getAllLayout()) + ->setSize(100); + + return parent::calendarContent($calendar, $settings->toArray()); + } + + + protected function _getBaseUrl() { + return array_merge(parent::_getBaseUrl(), + ['action' => 'render-all']); + } +} diff --git a/library/templates/Intonation/View/FonctionsAdmin.php b/library/templates/Intonation/View/FonctionsAdmin.php index e2131c20eaeae40a9b19f3abbd50740aeddbfe7a..8474b2b21a0754662dd833f6782e73145f67225e 100644 --- a/library/templates/Intonation/View/FonctionsAdmin.php +++ b/library/templates/Intonation/View/FonctionsAdmin.php @@ -22,6 +22,9 @@ class Intonation_View_FonctionsAdmin extends ZendAfi_View_Helper_FonctionsAdmin { public function fonctionsAdmin($id_module = 0, $type_module = false, $division = null, $extended_actions = []) { + if (! Class_Users::isCurrentUserCanAccesBackend()) + return ''; + return parent::fonctionsAdmin($id_module, $type_module, $division, $extended_actions); } diff --git a/library/templates/Intonation/View/LibrariesLinkToAll.php b/library/templates/Intonation/View/LibrariesLinkToAll.php new file mode 100644 index 0000000000000000000000000000000000000000..15e4d9be10fc53ce06a79177bf83d2779d9b00f3 --- /dev/null +++ b/library/templates/Intonation/View/LibrariesLinkToAll.php @@ -0,0 +1,43 @@ +<?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 Intonation_View_LibrariesLinkToAll extends Intonation_View_LibrariesWidget { + public function librariesLinkToAll($settings) { + return parent::librariesWidget($settings); + } + + + public function _getBaseUrl() { + return array_merge(parent::_getBaseUrl(), + ['action' => 'render-all']); + } + + + protected function _renderLibraries() { + $this->_settings + ->setRendering($this->_settings->getAllRendering()) + ->setLayout($this->_settings->getAllLayout()) + ->setSize(100); + + return parent::_renderLibraries(); + } +} diff --git a/library/templates/Intonation/View/LibrariesWidget.php b/library/templates/Intonation/View/LibrariesWidget.php index c638117a4a64bcd2d88d943ff27502afd780d54c..cb9673baebd7e6cb8497dfcce28ac05e39283b4d 100644 --- a/library/templates/Intonation/View/LibrariesWidget.php +++ b/library/templates/Intonation/View/LibrariesWidget.php @@ -22,13 +22,22 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { - protected $_preferences, + protected + $_settings, $_libraries, $_filter_settings; - public function librariesWidget($preferences) { - $this->_preferences = $preferences; + public function librariesWidget($settings) { + $temp_settings = []; + if (is_array($settings)) { + foreach($settings as $key => $value) + $temp_settings[Storm_Inflector::camelize(Storm_Inflector::underscorize($key))] = $value; + + $settings = Class_Template::current()->getWidgetSettingsWrapper($temp_settings); + } + + $this->_settings = $settings; return $this->view->div(['class' => 'ajax_content'], $this->_renderFilters() @@ -38,8 +47,8 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { protected function _renderLibraries() { - return (new Intonation_Library_Widget_Carousel_Library_View($this->_preferences['id_module'], - $this->_preferences)) + return (new Intonation_Library_Widget_Carousel_Library_View($this->_settings->getIdModule(), + $this->_settings->toArray())) ->setView($this->view) ->setElements($this->_getlibraries()) ->renderScriptForFilters($this->_filter_settings) @@ -54,18 +63,14 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { Class_Systeme_ModulesAccueil_Library::FIELD_OPENING_HOURS, Class_Systeme_ModulesAccueil_Library::FIELD_ADDRESS]); - return (isset($this->_preferences['osm_map']) && $this->_preferences['osm_map']) + return ($this->_settings->getOsmMap()) ? $this->view->div(['id' => $id], $this->view->librariesMap($this->_getLibraries(), '#' . $id, ['fields' => $fields, 'linked' => 1, - 'osm_layer' => (isset($this->_preferences['osm_layer']) - ? $this->_preferences['osm_layer'] - : ''), - 'osm_geojson' => (isset($this->_preferences['osm_geojson']) - ? $this->_preferences['osm_geojson'] - : '')])) + 'osm_layer' => $this->_settings->getOsmLayer(), + 'osm_geojson' => $this->_settings->getOsmGeojson()])) : ''; } @@ -79,16 +84,13 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { protected function _findAllLibraries() { - if (!isset($this->_preferences['libraries'])) - return Class_Bib::findAllBy(['order' => 'libelle']); - - if (! $id_libraries = $this->_preferences['libraries']) + if (! $id_libraries = $this->_settings->getLibraries()) return Class_Bib::findAllBy(['order' => 'libelle']); if (! $id_libraries = array_filter(explode(';', $id_libraries))) return Class_Bib::findAllBy(['order' => 'libelle']); - $order = ($this->_preferences['order'] == Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA) + $order = ($this->_settings->getOrder() == Class_Systeme_ModulesAccueil_Library::ORDER_ALPHA) ? 'libelle' : 'FIELD (id_site, ' . implode($id_libraries, ',') . ')'; @@ -131,23 +133,24 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { protected function _renderFilters() { - if(!$this->_filters = array_filter(explode(';', $this->_preferences['filters']))) + if (!$filters = $this->_settings->getFilters()) + return ''; + + if(!$this->_filters = array_filter(explode(';', $filters))) return ''; $this->_filter_settings = new Class_FilterSettings(new Class_Systeme_ModulesAccueil_Library()); $this->_filter_settings ->setFilters($this->_filters) ->setSelectedFilters($this->_getSelectedFilters()) - ->setDefaultFilters(isset($this->_preferences['default_filters']) - ? $this->_preferences['default_filters'] - : []) + ->setDefaultFilters($this->_settings->getDefaultFilters()) ->setModelLabel('Bib') ->setUrlParams($this->_getBaseUrl()) - ->setFiltersDisplayMode($this->_preferences['filters_display_modes']) - ->setFiltersPosition($this->_preferences['filters_position']) - ->setIdModule($this->_preferences['id_module']); + ->setFiltersDisplayMode($this->_settings->getFiltersDisplayModes()) + ->setFiltersPosition($this->_settings->getFiltersPosition()) + ->setIdModule($this->_settings->getIdModule()); - if ($this->_preferences['osm_map']) + if ($this->_settings->getOsmMap()) $this->_filter_settings ->setOnLoadComplete('if (0 < $(widget).find(".leaflet_osm").length) widget.openStreetMap();'); @@ -164,8 +167,8 @@ class Intonation_View_LibrariesWidget extends ZendAfi_View_Helper_BaseHelper { return array_merge(['controller' => 'bib', 'action' => 'widget', - 'id_module' => $this->_preferences['id_module'], - 'id_division' => $this->_preferences['division']], + 'id_module' => $this->_settings->getIdModule(), + 'id_division' => $this->_settings->getDivision()], $filters); } diff --git a/library/templates/Intonation/View/RenderWidgetAll.php b/library/templates/Intonation/View/RenderWidgetAll.php new file mode 100644 index 0000000000000000000000000000000000000000..883f95d78e3997aea4f1e2b29395c07c7ddede86 --- /dev/null +++ b/library/templates/Intonation/View/RenderWidgetAll.php @@ -0,0 +1,40 @@ +<?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 Intonation_View_RenderWidgetAll extends ZendAfi_View_Helper_BaseHelper { + public function renderWidgetAll($widget) { + if (!$widget) + return ''; + + $view_helper = $widget->getViewHelper(); + $view_helper_instance = ZendAfi_View_Helper_Accueil_Base::getWidget($widget->getId(), + $widget->forForm(), + $this->view); + + $html = [$this->view->div(['class' => 'col-12'], + $this->view->tag('h1', $view_helper_instance->getTitre())), + $this->view->div(['class' => 'col-12 ajaxable'], + $view_helper_instance->getLinkToAllContent())]; + + return $this->view->grid(implode($html)); + } +} diff --git a/public/opac/css/core.css b/public/opac/css/core.css index 4fc6061baf6af42cbffd7c7388dff829e44408c9..332681779c38f76815be03043cdd2e8e40484153 100644 --- a/public/opac/css/core.css +++ b/public/opac/css/core.css @@ -1,109 +1,9 @@ -.liste_mur .notice_wrapper, -.domains.liste_mur > div > div { - display: inline-block; - vertical-align: top; - height: 150px; - width: 100px; - margin: 10px auto 0px auto; - border: 5px solid transparent; +:root { + --front-background-modale: rgba(0, 0 , 0 ,0.7); } -.domains.liste_mur > div { - clear: both; - text-align: center; -} - -.domains.liste_mur > div > div { - transition: all 0.3s ease-out; - overflow: hidden; -} - -.domains.liste_mur > div > div:hover { - transform:scale(1.2,1.2); - -ms-transform:scale(1.2,1.2); - -webkit-transform:scale(1.2,1.2); -} - -.domains .breadcrumb .separator { - clear:none; - margin: 10px 0; - padding: 0; - border: 0; - width: 60px; -} - -.domains .breadcrumb .separator:hover { - transform: none; - -ms-transform: none; - -webkit-transform: none; -} - -dl.article_info { - display:none; -} - -.article_full_separator { - width:100%; - clear:both; - margin-bottom:5px -} - -.separator { - width:100%; - clear:both; - height: 2px; -} - -.month_list a, -.month_list span { - display: table-cell; - text-align: center; -} - -div.clear { - clear: both; - height: 0px; -} - -.kiosque:hover .embedcode { - display: block; -} - -.embedcode { - float: left; - position: absolute; - display: none; -} - -.embedcode span.embed-code-to-copy { - white-space: normal; - width: 190px; - height: 100px; - display: block; - color: black; - margin: 0; -} - -.embedcode-button { - cursor: pointer; -} - -.embedcode > div { - padding: 5px; - width:200px; -} - -.embedcode:hover, -.embedcode:hover > * { - opacity: 1; -} - -[class^="col_"], -nav li, -nav, +li.nav-item, .widget, -.boite, -article, section_wrapper, header, main, @@ -113,25 +13,25 @@ section { position: relative; } -[class^="col_"] { - display: inline-block; - width: 50%; - vertical-align:top; +.section_content_wrapper .ui-sortable-placeholder { + visibility: visible !important; + background-color: var(--front-background-modale) !important; + height: 200px; } -.widget .slider_navigation article, -.widget .slider_navigation article .article_content, -.widget .slider_navigation .window, -.widget .slider_navigation .slider_navigation_controls, -.widget .slider_navigation .slider_button, -.widget .slider_navigation .preview_button { - float: none; + +.section_content_wrapper .ui-sortable-handle[style*="position: absolute"] { + background-color: var(--front-background-modale) !important; + max-height: 200px; + max-width: 400px; + overflow: hidden; +} + +.section_content_wrapper .ui-sortable-handle[style*="position: absolute"] > * { + opacity: 0.5; } -.widget .slider_navigation article, -.widget .slider_navigation article .article_content, -.widget .slider_navigation .window, -.widget .slider_navigation .slider_button, -.widget .slider_navigation .preview_button { - display: inline-block; -} \ No newline at end of file +.section_content_wrapper .ui-sortable { + height: 100%; + min-height: 50px; +} diff --git a/public/opac/js/widget_templates/INTONATION_ACCESSIBILITY.jpg b/public/opac/js/widget_templates/INTONATION_ACCESSIBILITY.jpg new file mode 100644 index 0000000000000000000000000000000000000000..62c3d20d13ea38ee8a0be7a0ef4b24b6de0cafe1 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_ACCESSIBILITY.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_ARIANE.jpg b/public/opac/js/widget_templates/INTONATION_ARIANE.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dfe1492cca4fea7a9826d6a058e61eb225324c26 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_ARIANE.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_AUTHORS_carousel.jpg b/public/opac/js/widget_templates/INTONATION_AUTHORS_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..97a53b23653bb76fba6261ed33cc6fbeaf061399 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_AUTHORS_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_AUTHORS_horizontal_list.jpg b/public/opac/js/widget_templates/INTONATION_AUTHORS_horizontal_list.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6d94fccde62bb06799d50bb0cc9bf0d67b0069ef Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_AUTHORS_horizontal_list.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_AUTHORS_multiple_carousel.jpg b/public/opac/js/widget_templates/INTONATION_AUTHORS_multiple_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f8539aa810afe9872369bdd2cc5e126a7d24c881 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_AUTHORS_multiple_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_AUTHORS_wall.jpg b/public/opac/js/widget_templates/INTONATION_AUTHORS_wall.jpg new file mode 100644 index 0000000000000000000000000000000000000000..113ca814c02fb40f1253ada37b8a82807f734741 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_AUTHORS_wall.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CALENDAR_carousel.jpg b/public/opac/js/widget_templates/INTONATION_CALENDAR_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bb1bfb9aedbbdadec7a1642c4e1851c1caaea5ab Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CALENDAR_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CALENDAR_list.jpg b/public/opac/js/widget_templates/INTONATION_CALENDAR_list.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5b29fa05ab80b07347e4581cc412abc87a2624ce Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CALENDAR_list.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CALENDAR_multiple_carousel.jpg b/public/opac/js/widget_templates/INTONATION_CALENDAR_multiple_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7fc49b788576711041e896a4c7eb94650edb485a Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CALENDAR_multiple_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CALENDAR_wall.jpg b/public/opac/js/widget_templates/INTONATION_CALENDAR_wall.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1b6fcbac39efefbd9b51a7aedbe59e520e5dfb6c Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CALENDAR_wall.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CREDITS.jpg b/public/opac/js/widget_templates/INTONATION_CREDITS.jpg new file mode 100644 index 0000000000000000000000000000000000000000..82b1be19c581bfad83b57ff68baafea3d1e26d03 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CREDITS.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CRITIQUES_carousel.jpg b/public/opac/js/widget_templates/INTONATION_CRITIQUES_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a2e9a4cdb3059aea9b60c0592af97d2da28896d8 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CRITIQUES_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_CRITIQUES_multiple_carousel.jpg b/public/opac/js/widget_templates/INTONATION_CRITIQUES_multiple_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c152b68b886cfbcaf4fe6ec486d6120297747249 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_CRITIQUES_multiple_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_IMAGE.jpg b/public/opac/js/widget_templates/INTONATION_IMAGE.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2840155c62aa1a61ea441831bcf3503c49d4d440 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_IMAGE.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_KIOSQUE_carousel.png b/public/opac/js/widget_templates/INTONATION_KIOSQUE_carousel.png new file mode 100644 index 0000000000000000000000000000000000000000..92223ace79ae708dfbdd43c65f93f5a2d6e347c9 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_KIOSQUE_carousel.png differ diff --git a/public/opac/js/widget_templates/INTONATION_KIOSQUE_horizontal_list.jpg b/public/opac/js/widget_templates/INTONATION_KIOSQUE_horizontal_list.jpg new file mode 100644 index 0000000000000000000000000000000000000000..14faef34276478aa43e348d0ba044055202d6dd4 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_KIOSQUE_horizontal_list.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_KIOSQUE_list.jpg b/public/opac/js/widget_templates/INTONATION_KIOSQUE_list.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6c4c81b4652e70024d09a67dec40a6b3191fdd7f Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_KIOSQUE_list.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_KIOSQUE_multiple_carousel.jpg b/public/opac/js/widget_templates/INTONATION_KIOSQUE_multiple_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bec9dc61325fcda28e88a41cbba94ba516c9482a Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_KIOSQUE_multiple_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_KIOSQUE_wall.jpg b/public/opac/js/widget_templates/INTONATION_KIOSQUE_wall.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b51c4e84315b639ed9c026c40c780635a76c0eb6 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_KIOSQUE_wall.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_LIBRARY_carousel.jpg b/public/opac/js/widget_templates/INTONATION_LIBRARY_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bcb3a5ac83efb852902295a02de25b6267fb4331 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_LIBRARY_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_LOGIN.jpg b/public/opac/js/widget_templates/INTONATION_LOGIN.jpg new file mode 100644 index 0000000000000000000000000000000000000000..02aca7d11c5122b0394f02d29de1d98f8059aa68 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_LOGIN.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NAV.jpg b/public/opac/js/widget_templates/INTONATION_NAV.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7eb85b16f3c0459cd18eb2fd1bd591fe84dc4629 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NAV.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NEWS_carousel.jpg b/public/opac/js/widget_templates/INTONATION_NEWS_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7bf85e7d87522fff3e48f483a1f3fca2cad0bffa Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NEWS_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NEWS_horizontal_list.jpg b/public/opac/js/widget_templates/INTONATION_NEWS_horizontal_list.jpg new file mode 100644 index 0000000000000000000000000000000000000000..bbdaa642ebf9e644a1f747fbec4a3c8db49b4454 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NEWS_horizontal_list.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NEWS_list.jpg b/public/opac/js/widget_templates/INTONATION_NEWS_list.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b49253b8039b1930ed4113c927b2024674a38f81 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NEWS_list.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NEWS_multiple_carousel.jpg b/public/opac/js/widget_templates/INTONATION_NEWS_multiple_carousel.jpg new file mode 100644 index 0000000000000000000000000000000000000000..782786cf4690c78336318a36763c8f326e6b77ee Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NEWS_multiple_carousel.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NEWS_wall.jpg b/public/opac/js/widget_templates/INTONATION_NEWS_wall.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3f699b8da7f26c05688a0b53c0c9dce849fd8219 Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NEWS_wall.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_NOTIFY.jpg b/public/opac/js/widget_templates/INTONATION_NOTIFY.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f1782fea68a5353802f8a516ebcb4b3569ba82ac Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_NOTIFY.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_RECH_SIMPLE.jpg b/public/opac/js/widget_templates/INTONATION_RECH_SIMPLE.jpg new file mode 100644 index 0000000000000000000000000000000000000000..947c3c5b17d0f208dd6d7dae88ca1cb856a5f4aa Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_RECH_SIMPLE.jpg differ diff --git a/public/opac/js/widget_templates/INTONATION_SCROLL.jpg b/public/opac/js/widget_templates/INTONATION_SCROLL.jpg new file mode 100644 index 0000000000000000000000000000000000000000..b9f770d5bacf2de485da30e6a2fa2121419ee3fb Binary files /dev/null and b/public/opac/js/widget_templates/INTONATION_SCROLL.jpg differ diff --git a/public/opac/js/widget_templates/widget_templates.css b/public/opac/js/widget_templates/widget_templates.css index ed2b344bbe3bac1604846a9f56cab4b59d95558a..dfc4aa555d24f5b0816d7e3b9c00d7d95fb402b4 100644 --- a/public/opac/js/widget_templates/widget_templates.css +++ b/public/opac/js/widget_templates/widget_templates.css @@ -17,11 +17,10 @@ .widget_templates a h4 { font-weight: normal; - text-transform: uppercase; margin: 0; - padding: 1em; + padding: 0.5em; border-radius: 5px 5px 0 0; - white-space: nowrap; + white-space: normal; color: var(--button); background-color: var(--button-background); } @@ -35,3 +34,9 @@ color: var(--button-highlight); background-color: var(--button-background-highlight); } + +.widget_templates h3.ui-accordion-header, +.widget_templates a h4 { + font-size: 13px; + text-transform: uppercase; +} \ No newline at end of file diff --git a/tests/library/ZendAfi/View/Helper/Accueil/LibraryTest.php b/tests/library/ZendAfi/View/Helper/Accueil/LibraryTest.php index d9972e11d634617f73df06825b171f2dc9c1f0c7..8777ecf621fa378f89a9f9816304e403ec6fcfab 100644 --- a/tests/library/ZendAfi/View/Helper/Accueil/LibraryTest.php +++ b/tests/library/ZendAfi/View/Helper/Accueil/LibraryTest.php @@ -363,7 +363,7 @@ class ZendAfi_View_Helper_Accueil_LibraryCustomFieldsDisplayTest /** @test */ public function jQueryReadyShouldContainsAjaxifyFilters() { $js = Class_ScriptLoader::getInstance()->javaScriptsHTML(); - $this->assertContains('$("#boite_2").ajaxifyFilters({onLoadComplete: function(widget){ if (0 < $(widget).find(".leaflet_osm").length) widget.openStreetMap(); }});', + $this->assertContains('$("#boite_2,main .ajaxable").ajaxifyFilters({onLoadComplete: function(widget){ if (0 < $(widget).find(".leaflet_osm").length) widget.openStreetMap(); }});});', $js); } } diff --git a/tests/scenarios/Templates/TemplatesTest.php b/tests/scenarios/Templates/TemplatesTest.php index 8880c23c748081870fde81de931a2557e51cc7f0..aaa35a60965dd176232a07aa16d677b1a08b1a72 100644 --- a/tests/scenarios/Templates/TemplatesTest.php +++ b/tests/scenarios/Templates/TemplatesTest.php @@ -226,6 +226,19 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { public function setUp() { parent::setUp(); + $disk = $this + ->mock() + ->whenCalled('filesAt') + ->answers([]) + + ->whenCalled('directoryAt') + ->answers(null) + + ->whenCalled('fileAt') + ->answers(null); + + Class_FileManager::setFileSystem($disk); + $nav = ['H' => ['libelle' => 'News', 'picto' => 'news.png', 'menus' => [['type_menu' => 'MENU', @@ -340,6 +353,10 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { '25' => ['division' => 4, 'type_module' => 'NEWSLETTERS', 'preferences' => ['layout' => Intonation_Library_Widget_Carousel_Definition::HORIZONTAL_LISTING]], + + '26' => ['division' => 2, + 'type_module' => 'MENU', + 'preferences' => ['layout' => Intonation_Library_Widget_Menu_Definition::LAYOUT_VERTICAL]], ], 'section' => [ '1' => ['boite' => ['ultra_light_widget']]] @@ -383,6 +400,12 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase { ->assertSave(); Class_Systeme_ModulesAccueil::reset(); } + + + public function tearDown() { + Class_FileManager::setFileSystem(null); + parent::tearDown(); + } } @@ -409,8 +432,8 @@ class TemplatesDispatchIntonationTest extends TemplatesIntonationTestCase { /** @test */ - public function profileCssUrlShouldBeLoaded() { - $this->assertXPath('//head/link[contains(@href, "profile_css.css")]'); + public function profileCssUrlShouldNotBeLoaded() { + $this->assertNotXPath('//head/link[contains(@href, "profile_css.css")]'); } @@ -1320,7 +1343,7 @@ class TemplatesSearchWidgetSettingsFormTest extends TemplatesIntonationTestCase /** @test */ public function configurationShouldContainsFormDisplayMode() { - $this->assertXPath('//form//input[@type="radio"][@name="IntonationFormStyle"][@value="default"][@checked]'); + $this->assertXPath('//form//input[@type="radio"][@name="IntonationFormStyle"][@value="inline"][@checked]'); } } @@ -1751,7 +1774,6 @@ class TemplateRecordsWidgetWithOptionsTest extends TemplatesIntonationTestCase { } - /** @test */ public function shouldContainsEmbededCode() { $this->assertXPathContentContains('//pre', '/widget/render/widget_id/17/profile_id/72'); @@ -1759,8 +1781,14 @@ class TemplateRecordsWidgetWithOptionsTest extends TemplatesIntonationTestCase { /** @test */ - public function shouldContainsShowRecordsInSearch() { - $this->assertXPath('//a[contains(@href, "/recherche/simple")][contains(@title, "Voir les documents")]'); + public function shouldContainsShowAllRecords() { + $this->assertXPath('//a[contains(@href, "/widget/render-all")][contains(@title, "Voir tous les documents de la liste")]'); + } + + + /** @test */ + public function shouldContainsLinkToAllWithHrefWidgetRenderAll() { + $this->assertXPath('//a[contains(@href, "/widget/render-all/profile_id/72/widget_id/17")][contains(@title, "Voir tous les documents")]'); } } @@ -1962,7 +1990,7 @@ class TemplatesDispatchNoticeAjaxResourcesTest extends TemplatesIntonationTestCa $this->fixture('Class_Bib', ['id' => 23, - 'id_lieu' => 9]); + 'id_lieu' => 9]); $this->fixture('Class_Lieu', ['id' => 9, @@ -2110,7 +2138,7 @@ class TemplatesReviewsWidgetTest extends TemplatesIntonationTestCase { ]); $this->dispatch('/opac/index/index/id_profil/72', true); - $this->assertXPathContentContains('//div', 'Le Roi'); + $this->assertXPathContentContains('//div[@id = "boite_19"]', 'Le Roi'); } } @@ -2984,6 +3012,7 @@ abstract class TemplatesIntonationAccountTestCase extends TemplatesIntonationTes class TemplatesIntonationDispatchAccountTest extends TemplatesIntonationAccountTestCase { public function setUp() { parent::setUp(); + Class_FileManager::setFileSystem(null); $this->dispatch('/opac/abonne/fiche/id_profil/72'); } @@ -3076,6 +3105,13 @@ class TemplatesIntonationDispatchAccountTest extends TemplatesIntonationAccountT class TemplatesDispatchIntonationChangeIconAccountTest extends TemplatesIntonationTestCase { + + public function setUp() { + parent::setUp(); + Class_FileManager::setFileSystem(null); + } + + /** @test */ public function currentImageReadBlackShouldBeSelected() { $this->dispatch('/opac/abonne/change-image/id_profil/72'); @@ -3405,7 +3441,7 @@ class TemplatesDispatchLibraryWidgetTest extends TemplatesIntonationTestCase { /** @test */ public function annecyLibraryShouldBePresent() { $this->dispatch('/opac/index/index/id_profil/72', true); - $this->assertXPath('//div', 'Annecy'); + $this->assertXPath('//div[@id = "boite_20"]', 'Annecy'); } @@ -3957,6 +3993,18 @@ class TemplatesDispatchDomainWidgetTest extends TemplatesIntonationTestCase { public function inputTitreTypeShouldBeText() { $this->assertXpath('//input[@name="titre"][@type="text"]'); } + + + /** @test */ + public function allLayoutShouldBePresent() { + $this->assertXpath('//select[@name="all_layout"]'); + } + + + /** @test */ + public function allRenderingShouldBePresent() { + $this->assertXpath('//select[@name="all_rendering"]'); + } } @@ -4006,7 +4054,7 @@ class TemplatesDispatchAdminWidgetEditActionTest extends TemplatesIntonationTest } - /** @test */ + /** @test */ public function abonneFicheContentShouldHaveUltraLightWidgetClass() { (new Class_Profil_Preferences())->setModulePref(Class_Profil::find(72), (new Class_Profil_ModuleDefinition('abonne', @@ -4125,7 +4173,7 @@ class TemplateSearchSavedSettingsTest extends TemplatesIntonationTestCase { public function setUp() { parent::setUp(); - $records = [$this->fixture('Class_Notice', + $records = [$this->fixture('Class_Notice', ['id' => 89]), $this->fixture('Class_Notice', ['id' => 99])]; @@ -4218,6 +4266,19 @@ class TemplateIntonationWithSkinTest extends TemplatesEnabledTestCase { public function setUp() { parent::setUp(); + $disk = $this + ->mock() + ->whenCalled('filesAt') + ->answers([]) + + ->whenCalled('directoryAt') + ->answers(null) + + ->whenCalled('fileAt') + ->answers(null); + + Class_FileManager::setFileSystem($disk); + $this->fixture('Class_AdminVar', ['id'=>'MENU_BOITE', 'valeur' => 1]); @@ -4256,6 +4317,12 @@ class TemplateIntonationWithSkinTest extends TemplatesEnabledTestCase { } + public function tearDown() { + Class_FileManager::setFileSystem(null); + parent::tearDown(); + } + + /** @test */ public function navShouldBePresent() { $this->assertXPath('//nav'); @@ -4270,7 +4337,7 @@ class TemplateIntonationWithSkinTest extends TemplatesEnabledTestCase { /** @test */ public function widgetImageShouldBePresent() { - $this->assertXPath('//div[contains(@class, "image")]//img[contains(@src, "/userfiles/bannieres/logo_header.png")]'); + $this->assertXPath('//div[contains(@class, "image")]'); } @@ -4350,4 +4417,184 @@ class TemplatesDispatchNewsletterWidgetTest extends TemplatesIntonationTestCase $this->dispatch('/admin/widget/edit-widget/id/25/id_profil/72', true); $this->assertXpath('//input[@name="titre"][@type="text"]'); } -} \ No newline at end of file +} + + + +class TemplatesDispatchWidgetAddWidgetTest extends TemplatesIntonationTestCase { + + /** @test */ + public function addWidgetShouldRenderFreeWidget() { + $this->dispatch('/admin/widget/add-from-template/id_profil/72'); + $this->assertXPathContentContains('//div', 'Contenu HTML'); + } + + + /** @test */ + public function addWidgetShouldDynamicImage() { + $this->dispatch('/admin/widget/add-from-template/id_profil/72'); + $this->assertXPath('//div//img[contains(@src, "/INTONATION_ADMIN_TOOLS.jpg")]'); + } + + + /** @test */ + public function addWidgetWithConfShouldRedirect() { + $this->dispatch('/admin/widget/add/after/20/division/2/id_profil/72/template/0/template_no/1'); + $this->assertRedirect(); + } +} + + + +class TemplatesDispatchMenuWidgetTest extends TemplatesIntonationTestCase { + + /** @test */ + public function menuWidgetShouldBePresent() { + $this->dispatch('/opac/index/index/id_profil/72', true); + $this->assertXPathContentContains('//div[contains(@class, "menu")]//div', 'Boite menu'); + } + + + /** @test */ + public function inputTitreTypeShouldBeText() { + $this->dispatch('/admin/widget/edit-widget/id/26/id_profil/72', true); + $this->assertXpath('//input[@name="titre"][@type="text"]'); + } +} + + + + +class TemplatesDispatchWidgetRenderAllTest extends TemplatesIntonationTestCase { + + protected $_storm_default_to_volatile = true; + + + public function setUp() { + parent::setUp(); + $vacances = $this + ->fixture('Class_Article', + ['id' => 78, + 'titre' => 'Les vacances', + 'contenu' => 'À la mer']); + + $this + ->onLoaderOfModel('Class_Article') + + ->whenCalled('getAllArticles') + ->answers([$vacances]) + + ->whenCalled('getArticlesByPreferences') + ->answers([$vacances]); + + $this->fixture('Class_Notice', + ['id' => 20090, + 'clef_oeuvre' => 'PSYKO', + ]); + + $this->fixture('Class_Notice', + ['id' => 456, + 'titre_principal' => 'Rahan']); + + $this->fixture('Class_AvisNotice', + ['id' => 4, + 'id_user' => 666, + 'id_notice' => 20090, + 'clef_oeuvre' => 'PSYKO', + 'note' => '4', + 'entete' => 'Le Roi', + 'avis' => 'Le Roi des cons sur son throne']); + + $this->fixture('Class_Bib', + ['id' => 1, + 'libelle' => 'Annecy']); + + $this->fixture('Class_Bib', + ['id' => 45, + 'libelle' => 'Cran']); + } + + + public function widgetAndXpaths() { + return [ + [99 , '//div'], // null + [3 , '//div'], // nav + [17, '//main//div[contains(@class, "card")]'], //record + [18, '//main//div[contains(@class, "card")]'], // articles + [19, '//main//div[contains(@class, "card")]'], // reviews + [20, '//main//div[contains(@class, "card")]'], // libraries + [21, '//main//div[contains(@class, "card")]'], // agenda + ]; + } + + + /** + * @dataProvider widgetAndXpaths + * @test */ + public function withWidgetShouldRenderExpectedDom($widget_id, $dom) { + $this->dispatch('/opac/widget/render-all/profile_id/72/widget_id/' . $widget_id); + $this->assertXPath($dom, $this->_response->getBody()); + } +} + + + +class TemplatesDispatchWidgetTemplateImageTest extends TemplatesIntonationTestCase { + + + public function widgetTemplates() { + return [[0, 0], + [0, 1], + [0, 2], + [0, 3], + [1, 0], + [1, 1], + [1, 2], + [1, 3], + [1, 4], + [2, 0], + [2, 1], + [2, 2], + [2, 3], + [3, 0], + [3, 1], + [4, 0], + [4, 1], + [4, 2], + [5, 0], + [6, 0], + [6, 1], + [6, 2], + [6, 3], + [6, 4], + [7, 0], + [8, 0], + [8, 1], + [8, 2], + [9, 0], + [9, 1], + [9, 2], + [9, 3], + [9, 4], + [10, 0], + [10, 1], + [10, 2], + [10, 3], + [10, 4], + [10, 5], + [10, 6], + [10, 7], + [10, 8], + [11, 0] + ]; + } + + + /** + * @dataProvider widgetTemplates + * @test */ + public function shouldRenderWidgetPreview($section, $index) { + $this->dispatch('/opac/widget/preview/section/' . $section . '/index/' . $index); + $this->assertXPath('//div[contains(@class, "widget")]'); + } +}