Commit 03a6385a authored by Ghislain Loas's avatar Ghislain Loas

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

on theme store

See merge request !3418
parents c3134f6f 4e1e27b8
Pipeline #9653 passed with stage
in 42 minutes and 3 seconds
......@@ -47,17 +47,17 @@ class Admin_TemplateController extends ZendAfi_Controller_Action {
public function tryAction() {
if(!$template = (new Class_Template_Loader)->find($this->_getParam('template'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le template'));
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le thème'));
return $this->_redirectToIndex();
}
if(!$profile = Class_Profil::find($this->_getParam('on'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le template'));
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le thème'));
return $this->_redirectToIndex();
}
if(!$id_profile = $template->tryOn($profile)) {
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le template'));
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le thème'));
return $this->_redirectToIndex();
}
......@@ -81,7 +81,7 @@ class Admin_TemplateController extends ZendAfi_Controller_Action {
public function applyAction() {
if(!$this->view->template = (new Class_Template_Loader)->find($this->_getParam('template'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le template'));
$this->_helper->notify($this->_('Une erreur c\'est produite. Vous ne pouvez pas tester le thème'));
return $this->_redirectToIndex();
}
......
......@@ -1512,6 +1512,14 @@ class AbonneController extends ZendAfi_Controller_Action {
return $this->_redirectClose($this->_getReferer());
}
if ($this->_user->canAccessBackend()) {
(new Class_User_Settings($this->_user))->setProfileImage($image->getPath());
$this->_user->save();
$this->_helper->notify($this->_('Votre image de profil a bien été modifiée.'));
return $this->_redirectClose($this->_getReferer());
}
$allowed_paths = explode(';', Class_AdminVar::getValueOrDefault('USER_PROFILE_IMAGES'));
$allowed_images = [];
......
......@@ -112,10 +112,6 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
$html = $this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display);
if (!empty($html))
Class_ScriptLoader::getInstance()
->addJQueryReady("$('.document_items').removeClass('d-none'); $('.document_items').removeClass('disabled'); $('.document_items').removeClass('text-black-50'); ");
$this->_sendResponseWithScripts($html);
}
......@@ -590,18 +586,9 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
$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)));
return empty($html)
? $this->_sendResponse('')
: $this->_sendResponseWithScripts($this->view->grid(implode($html)));
}
......@@ -611,9 +598,6 @@ class NoticeAjaxController extends ZendAfi_Controller_Action {
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->renderAuthor($author_description));
}
......
......@@ -410,10 +410,8 @@ class Class_AvisNotice extends Storm_Model_Abstract {
}
public function getLoginOrFullName() {
return ($user = $this->getUser())
? $user->getLoginOrFullName()
: '';
public function getNomAff() {
return $this->getAuthorName();
}
......
......@@ -1272,6 +1272,7 @@ class Class_Notice extends Storm_Model_Abstract {
->setId(substr($facet, 1))
->setLabel($label)
->setTitle($title)
->setFacetCode(substr($facet, 0, 1))
->setUrlParams(['controller' => 'recherche',
'action' => 'simple',
......
......@@ -42,8 +42,9 @@ class ZendAfi_Controller_Plugin_Printer_SearchResult
protected function _getManyPrinterConfig() {
$model_fusion = Class_ModeleFusion::getFusionForStrategyAndProfilOrDefault(Class_ModeleFusion::RECORDS_TEMPLATE,
Class_Profil::getCurrentProfil());
if (!$model_fusion = Class_ModeleFusion::getFusionForStrategyAndProfilOrDefault(Class_ModeleFusion::RECORDS_TEMPLATE,
Class_Profil::getCurrentProfil()))
return parent::_getPrinterConfig();
if (!$ids = (new Class_RecordSelection())->values())
$ids = $this->_helper->searchRecords()->fetchAllRecordsIds();
......
......@@ -26,13 +26,13 @@ class ZendAfi_Controller_Plugin_ResourceDefinition_Template extends ZendAfi_Cont
'model' => ['class' => 'Class_Template',
'name' => 'template'],
'messages' => ['successful_save' => $this->_('Template sauvegardée'),
'successful_add' => $this->_('Template ajoutée'),
'successful_delete' => $this->_('Template supprimée')],
'messages' => ['successful_save' => $this->_('Thème sauvegardée'),
'successful_add' => $this->_('Thème ajoutée'),
'successful_delete' => $this->_('Thème supprimée')],
'actions' => ['add' => ['title' => $this->_('Nouveau Template')],
'edit' => ['title' => $this->_('Paramétrer le template %s')],
'index' => ['title' => $this->_('Templates')]],
'actions' => ['add' => ['title' => $this->_('Nouveau thème')],
'edit' => ['title' => $this->_('Paramétrer le thème %s')],
'index' => ['title' => $this->_('Thèmes')]],
'form_class_name' => 'ZendAfi_Form_Configuration_Template'
];
......
......@@ -146,13 +146,13 @@ class ZendAfi_View_Helper_Admin_FrontNavEntries extends ZendAfi_View_Helper_Base
'template' => Class_Template::current()->getId()],
null,
true),
$this->_('Configuration du template') .
$this->_('Configuration du thème') .
$this->view->tagImg(Class_Admin_Skin::current()
->getIconUrl('icons',
'image_cache')),
[
'class' => 'menu_admin_front_anchor',
'title' => $this->_('Configurer le template ' . Class_Template::current()->getTitle()),
'title' => $this->_('Configurer le thème ' . Class_Template::current()->getTitle()),
'data-popup' => 'true']);
$actions [] = $this->view->tagAnchor($this->view->url(['module' => 'admin',
......
......@@ -142,8 +142,8 @@ class ZendAfi_View_Helper_TagCriteresRecherche extends ZendAfi_View_Helper_BaseH
}
public function htmlAppend($text,$attribs=[]) {
$this->_html .= $this->_tag('div', $text,$attribs );
public function htmlAppend($text, $attribs = []) {
$this->_html .= $this->_tag('div', $text, $attribs );
return $this;
}
......
......@@ -22,13 +22,15 @@
class ZendAfi_View_Helper_TagSelectRecord extends ZendAfi_View_Helper_BaseHelper {
public function tagSelectRecord($record) {
$checked = (new Class_RecordSelection())->includes($record);
$url = Class_url::relative(['module' => 'opac',
'controller' => 'records',
'action' => 'select-toggle',
'id' => $record->getId()]);
return $this->_renderCheckbox($record, $url, (new Class_RecordSelection())->includes($record));
}
protected function _renderCheckbox($record, $url, $checked) {
return $this->view->formCheckbox('select_record_' . $record->getId(),
$record->getId(),
['title' => $this->_('Sélectionner "%s" pour impression, export ou sauvegarde',
......@@ -53,6 +55,11 @@ class ZendAfi_View_Helper_TagSelectRecord extends ZendAfi_View_Helper_BaseHelper
.'})');
$record_count = (new Class_RecordSelection())->count();
return $this->_renderSelectionActions($criteria, $record_count);
}
protected function _renderSelectionActions($criteria, $record_count) {
return $this->_tag('div',
$this->_tag('a',
$this->_('Sélection : ')
......
......@@ -87,6 +87,7 @@ div:hover > .img_as_background {
}
i:first-child,
.widget.rech_simple .dropdown-menu i:first-child,
.card-link + .card-link,
.badge,
p > i {
......@@ -450,7 +451,7 @@ label[data-name=note] ~ div label.multi-element-label + br {
color: inherit;
}
.badge {
.badge.record_facets {
text-transform: lowercase;
}
......@@ -458,7 +459,7 @@ label[data-name=note] ~ div label.multi-element-label + br {
text-transform: capitalize;
}
::first-letter {
#site_web_wrapper ::first-letter {
text-transform: uppercase;
}
......@@ -492,7 +493,7 @@ header.col {
.card-img-top > .card-columns,
.img-thumbnail > .card-columns {
column-gap: 0.05rem;
column-gap: 2%;
column-count: 3;
}
......@@ -741,4 +742,28 @@ dl.row {
.description dd a + a {
display: block;
}
.search_extensions {
display: flex;
flex-direction: column;
}
form.form input[type="checkbox"] {
margin-left: 0;
}
input[id^="select_record"] {
position: unset;
margin-left: 0;
pointer-events: none;
cursor: pointer;
}
input[id^="select_record"] + * {
cursor: pointer;
}
.dropdown-menu select {
min-width: 1px;
}
\ No newline at end of file
(function ( $ ) {
$.fn.masonry = function () {
var html = $(this);
var all_items = initAllItems();
var masonry_events = ['load', 'resize'];
masonry_events.forEach( function(event) {
window.addEventListener(event, resizeAllMasonryItems);
});
var resizeMasonryItem = function(item) {
var grid = html.find('.masonry')[0];
......@@ -22,16 +16,6 @@
var resizeAllMasonryItems = function() {
if ( ! allItems.length)
allItems = initAllItems();
for(var i=0; i > allItems.length; i++){
resizeMasonryItem(allItems[i]);
}
}
function initAllItems() {
var items = $(html).find('.masonry-brick').each(function() {
imagesLoaded( $(this), function(instance) {
var item = instance.elements[0];
......@@ -39,5 +23,12 @@
} );
});
}
var masonry_events = ['load', 'resize'];
masonry_events.forEach( function(event) {
window.addEventListener(event, resizeAllMasonryItems);
});
resizeAllMasonryItems();
};
} (jQuery));
......@@ -31,7 +31,7 @@ class Intonation_Library_FormCustomizer_Widget_Default extends Intonation_Librar
->addElement('checkbox',
$this->_template->withNameSpace('show_content'),
['label' => $this->_('Décorer le contenu'),
['label' => $this->_('Encadrer le contenu'),
'value' => 1])
->addElement('checkbox',
......
......@@ -41,6 +41,8 @@ class Intonation_Library_ProfilePatcher extends Class_Template_ProfilePatcher {
protected function _upgradeProfile() {
Class_ModeleFusion::generateDefaults(new ZendAfi_Controller_Action_Helper_View);
$label = $this->_('Tags bibliothèque');
if ( ! Class_CustomField_Meta::findFirstBy(['label' => $label])) {
......
......@@ -33,12 +33,9 @@ class Intonation_Library_Record_DigitalResources {
public function render() {
if (!$content = $this->_getHtml())
return '';
Class_ScriptLoader::getInstance()
->addJQueryReady("$('.document_items').removeClass('d-none'); $('.document_items').removeClass('disabled'); $('.document_items').removeClass('text-black-50'); ");
return $content;
return ($content = $this->_getHtml())
? $content
: '';
}
......
......@@ -84,70 +84,4 @@ class Intonation_Library_Record_Items {
return $this->_findItems($ids);
}
public function renderExemplaires($notice_ids, $nb_notices_oeuvre, $display) {
$exemplaires = $this->_loadExemplaire(["id_notice" => $notice_ids]);
foreach($exemplaires as $exemplaire)
$exemplaire->updateAvailabilityAndLocationFromSIGB()
->save();
foreach(Class_Notice::findAllBy(['id_notice' => $notice_ids]) as $notice)
$notice->updateFacetsFromExemplaires()
->save();
$exemplaires = (new Class_CommSigb())->getDispoExemplaires($exemplaires);
$html = $this->view->Notice_Exemplaires($exemplaires, $nb_notices_oeuvre, $display);
if (!empty($html))
Class_ScriptLoader::getInstance()
->addJQueryReady("$('.document_items').removeClass('d-none'); $('.document_items').removeClass('disabled'); $('.document_items').removeClass('text-black-50'); ");
$this->_sendResponseWithScripts($html);
}
public function resourcesAction() {
return $this->notice->isRessourceNumerique()
? $this->_forward('resnumeriques')
: $this->_forward('exemplaires');
}
public function resnumeriquesAction() {
if ($viewer = (new Class_Notice_Numel($this->notice))->getViewer())
return $this->_sendResponseWithScripts($viewer->renderOn($this->view));
$html = $add_album_tag = '';
if (1 == Class_AdminVar::isBibNumEnabled()
&& Class_Users::isCurrentUserAdmin())
$add_album_tag = $this->view
->tagAnchor($this->view->url(['module' => 'admin',
'controller' => 'album',
'action' => 'link_album_to',
'id_notice' => $this->id_notice],
null, true),
$this->_('Créer un album'),
['class' => 'link_album',
'data-popup' => 'true']);
$html .= $this->view->renderAlbum($this->notice->getAlbum());
$html .= $this->view->recordAlbums($this->notice);
if ('' == $html)
$html = sprintf('<p>%s</p>', $this->view->_('Aucune ressource correspondante'));
$html = $add_album_tag . $html;
if (!empty($html))
Class_ScriptLoader::getInstance()
->addJQueryReady("$('.document_items').removeClass('d-none'); $('.document_items').removeClass('disabled'); $('.document_items').removeClass('text-black-50'); ");
$this->_sendResponseWithScripts($html);
}
}
......@@ -168,6 +168,7 @@ class Intonation_Library_Settings extends Intonation_System_Abstract {
'no-selection' => 'class far fa-heart',
'like' => 'class fas fa-heart text-danger',
'dislike' => 'class far fa-heart',
'suggest' => 'class fas fa-hand-holding-heart',
'subscription' => 'class fas fa-euro-sign',
'card-number' => 'class fas fa-barcode',
'read-document' => 'class far fa-arrow-alt-circle-right',
......
......@@ -55,7 +55,7 @@ class Intonation_Library_View_Wrapper_Article extends Intonation_Library_View_Wr
protected function _getMainLinkTitle() {
if ($author = $this->getSecondaryTitle())
return $this->_('Lire l\'article "%s" écrit par "%s"',
return $this->_('Lire l\'article %s écrit par %s',
$this->getMainTitle(),
$author);
......
<?php
/**
* Copyright (c) 2012-2018, Agence Française Informatique (AFI). All rights reserved.
* 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
......@@ -37,8 +37,7 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
'library')
. $this->_view->tag('span', $dispo, ['class' => 'align-middle d-inline text-left']),
['title' => $dispo,
'class' => ($this->_model->isDisponible(true)
['class' => ($this->_model->isDisponible(true)
? 'text-success'
: 'text-danger')]);
}
......@@ -75,18 +74,21 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
public function getSecondaryLink() {
$secondary_title = $this->getSecondaryTitle();
$striped_secondary_title = strtolower(strip_tags($secondary_title));
$title = ($hold_link = $this->_model->getHoldLink())
? $this->_('Réserver un exemplaire du document: %s', $this->_model->getTitrePrincipal())
: $this->_('Réservation non disponible, l\'exemplaire est %s.', strtolower(strip_tags($secondary_title)));
? $this->_('Réserver un exemplaire du document: %s, l\'exemplaire est %s',
$this->_model->getTitrePrincipal(),
$striped_secondary_title)
: $this->_('Réservation non disponible, l\'exemplaire est %s.', $striped_secondary_title);
$text = $hold_link
? $this->_('Réserver')
: $this->_('Non réservable');
? $this->_view->tag('span', $this->_('Réserver'), ['class' => 'align-middle'])
: $this->_view->tag('span', $this->_('Non réservable'), ['class' => 'align-middle text-black-50']);
return new Intonation_Library_Link(['Url' => $hold_link,
'Class' => $hold_link ? '' : 'text-black-50',
'Text' => $text,
'Text' => $secondary_title,
'TextHold' => $text,
'Title' => $title,
'Popup' => true]);
}
......@@ -164,10 +166,11 @@ class Intonation_Library_View_Wrapper_Item extends Intonation_Library_View_Wrapp
public function getActions() {
if (!$link = $this->getSecondaryLink())
return [];
return [$link->setImage($this->getSecondaryIco())];
$action = $this
->getSecondaryLink()
->setImage($this->getSecondaryIco());
$action->setText($action->getTextHold());
return [$action];
}
......
......@@ -42,7 +42,7 @@ class Intonation_Library_View_Wrapper_Library_RichContent_ProArticles extends In
public function getTitle() {
return $this->_('Les articles de %s', $this->getPro()->getLoginOrFullName());
return $this->_('Les articles de %s', $this->getPro()->getNomAff());
}
......
......@@ -37,7 +37,7 @@ class Intonation_Library_View_Wrapper_Library_RichContent_ProReviews extends Int
public function getTitle() {
return $this->_('Les avis de %s', $this->getPro()->getLoginOrFullName());
return $this->_('Les avis de %s', $this->getPro()->getNomAff());
}
......
......@@ -37,7 +37,7 @@ class Intonation_Library_View_Wrapper_Library_RichContent_SelectionsPro extends
public function getTitle() {
return $this->_('Les sélections de %s', $this->getPro()->getLoginOrFullName());
return $this->_('Les sélections de %s', $this->getPro()->getNomAff());
}
......
......@@ -34,17 +34,17 @@ class Intonation_Library_View_Wrapper_Library_RichContent_Team extends Intonatio
ZendAfi_Acl_AdminControllerRoles::ADMIN_PORTAIL];
$pros = ($pros = Class_Users::findAllBy(['id_site' => $this->_model->getId(),
'role_level' => $roles_level]))
'role_level' => $roles_level]))
? $pros
: Class_Users::findAllBy(['role_level' => $roles_level,
'order' => 'nom']);
$pros = array_map(function($pro)
{
return (new Intonation_Library_View_Wrapper_Pro)
->setModel($pro)
->setView($this->_view);
}, $pros);
{
return (new Intonation_Library_View_Wrapper_Pro)
->setModel($pro)
->setView($this->_view);
}, $pros);
$callback = function($wrapped) {
return $this->_view->cardify($wrapped);
......
......@@ -22,6 +22,10 @@
class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wrapper_Abstract {
protected
$_selectable_action = false,
$_allow_XSL = false;
public function getMainTitle() {
return $this->_model->getTitrePrincipal(' ') . $this->_model->getSubtitle();
}
......@@ -81,10 +85,11 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$xsl = (new Class_Notice_Xsl($this->_model, Class_Profil::getCurrentProfil()))
->beSearchResult();
return $xsl->isEnabled()
$description = $xsl->isEnabled() && $this->getAllowXSL()
? $this->_view->Notice_Xsl($xsl)
: ($this->getBadges()
. $this->_view->truncate($this->_model->getResume()));
: $this->_view->truncate($this->_model->getResume());
return $this->getBadges() . $description;
}
......@@ -127,7 +132,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$badges = [
((new Intonation_Library_Badge)
->setTag('a')
->setClass('warning fs_1em')
->setClass('warning fs_1em record_doctype')
->setUrl($this->_view->url(['controller' => 'recherche',
'action' => 'simple',
'facette' => Class_CodifTypeDoc::CODE_FACETTE. $this->_model->getTypeDoc(),
......@@ -145,7 +150,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$badges [] = ((new Intonation_Library_Badge)
->setTag('a')
->setClass('dark')
->setClass('dark record_edition_year')
->setUrl($this->_view->url(['controller' => 'recherche',
'action' => 'simple',
'annee_debut' => $this->_model->getAnnee(),
......@@ -164,7 +169,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
if ($count = $this->_model->numberOfAvisBibliothecaire()) {
$badges [] = ((new Intonation_Library_Badge)
->setTag('span')
->setClass('success')
->setClass('success record_pro_reviews_count')
->setText($this->_('%d avis pro.',
$count))
->setTitle($this->_('Nombre d\'avis des professionnels sur le document "%s".',
......@@ -172,7 +177,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$badges [] = ((new Intonation_Library_Badge)
->setTag('span')
->setClass('success')
->setClass('success record_pro_reviews_average_score')
->setText($this->_view->rating($this->_model->getNoteMoyenneAvisBibliothecaires()))
->setTitle($this->_('Note moyenne des avis des professionnels sur le document "%s".',
$this->_model->getTitrePrincipal(' '))));
......@@ -181,22 +186,23 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
if ($count = $this->_model->numberOfAvisAbonne()) {
$badges [] = ((new Intonation_Library_Badge)
->setTag('span')
->setClass('info')
->setClass('info record_borrower_review_count')
->setText($this->_('%d avis abonné',
$count))
->setTitle($this->_('Nombre d\'avis des abonnés sur le document "%s".', $this->_model->getTitrePrincipal(' '))));
$badges [] = ((new Intonation_Library_Badge)
->setTag('span')
->setClass('info')
->setClass('info record_borrower_review_average_score')
->setText($this->_view->rating($this->_model->getNoteMoyenneAvisAbonnes()))
->setTitle($this->_('Note moyenne des avis des abonnés sur le document "%s".', $this->_model->getTitrePrincipal(' '))));
}
$codif = Class_Codification::getInstance();
foreach($this->_getFacets($this->_model) as $facet)
$badges [] = ((new Intonation_Library_Badge)
->setTag('a')
->setClass('primary')
->setClass('primary record_facets record_facet_' . strtolower($codif->getNomChamp($facet->getFacetCode())))
->setImage(Class_Template::current()->getIco($this->_view,
'tag',
'utils'))
......@@ -211,7 +217,7 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
$badges [] = (new Intonation_Library_Badge)
->setTag('a')
->setUrl($this->_view->url((new Class_CriteresRecherche)->getNewUrlCriteresSerie($serie), null, true))
->setClass('white')
->setClass('white record_serie')
->setText($label)
->setTitle($this->_view->_('Lancer une recherche pour %s', lcfirst($label)));
}
......@@ -223,15 +229,17 @@ class Intonation_Library_View_Wrapper_Record extends Intonation_Library_View_Wra
protected function _getFacets() {
$instance_facets = $this->_model->getFacettes();
$codes = [Class_CodifTags::CODE_FACETTE,
Class_CodifMatiere::CODE_FACETTE,
Clas