Commit 6425f312 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

dev #64573 wip on bootstrap

parent eb3a8904
Pipeline #6679 passed with stage
in 36 minutes and 34 seconds
- ticket #64573 : 55% Templates pour l'interface publique libraire bootstrap
\ No newline at end of file
......@@ -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);
}
......
......@@ -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
......@@ -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
......@@ -50,7 +50,10 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
public function getMainLink() {
return new Intonation_Library_Link(['Url' => $this->_model->getAbsoluteUrl(),
return new Intonation_Library_Link(['Url' => array_merge($this->_context_params,
['controller' => 'recherche',
'action' => 'viewnotice',
'id' => $this->_model->getId()]),
'Text' => $this->_('Voir le document'),
'Title' => $this->_('Voir le document "%s" de "%s" de type "%s"',
$this->getTitle(),
......@@ -65,7 +68,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
public function getDescription() {
return $this->_view->renderRecordBadges($this->_model)
return $this->getBadges()
. $this->_view->truncate($this->_model->getResume());
}
......@@ -90,10 +93,15 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
if (!$facet = Class_CodifAuteur::findWithFullName($author))
return null;
return new Intonation_Library_Link(['Url' => (new Class_Notice_FieldAuthor($facet))
->getUrlParams(),
$author_field = new Class_Notice_FieldAuthor($facet);
return new Intonation_Library_Link(['Url' => $author_field->getUrlForLink(),
'Text' => $this->getAuthorIco() . $author,
'Title' => $this->_('Voir tous les documents de l\'auteur principal "%s"',
$this->getAuthor())]);
'Title' => $author_field->getTitle()]);
}
public function getBadges() {
return $this->_view->renderRecordBadges($this->_model);
}
}
\ 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_View_Wrapper_Record_RichContent {
use Trait_Translator;
protected
$_view,
$_model,
$_sections,
$_navigation;
public function setView($view) {
$this->_view = $view;
return $this;
}
public function setModel($model) {
$this->_model = $model;
return $this;
}
public function getModel() {
return $this->_model;
}
public function getNavigation() {
if ($this->_navigation)
return $this->_navigation;
return $this->_navigation = (new Intonation_Library_View_Wrapper_Record_RichContent_Navigation)
->setModel($this->_model)
->setView($this->_view);
}
public function getActions() {
$html = [$this->getNavigation()->getPosition(),
($this->_view->display_modifier_vignette_link
? $this->_view->Admin_Button((new Class_Entity())
->setUrl($this->_view->url(['module' => 'admin',
'controller' => 'records',
'action' => 'thumbnail']))
->setText($this->_('Modifier'))
->setAttribs(['title' => $this->_('Modifier la vignette de la notice "%s"',
$this->_model->getTitrePrincipal()),
'data-popup' => 'true']))
: ''),
($this->_view->show_reset_thumbnail_link
? $this->_view->Admin_Button((new Class_Entity())
->setUrl($this->_view->url(['module' => 'admin',
'controller' => 'records',
'action' => 'reset-thumbnail']))
->setText($this->_('Générer'))
->setAttribs(['title' => $this->_('Supprimer et re-générer la vignette de la notice "%s"',
$this->_model->getTitrePrincipal())]))
: ''),
$this->_view->tag('div',
$this->_view->reseauxSociaux($this->_model),
['id' => 'reseaux-sociaux']),
(Class_ModeleFusion::canPrintRecordInProfile(Class_Profil::getCurrentProfil())
? $this->_view->tagAnchor(['controller' => 'recherche',
'action' => 'print'],
$this->_('Imprimer'),
['title' => $this->_('Imprimer "%s"', $this->_model->getTitrePrincipal()),
'target' => '_blank'])
: ''),
$this->_view->tagAnchor($this->_view->url_panier,
$this->_('Ajouter au panier'),
['class'=>'panier'.
($this->_model->isInPanier()
? ' dans_panier'
: ''),
'data-popup' => 'true',
'title' => $this->_('Ajouter "%s" dans un panier', $this->_model->getTitrePrincipal())]),
$this->_view->Notice_LienReserver($this->_model),
$this->_view->renderAjax('noticeajax', 'resources', ['id' => $this->_model->getId()])];
return implode($html);
}
public function getSections() {
if ($this->_sections)
return $this->_sections;
$instances =
[new Intonation_Library_View_Wrapper_Record_RichContent_Home,
new Intonation_Library_View_Wrapper_Record_RichContent_Summary,
new Intonation_Library_View_Wrapper_Record_RichContent_Details,
new Intonation_Library_View_Wrapper_Record_RichContent_Media,
new Intonation_Library_View_Wrapper_Record_RichContent_Reviews,
new Intonation_Library_View_Wrapper_Record_RichContent_Related,
new Intonation_Library_View_Wrapper_Record_RichContent_Author];
return $this->_sections = array_map(function($instance)
{
return $instance
->setModel($this->_model)
->setView($this->_view);
},
$instances);
}
}
<?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_View_Wrapper_Record_RichContent_Author extends Intonation_Library_View_Wrapper_Record_RichContent_Section {
protected $_ajax = true;
public function getTitle() {
return $this->_('Auteur principal : %s',
$this->_model->getAuteurPrincipal());
}
public function getContent() {
if ($this->_content)
return $this->_content;
return $this->_content = $this->_view->renderAjax('noticeajax', 'author');
}
public function getClass() {
return 'document_author';
}
public function getNavUrl() {
return ['controller' => 'record',
'action' => 'author'];
}
public function getNavIco() {
return 'author';