Commit 81a5035c authored by Ghislain Loas's avatar Ghislain Loas
Browse files

Merge branch 'dev#64573_55_templates_pour_l_interface_publique_libraire_bootstrap' into 'master'

Dev#64573 55 templates pour l interface publique libraire bootstrap

See merge request !3073
parents 242057ab 6425f312
Pipeline #6702 passed with stage
in 34 minutes and 27 seconds
......@@ -529,12 +529,51 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
}
public function mediaAction() {
session_write_close();
$tracks = (new Intonation_Library_Tracks)
->setModel($this->notice)
->collection();
$pictures = (new Intonation_Library_Pictures)
->setModel($this->notice)
->collection();
$trailers = (new Intonation_Library_Trailers)
->setModel($this->notice)
->collection();
$html = [$this->view->renderTracks($tracks),
$this->view->renderPictures($pictures),
$this->view->renderTrailers($trailers)];
$html = array_filter($html);
if (!empty($html))
Class_ScriptLoader::getInstance()
->addJQueryReady("$('.document_media').removeClass('d-none'); $('.document_media').removeClass('disabled'); $('.document_media').removeClass('text-black-50'); ");
$html = array_map(function($content)
{
return $this->view->div(['class' => 'col-12 mb-3 p-0'],
$content);
},
$html);
$this->_sendResponseWithScripts($this->view->grid(implode($html)));
}
public function authorAction() {
session_write_close();
if (!$author = Class_CodifAuteur::findWithFullName($this->notice->getAuteurPrincipal()))
return $this->_sendResponse('');
Class_ScriptLoader::getInstance()
->addJQueryReady("$('.document_author').removeClass('d-none'); $('.document_author').removeClass('disabled'); $('.document_author').removeClass('text-black-50'); ");
$author_description = new Class_CodifAuteur_Description($author);
$this->_sendResponseWithScripts($this->view->renderAuthorDescription($author_description));
}
......
......@@ -322,9 +322,6 @@ class RechercheController extends ZendAfi_Controller_Action {
$template = Class_Template::current();
if ($template->handleRecordView())
return $this->view->notice = $notice;
Class_ScriptLoader::getInstance()->addRecordMeta($notice);
$this->_addInspectorGadget($notice);
......
......@@ -32,7 +32,7 @@ class RecordController extends ZendAfi_Controller_Action {
}
public function resumeAction() {}
public function summaryAction() {}
public function mediaAction() {}
......
<?php
echo $this->RenderRecord_Resume($this->record);
\ No newline at end of file
<?php
echo $this->RenderRecord_Summary($this->record);
......@@ -88,6 +88,8 @@ class Class_Notice_NavigationRecherche {
return $visitor->visitPosition($this->getCurrentNoticeIndex() +1, $this->getNombreNotices());
}
}
?>
\ No newline at end of file
public function hasCriteria() {
return !empty($this->_criteres_recherche->getCriteres());
}
}
\ No newline at end of file
......@@ -97,7 +97,7 @@ class Class_Systeme_Widget_Section extends Class_Systeme_Widget_Abstract {
->setSection($this)
->load();
return $widgets;
return array_filter($widgets);
}
......
......@@ -182,8 +182,28 @@ class Class_WebService_AllServices {
$args['api'] = self::SVC_API;
$args['action'] = $service;
return json_decode(self::httpGet($url_service, $args),
true);
$response = json_decode(self::httpGet($url_service, $args), true);
static::_addInspectorGadget($url_service, $args, $response);
return $response;
}
protected static function _addInspectorGadget($url, $args, $response) {
if (!$ig = Zend_Controller_Front::getInstance()
->getPlugin('ZendAfi_Controller_Plugin_InspectorGadget'))
return;
if(!$ig->isEnabled())
return;
$ig->addButton(new Class_Entity(['Label' => 'Serveur de cache',
'Content' => 'URL : ' . $url
. BR
. 'args : ' . implode(BR, $args)
. BR
. 'response : ' . implode(BR, $response)]));
}
......
......@@ -24,26 +24,37 @@ class ZendAfi_View_Helper_FormLabel extends Zend_View_Helper_FormElement
{
protected function displayFor($name, $id) {
if (strpos($name, '[]'))
if (false !== strpos($name, '[]'))
return '';
if (false !== strpos($name, 'note'))
return '';
return $this->view->escape($id);
}
public function formLabel($name, $value = null, array $attribs = [])
{
$params = $attribs;
unset($attribs['wrap']);
$info = $this->_getInfo($name, $value, $attribs);
if ($info['disable'])
return '';
$attribs = array_filter(
array_merge(['for' => $this->displayFor($name,
$info['id']),
'data-name' => $name],
$info['attribs']));
$value = ($info['escape']) ? $this->view->escape($info['value']) : $info['value'];
$xhtml = $this->view->tag('label',
$value,
array_merge(['for' => $this->displayFor($name,$info['id'])],
$info['attribs']));
$attribs);
return isset($params['wrap'])
? $this->view->tag($params['wrap']['tag'], $xhtml, $params['wrap']['attribs'])
......
......@@ -123,7 +123,6 @@ class ZendAfi_View_Helper_FormRadio extends ZendAfi_View_Helper_FormElement {
// done!
$xhtml .= implode($listsep, $list);
return $xhtml;
}
}
\ No newline at end of file
......@@ -307,7 +307,7 @@ textarea {
width: 100%;
}
label[for=note] ~ div {
label[data-name=note] ~ div {
display: flex;
flex-direction: row-reverse;
overflow: hidden;
......@@ -317,7 +317,7 @@ input[name="note"] {
display: none;
}
label[for=note] ~ div label.multi-element-label {
label[data-name=note] ~ div label.multi-element-label {
color: var(--orange);
display: inline-block;
flex: auto;
......@@ -328,28 +328,28 @@ label[for=note] ~ div label.multi-element-label {
transition: all .2s;
}
label[for=note] ~ div label.multi-element-label:hover {
label[data-name=note] ~ div label.multi-element-label:hover {
cursor: pointer;
color: var(--teal);
font-weight: 900;
}
label[for=note] ~ div label.multi-element-label:hover ~ label {
label[data-name=note] ~ div label.multi-element-label:hover ~ label {
font-weight: 900;
color: var(--teal);
}
label[for=note] ~ div label.multi-element-label:before {
label[data-name=note] ~ div label.multi-element-label:before {
content: '\f005';
font-family: "Font Awesome 5 Free";
}
label[for=note] ~ div label.multi-element-label.checked,
label[for=note] ~ div label.multi-element-label.checked ~ label {
label[data-name=note] ~ div label.multi-element-label.checked,
label[data-name=note] ~ div label.multi-element-label.checked ~ label {
font-weight: 900;
}
label[for=note] ~ div label.multi-element-label + br {
label[data-name=note] ~ div label.multi-element-label + br {
display: none;
}
......@@ -419,4 +419,13 @@ healer.col {
.selector_widget label {
white-space: nowrap;
}
.disabled {
cursor: default;
pointer-events: none;
}
.hidde_content {
display: none !important;
}
\ No newline at end of file
<?php
/**
* Copyright (c) 2012-2019, Agence Française Informatique (AFI). All rights reserved.
*
* BOKEH is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation.
*
* There are special exceptions to the terms and conditions of the AGPL as it
* is applied to this software (see README file).
*
* BOKEH is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with BOKEH; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
class Intonation_Library_Constants {
CONST
SECTION_DISPLAY_MODE_COL = 'col',
SECTION_DISPLAY_MODE_ROW = 'row',
WIDTH_AUTO = '',
RESPONSIVE_MODE_XSMALL = '',
RESPONSIVE_MODE_SMALL = 'sm',
RESPONSIVE_MODE_MEDIUM = 'md',
RESPONSIVE_MODE_LARGE = 'lg',
RESPONSIVE_MODE_XLARGE = 'xl',
RESPONSIVE_MODE_ALWAYS = 'always';
}
......@@ -74,14 +74,14 @@ class Intonation_Library_FormCustomizer_Abstract {
->addElement('select',
$this->_template->withNameSpace('expand_breakpoint'),
['label' => $this->_('Déplié à partir de la taille'),
'value' => Intonation_Template::RESPONSIVE_MODE_SMALL,
'value' => Intonation_Library_Constants::RESPONSIVE_MODE_SMALL,
'order' => 1,
'multiOptions' => [Intonation_Template::RESPONSIVE_MODE_XSMALL => $this->_('très petite ( inférieur à 575px )'),
Intonation_Template::RESPONSIVE_MODE_SMALL => $this->_('petite ( entre 575px et 767px )'),
Intonation_Template::RESPONSIVE_MODE_MEDIUM => $this->_('moyenne ( entre 768px et 991px )'),
Intonation_Template::RESPONSIVE_MODE_LARGE => $this->_('grande ( entre 991px et 1199px ) '),
Intonation_Template::RESPONSIVE_MODE_XLARGE => $this->_('très grande ( supérieur à 1200px )'),
Intonation_Template::RESPONSIVE_MODE_ALWAYS => $this->_('Jamais')]]);
'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 )'),
Intonation_Library_Constants::RESPONSIVE_MODE_LARGE => $this->_('grande ( entre 991px et 1199px ) '),
Intonation_Library_Constants::RESPONSIVE_MODE_XLARGE => $this->_('très grande ( supérieur à 1200px )'),
Intonation_Library_Constants::RESPONSIVE_MODE_ALWAYS => $this->_('Jamais')]]);
$this->_addToResponsiveGroup(['expand_breakpoint']);
return $this;
......@@ -104,101 +104,101 @@ class Intonation_Library_FormCustomizer_Abstract {
->addElement('select',
$this->_template->withNameSpace('hidden_mode'),
['label' => $this->_('Visible à partir de la taille'),
'value' => Intonation_Template::RESPONSIVE_MODE_XSMALL,
'multiOptions' => [Intonation_Template::RESPONSIVE_MODE_XSMALL => $this->_('très petite ( inférieur à 575px )'),
Intonation_Template::RESPONSIVE_MODE_SMALL => $this->_('petite ( entre 575px et 767px )'),
Intonation_Template::RESPONSIVE_MODE_MEDIUM => $this->_('moyenne ( entre 768px et 991px )'),
Intonation_Template::RESPONSIVE_MODE_LARGE => $this->_('grande ( entre 991px et 1199px ) '),
Intonation_Template::RESPONSIVE_MODE_XLARGE => $this->_('très grande ( supérieur à 1200px )')]])
'value' => Intonation_Library_Constants::RESPONSIVE_MODE_XSMALL,
'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 )'),
Intonation_Library_Constants::RESPONSIVE_MODE_LARGE => $this->_('grande ( entre 991px et 1199px ) '),
Intonation_Library_Constants::RESPONSIVE_MODE_XLARGE => $this->_('très grande ( supérieur à 1200px )')]])
->addElement('select',
$this->_template->withNameSpace('width_xsmall'),
['label' => $this->_('Largeur à partir de la taille très petite ( inférieur à 575px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('width_small'),
['label' => $this->_('Largeur à partir de la taille petite ( entre 575px et 767px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('width_medium'),
['label' => $this->_('Largeur à partir de la taille moyennne ( entre 768px et 991px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('width_large'),
['label' => $this->_('Largeur à partir de la taille grande ( entre 991px et 1199px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('width_xlarge'),
['label' => $this->_('Largeur à partir de la taille très grande ( supérieur à 1200px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('order_xsmall'),
['label' => $this->_('Ordre à partir de la taille très petite ( inférieur à 575px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('order_small'),
['label' => $this->_('Ordre à partir de la taille petite ( entre 575px et 767px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('order_medium'),
['label' => $this->_('Ordre à partir de la taille moyennne ( entre 768px et 991px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('order_large'),
['label' => $this->_('Ordre à partir de la taille grande ( entre 991px et 1199px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('order_xlarge'),
['label' => $this->_('Ordre à partir de la taille très grande ( supérieur à 1200px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getWidthsOptions()])
->addElement('select',
$this->_template->withNameSpace('offset_xsmall'),
['label' => $this->_('Décalage à droite à partir de la taille très petite ( inférieur à 575px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getOffsetOptions()])
->addElement('select',
$this->_template->withNameSpace('offset_small'),
['label' => $this->_('Décalage à droite à partir de la taille petite ( entre 575px et 767px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getOffsetOptions()])
->addElement('select',
$this->_template->withNameSpace('offset_medium'),
['label' => $this->_('Décalage à droite à partir de la taille moyennne ( entre 768px et 991px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getOffsetOptions()])
->addElement('select',
$this->_template->withNameSpace('offset_large'),
['label' => $this->_('Décalage à droite à partir de la taille grande ( entre 991px et 1199px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getOffsetOptions()])
->addElement('select',
$this->_template->withNameSpace('offset_xlarge'),
['label' => $this->_('Décalage à droite à partir de la taille très grande ( supérieur à 1200px )'),
'value' => Intonation_Template::WIDTH_AUTO,
'value' => Intonation_Library_Constants::WIDTH_AUTO,
'multiOptions' => $this->_getOffsetOptions()])
;
......@@ -341,9 +341,9 @@ class Intonation_Library_FormCustomizer_Abstract {
$this->_form->addElement('select',
$this->_template->withNameSpace('display_mode'),
['label' => $this->_('Affichage'),
'value' => Intonation_Template::SECTION_DISPLAY_MODE_COL,
'multiOptions' => [Intonation_Template::SECTION_DISPLAY_MODE_COL => $this->_('en colonne'),
Intonation_Template::SECTION_DISPLAY_MODE_ROW => $this->_('en ligne')]]);
'value' => Intonation_Library_Constants::SECTION_DISPLAY_MODE_COL,
'multiOptions' => [Intonation_Library_Constants::SECTION_DISPLAY_MODE_COL => $this->_('en colonne'),
Intonation_Library_Constants::SECTION_DISPLAY_MODE_ROW => $this->_('en ligne')]]);
return $this;
}
......
......@@ -130,7 +130,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'record' => 'class fas fa-home',
'related' => 'class fas fa-clone',
'description' => 'class fas fa-info',
'resume' => 'class fab fa-readme',
'summary' => 'class fab fa-readme',
'reviews' => 'class fas fa-comments',
'media' => 'class fas fa-images',
'date-edition' => 'class fas fa-file-signature'
......
<?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_Trailer extends Class_Entity {}
<?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_Trailers {
use Trait_Translator;
protected $_model;
public function setModel($model) {
$this->_model = $model;
return $this;
}
public function collection() {
return new Storm_Collection($this->trailers());
}
public function trailers() {
$args = ['titre' => $this->_model->getRecordTitle(),
'auteur' => $this->_model->getAuteurPrincipal(),
'clef_oeuvre' => $this->_model->getClefOeuvre(),
'type_doc' => $this->_model->getFamilleId()];
if ( !$data = Class_WebService_AllServices::runServiceAfi(6, $args))
return [];
if ( !isset($data['player']) || (!$html = $data['player']))
return [];
$source = isset($data['source']) ? $data['source'] : $this->_('source inconnue');
preg_match('/src="([^"]+)"/', $html, $match);
if ( !$url = $match[1])
return [];
return [(new Intonation_Library_Trailer(['Source' => $data['source'],
'Url' => $url]))];
}
}
......@@ -25,7 +25,9 @@ class Intonation_Library_View_Wrapper_Abstract {
protected
$_view,
$_model;
$_model,
$_context_params = [],
$_rich_content;
public function setView($view) {
......@@ -45,7 +47,24 @@ class Intonation_Library_View_Wrapper_Abstract {
}
public function setContextParams($params) {
$this->_context_params = $params;
return $this;
}
public function getSecondaryLink() {
return null;
}
public function setRichContent($collection) {
$this->_rich_content = $collection;
return $this;
}
public function getRichContent() {
return $this->_rich_content;
}
}
\ No newline at end of file