Commit 4f592bf2 authored by Ghislain Loas's avatar Ghislain Loas

wip on bootstrap

parent 7a4985c8
Pipeline #8098 passed with stage
in 34 minutes and 40 seconds
......@@ -268,6 +268,20 @@ class Class_Calendar {
}
public function getHumanDate() {
if ($this->day)
return Class_Date::getHumanDate($this->day, 'dd/MM/yyyy');
if ($day = $this->_getParam('day'))
return Class_Date::getHumanDate($day . '-01', 'MM/yyyy');
if ($date = $this->_getParam('date'))
return Class_Date::getHumanDate($date . '-01', 'MM/yyyy');
return '';
}
public function getMonth() {
return $this->month;
}
......@@ -306,12 +320,18 @@ class Class_Calendar {
public function isDisplayNoCalendar() {
return 0 == $this->preferences['display_calendar'];
return isset($this->preferences['display_calendar'])
? 0 == $this->preferences['display_calendar']
: true;
}
public function getActiveFilters() {
if (empty($filters = $this->getEnabledFilters()))
$available_filters = (new Class_Systeme_ModulesAccueil_Calendrier)->getAvailableFilters();
$filters = array_keys($available_filters);
if (empty($filters))
return [];
$active_filters = $this->getCustomFields();
......
......@@ -109,8 +109,10 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract {
/** @return array */
public static function getModules() {
if (null !== static::$_modules)
return static::$_modules = array_merge(static::$_modules,
Class_Template::current()->getWidgets());
return static::$_modules;
if ($widgets_templates = Class_Template::current()->getWidgets())
return static::$_modules = $widgets_templates;
$defaults = ['News',
'Critiques',
......@@ -147,9 +149,6 @@ class Class_Systeme_ModulesAccueil extends Class_Systeme_ModulesAbstract {
if (Class_Adminvar::isActivityEnabled())
static::$_modules[Class_Systeme_ModulesAccueil_Activities::CODE] = new Class_Systeme_ModulesAccueil_Activities;
static::$_modules = array_merge(static::$_modules,
Class_Template::current()->getWidgets());
return static::$_modules;
}
......
......@@ -60,8 +60,8 @@ class Class_Systeme_ModulesAccueil_Calendrier extends Class_Systeme_ModulesAccue
public function getAvailableFilters() {
$available_filters = ['date' => $this->_('Mois'),
'day' => $this->_('Date de début'),
$available_filters = ['day' => $this->_('Date'),
'date' => $this->_('Mois'),
'place' => $this->_('Lieu')];
$custom_fields = Class_CustomField_Model::getModel('Article')->getFields();
......
......@@ -116,6 +116,7 @@ class Class_Template {
$try_profile = $this->_findOrCreateTryProfileFrom($profile);
$try_profile->save();
Class_Profil::setCurrentProfil($try_profile);
$try_profile = $this->_patchProfile($try_profile);
$try_profile->save();
return $try_profile->getId();
......@@ -189,11 +190,26 @@ class Class_Template {
}
public function customProfileForm($form) {
return $this;
}
public function customProfilePageForm($form) {
return $this;
}
public function handleFooter() {
return false;
}
public function handleSideColumn() {
return true;
}
public function handleRecordView() {
return false;
}
......
......@@ -405,6 +405,7 @@ class ZendAfi_Form_Configuration_Profile extends ZendAfi_Form {
'admin_group',
['legend' => $this->_('Administration')])
;
Class_Template::current()->customProfileForm($this);
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -66,6 +66,7 @@ class ZendAfi_Form_Configuration_Profile_Page extends ZendAfi_Form {
'page_css'],
'display_group',
['legend' => $this->_('Affichage')]);
}
}
?>
\ No newline at end of file
Class_Template::current()->customProfilePageForm($this);
}
}
\ No newline at end of file
......@@ -22,8 +22,11 @@
class ZendAfi_Form_Decorator_ProfileComposition extends Zend_Form_Decorator_Abstract {
public function render($content) {
return $this->_element->getView()->profileComposition($this->_element->getName(),
$this->_element->getValue(),
$this->_element->getAttribs());
return
$this->_element
->getView()
->profileComposition($this->_element->getName(),
$this->_element->getValue(),
$this->_element->getAttribs());
}
}
\ No newline at end of file
......@@ -260,9 +260,11 @@ class ZendAfi_View_Helper_Accueil_Kiosque extends ZendAfi_View_Helper_Accueil_Ba
$url_options = array_merge(['controller' => 'recherche',
'action' => 'simple'],
$this->preferences);
$url_options['tri'] = ($this->preferences['tri'])
? $tris[$this->preferences['tri']]
: $tris[0];
unset($url_options['preferences']);
return $this->view->tagAnchor($this->view->url($url_options, null, true),
htmlentities($titre));
......
......@@ -29,4 +29,21 @@ class ZendAfi_View_Helper_Filters_Strategy_Calendar
return $this->view->calendar_TableFilter($calendar);
}
protected function _renderTitle() {
$title = parent::_renderTitle();
return ($day = $this->_getSelectedDay())
? $title . $this->_tag('span', ' : ' . $day)
: $title;
}
protected function _getSelectedDay() {
if (!$calendar = $this->_settings->getCalendar())
return '';
return $calendar->getHumanDate();
}
}
......@@ -108,7 +108,9 @@ class ZendAfi_View_Helper_ProfileComposition extends ZendAfi_View_Helper_BaseHel
protected function _getSideColumn() {
return $this->_getDivisionColumn(5, $this->_('Division flottante'));
return Class_Template::current()->handleSideColumn()
? $this->_getDivisionColumn(5, $this->_('Division flottante'))
: '';
}
......
......@@ -60,6 +60,16 @@ class Intonation_Library_FormCustomizer {
}
public function getProfileForm($form) {
return (new Intonation_Library_FormCustomizer_Profile($this->_template, $form))->getForm();
}
public function getProfilePageForm($form) {
return (new Intonation_Library_FormCustomizer_ProfilePage($this->_template, $form))->getForm();
}
protected function _getStrategyFor($form) {
$strategies = ['ZendAfi_Form_Configuration_Widget_Login' => 'FormStyle',
'ZendAfi_Form_Configuration_Widget_Search' => 'FormStyle'];
......
......@@ -38,7 +38,7 @@ class Intonation_Library_FormCustomizer_Abstract {
public function __construct($template, $form) {
$this->_template = $template;
$this->_form=$form;
$this->_form = $form;
}
......
<?php
/**
* Copyright (c) 2012-2018, 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_FormCustomizer_Profile extends Intonation_Library_FormCustomizer_Abstract {
public function getForm() {
$display_settings_group = $this->_form->getDisplayGroup('profil_display_settings');
$display_settings_group->clearElements();
$this->_form->removeDisplayGroup('profil_display_settings');
$banner_group = $this->_form->getDisplayGroup('banner_group');
$banner_group->clearElements();
$this->_form->removeDisplayGroup('banner_group');
return $this->_form;
}
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2018, 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_FormCustomizer_ProfilePage extends Intonation_Library_FormCustomizer_Abstract {
public function getForm() {
$display_settings_group = $this->_form->getDisplayGroup('display_group');
$display_settings_group->clearElements();
$this->_form->removeDisplayGroup('display_group');
return $this->_form;
}
}
\ No newline at end of file
......@@ -29,7 +29,6 @@ class Intonation_Library_FormCustomizer_Widget_FormStyle extends Intonation_Libr
'multiOptions' => ['default' => $this->_('Formulaire standard'),
'inline' => $this->_('Formulaire en ligne'),
'toggle' => $this->_('Formulaire à bascule')]]);
}
......
......@@ -41,9 +41,11 @@ class Intonation_Library_ProfilePatcher {
protected function _upgradeProfile() {
$this->_profile
->setSkin('');
$this->_profile
->setCfgSiteParam('skin', '')
->setCfgSiteParam('nb_divisions', '3')
->setCfgSiteParam('largeur_division1', '10')
->setCfgSiteParam('largeur_division2', '10')
->setCfgSiteParam('largeur_division3', '10')
->setCfgSiteParam('barre_nav_on', '')
->setCfgSiteParam('accessibilite_on', '')
->setCfgSiteParam('hauteur_banniere', '')
......
......@@ -28,7 +28,7 @@ class Intonation_Library_Widget_Accessibility_Definition extends Class_Systeme_M
FULL = 'full';
protected
$_group = Class_Systeme_ModulesAccueil::GROUP_SITE,
$_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE,
$_isPhone = false;
......
......@@ -24,7 +24,7 @@ class Intonation_Library_Widget_Carousel_Library_Definition extends Intonation_L
const CODE = 'LIBRARY';
protected $_group = Class_Systeme_ModulesAccueil::GROUP_SITE;
protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO;
public function __construct() {
......
......@@ -24,7 +24,7 @@ class Intonation_Library_Widget_Carousel_Record_Definition extends Intonation_Li
const CODE = 'KIOSQUE';
protected $_group = Class_Systeme_ModulesAccueil::GROUP_RECH;
protected $_group = Class_Systeme_ModulesAccueil::GROUP_INFO;
public function __construct() {
......
<?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_Language_Definition extends Class_Systeme_ModulesAccueil_Langue {
protected $_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE;
}
\ No newline at end of file
......@@ -21,6 +21,10 @@
class Intonation_Library_Widget_Login_Definition extends Class_Systeme_ModulesAccueil_Login {
protected
$_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE;
public function __construct() {
parent::__construct();
$this->_view_helper = 'Intonation_Library_Widget_Login_View';
......
......@@ -24,7 +24,7 @@ class Intonation_Library_Widget_Notify_Definition extends Class_Systeme_ModulesA
const CODE = 'NOTIFY';
protected
$_group = Class_Systeme_ModulesAccueil::GROUP_SITE,
$_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE,
$_isPhone = false;
......
......@@ -26,7 +26,7 @@ class Intonation_Library_Widget_Share_Definition extends Class_Systeme_ModulesAc
CODE = 'SHARE';
protected
$_group = Class_Systeme_ModulesAccueil::GROUP_SITE,
$_group = Class_Systeme_ModulesAccueil::GROUP_ABONNE,
$_isPhone = false;
......
......@@ -58,6 +58,11 @@ class Intonation_Template extends Class_Template {
}
public function handleSideColumn() {
return false;
}
public function handleRecordView() {
return true;
}
......@@ -120,16 +125,29 @@ class Intonation_Template extends Class_Template {
return $this->_widgets_cache =
[Intonation_Library_Widget_Nav_Definition::CODE => new Intonation_Library_Widget_Nav_Definition,
Intonation_Library_Widget_Breadcrumb_Definition::CODE => new Intonation_Library_Widget_Breadcrumb_Definition,
Intonation_Library_Widget_Notify_Definition::CODE => new Intonation_Library_Widget_Notify_Definition,
Intonation_Library_Widget_Login_Definition::CODE => new Intonation_Library_Widget_Login_Definition,
Intonation_Library_Widget_Search_Definition::CODE => new Intonation_Library_Widget_Search_Definition,
Intonation_Library_Widget_Accessibility_Definition::CODE => new Intonation_Library_Widget_Accessibility_Definition,
Intonation_Library_Widget_Share_Definition::CODE => new Intonation_Library_Widget_Share_Definition,
Intonation_Library_Widget_Image_Definition::CODE => new Intonation_Library_Widget_Image_Definition,
Intonation_Library_Widget_AdminTools_Definition::CODE => new Intonation_Library_Widget_AdminTools_Definition,
Intonation_Library_Widget_Credits_Definition::CODE => new Intonation_Library_Widget_Credits_Definition,
Intonation_Library_Widget_Scroll_Definition::CODE => new Intonation_Library_Widget_Scroll_Definition,
Intonation_Library_Widget_Language_Definition::CODE => new Intonation_Library_Widget_Language_Definition,
Intonation_Library_Widget_Carousel_Record_Definition::CODE => new Intonation_Library_Widget_Carousel_Record_Definition,
Intonation_Library_Widget_Carousel_Article_Definition::CODE => new Intonation_Library_Widget_Carousel_Article_Definition,
......@@ -137,7 +155,8 @@ class Intonation_Template extends Class_Template {
Intonation_Library_Widget_Carousel_Review_Definition::CODE => new Intonation_Library_Widget_Carousel_Review_Definition,
Intonation_Library_Widget_Carousel_Library_Definition::CODE => new Intonation_Library_Widget_Carousel_Library_Definition,
Intonation_Library_Widget_Carousel_Agenda_Definition::CODE => new Intonation_Library_Widget_Carousel_Agenda_Definition
Intonation_Library_Widget_Carousel_Agenda_Definition::CODE => new Intonation_Library_Widget_Carousel_Agenda_Definition,
];
}
......@@ -172,6 +191,18 @@ class Intonation_Template extends Class_Template {
}
public function customProfileForm($form) {
$helper = new Intonation_Library_FormCustomizer($this);
return $helper->getProfileForm($form);
}
public function customProfilePageForm($form) {
$helper = new Intonation_Library_FormCustomizer($this);
return $helper->getProfilePageForm($form);
}
public function getTagEditSection($id_section, $view) {
$section = (new Class_Systeme_Widget_Section)
->setId($id_section)
......
......@@ -37,4 +37,21 @@ class Intonation_View_CalendarContent extends ZendAfi_View_Helper_CalendarConten
return $this->view->div(['class' => 'calendar'], implode($html));
}
protected function renderFilters() {
$enabled_filters = (new Class_Systeme_ModulesAccueil_Calendrier)->getAvailableFilters();
$enabled_filters = array_keys($enabled_filters);
$filter_settings = new Class_FilterSettings(new Class_Systeme_ModulesAccueil_Calendrier());
$filter_settings
->setFilters($enabled_filters)
->setSelectedFilters($this->calendar->getActiveFilters())
->setModelLabel('Article')
->setUrlParams($this->calendar->getBaseUrl())
->setCalendar($this->calendar);
return $this->view->filters_Render($filter_settings);
}
}
......@@ -59,6 +59,12 @@
width: 66%;
}
.profile_composition .drag_drop_container > [data-division="4"]:first-child {
display: block;
margin: auto;
}
.profile_composition .drag_drop_container > [data-division="2"][data-divisions="3"] {
width: 50%;
}
......
......@@ -395,7 +395,7 @@ class WidgetControllerCalendarTest extends WidgetControllerDispatchWidgetConfigu
/** @test */
public function secondListShouldContainsStartDate() {
$this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[2]/ul/li[@data-value="day"]', 'Date de début');
$this->assertXPathContentContains('//div[@id="input_enabled_filters"]/div[2]/ul/li[@data-value="day"]', 'Date');
}
......
......@@ -25,6 +25,11 @@ abstract class TemplatesEnabledTestCase extends Admin_AbstractControllerTestCase
parent::setUp();
Class_AdminVar::set('TEMPLATING', 1);
}
public function tearDown() {
parent::tearDown();
Class_Systeme_ModulesAccueil::reset();
}
}
......@@ -258,14 +263,6 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase {
'type_module' => 'NOTIFY',
'preferences' => []],
'6' => ['division' => 6,
'type_module' => 'TAGS',
'preferences' => []],
'7' => ['division' => 5,
'type_module' => 'TAGS',
'preferences' => []],
'8' => ['division' => 1,
'type_module' => 'RECH_SIMPLE',
'preferences' => ['boite' => ['card'],
......@@ -366,6 +363,7 @@ abstract class TemplatesIntonationTestCase extends TemplatesEnabledTestCase {
->answers([]);
(new Intonation_Template)->tryOn($profile);
Class_Systeme_ModulesAccueil::reset();
}
}
......@@ -471,8 +469,8 @@ class TemplatesDispatchIntonationTest extends TemplatesIntonationTestCase {
/** @test */
public function asidesShouldHaveClassColMd3() {
$this->assertXPathCount('//aside[contains(@class, "col")]', 3);
public function shouldContainsTwoSideColumn() {
$this->assertXPathCount('//aside[contains(@class, "col")]', 2);
}
......@@ -529,6 +527,7 @@ class TemplatesDispatchEditMenuHTest extends TemplatesIntonationTestCase {
public function setUp() {
parent::setUp();
Class_Profil::setCurrentProfil(Class_Profil::find(2));
$this->dispatch('/admin/widget/edit-menu/id/H/id_profil/72', true);
}
......@@ -558,6 +557,7 @@ class TemplatesDispatchEditBreadcrumbWidgetTest extends TemplatesIntonationTestC
public function setUp() {
parent::setUp();
Class_Profil::setCurrentProfil(Class_Profil::find(2));
$this->dispatch('/admin/widget/edit-widget/id/4/id_profil/72', true);
}
......@@ -1459,6 +1459,7 @@ class TemplatesDispatchEditAccessibilityWidgetTest extends TemplatesIntonationTe
public function setUp() {
parent::setUp();
Class_Profil::setCurrentProfil(Class_Profil::find(2));
$this->dispatch('/admin/widget/edit-widget/id/11/id_profil/72', true);
}
......@@ -3548,7 +3549,88 @@ class TemplatesDispatchAgendaWidgetTest extends TemplatesIntonationTestCase {
/** @test */
public function cmsCalendarShouldRenderFilters() {
$this->dispatch('/opac/cms/calendar/id_profil/72/id/21', true);
$this->assertXPathContentContains('//div//a[contains(@href, "/cms/calendar/")]', 'Janvier');
$this->dispatch('/opac/cms/calendar/id_profil/72/id_module/21/render/ajax', true);
$this->assertXPathContentContains('//div[contains(@class, "filters")]//a[contains(@href, "/cms/calendar/")]',
'Janvier');
}
/** @test */
public function cmsCalendarShouldRenderSelectedDayInFilterTitle() {
$this->dispatch('/opac/cms/calendar/id_profil/72/id_module/21/day/2019-06-01/render/ajax', true);
$this->assertXPathContentContains('//div[contains(@class, "filters")]//button/span',
'01/06/2019');
}
/** @test */
public function cmsCalendarShouldRenderSelectedMonthInFilterTitle() {
$this->dispatch('/opac/cms/calendar/id_profil/72/id_module/21/day/2019-06/render/ajax', true);
$this->assertXPathContentContains('//div[contains(@class, "filters")]//button/span',
'06/2019');
}
}
class TemplatesDispatchEditProfileTest extends TemplatesIntonationTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/admin/profil/edit/id_profil/72');
}
/** @test */
public function formShouldNotContainsAffichage() {
$this->assertNotXPathContentContains('//form//fieldset/legend', 'Affichage');
}
/** @test */
public function formShouldNotContainsBanniere() {
$this->assertNotXPathContentContains('//form//fieldset/legend', 'Banniere');
}
/** @test */
public function formShouldNotContainsInputCSS() {
$this->assertNotXPath('//form//input[@name="header_css"]');
}
/** @test */
public function formShouldNotContainsCouleurTexteBandeau() {
$this->assertNotXPath('//form//input[@name="couleur_texte_bandeau"]');
}
}
class TemplatesDispatchProfilAccueilTest extends TemplatesIntonationTestCase {
public function setUp() {
parent::setUp();
$this->dispatch('/admin/profil/accueil/id_profil/72');
}
/** @test */
public function formShouldNotContainsAffichage() {
$this->assertNotXPathContentContains('//form//fieldset/legend', 'Affichage');
}
/** @test */
public function formShouldNotContainsDivisionFlottante() {
$this->assertNotXPathContentContains('//form//h5', 'Division flottante');
}
/** @test */
public function formShouldNotContainsInputCSS() {
$this->assertNotXPath('//form//input[@name="page_css"]');
}
/** @test */
public function formShouldContainsDataDivisions3() {
$this->assertXPath('//form//div[@data-divisions="3"]');
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment