Commit 09a4ca7f authored by Ghislain Loas's avatar Ghislain Loas

dev#64573 work on bootstrap

parent 3c02fc5a
Pipeline #7655 passed with stage
in 38 minutes and 38 seconds
<?php
/**
* Copyright (c) 2012, Agence Française Informatique (AFI). All rights reserved.
*
......@@ -1506,15 +1505,14 @@ class AbonneController extends ZendAfi_Controller_Action {
public function selectionAction() {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('id'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('selection_id'))) {
return $this->_redirectClose($this->_getReferer());
}
}
public function ajouterALaSelectionAction() {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('id'))) {
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('selection_id'))) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
......@@ -1532,28 +1530,54 @@ class AbonneController extends ZendAfi_Controller_Action {
public function ajouterLeDocumentALaSelectionAction() {
if(!$this->_user)
return $this->_forward('popup-login', 'auth', 'opac');
session_write_close();
$this->getHelper('ViewRenderer')->setNoRender();
if (!$selection = Class_PanierNotice::find($this->_getParam('id')))
return $this->_response->setHttpResponseCode(404);
$selection = (($selection = Class_PanierNotice::find($this->_getParam('selection_id')))
? $selection
: Class_PanierNotice::findFirstBy(['id_user' => $this->_user->getId(),
'libelle' => $this->_getParam('selection_label')]));
if (!$selection) {
$this->getHelper('ViewRenderer')->setNoRender();
return $this->_response->setHttpResponseCode(520);
}
if (!$selection->isMine())
return $this->_response->setHttpResponseCode(404);
if (!$selection->isMine()) {
$this->getHelper('ViewRenderer')->setNoRender();
return $this->_response->setHttpResponseCode(520);
}
if (!$record = Class_Notice::find($this->_getParam('record_id')))
return $this->_response->setHttpResponseCode(404);
if (!$record = Class_Notice::find($this->_getParam('record_id'))) {
$this->getHelper('ViewRenderer')->setNoRender();
return $this->_response->setHttpResponseCode(520);
}
$selection->addNotice($record);
$selection->save();
$this->_helper->json(['anchor' => $this->view->tagAction((new Intonation_Library_Selection)
->setView($this->view)
->setUser($this->_user)
->setRecord($record)
->setTitle($this->_getParam('selection_label'))
->setImage($this->_getParam('image'))
->setRevertImage($this->_getParam('revert-image'))
->getAction())]);
}
public function supprimerDeLaSelectionAction() {
$this->view->titre = $this->_('Retirer un document');
if (!$this->view->selection = Class_PanierNotice::find($this->_getParam('selection_id'))) {
$this->view->selection = (($selection = Class_PanierNotice::find($this->_getParam('selection_id')))
? $selection
: Class_PanierNotice::findFirstBy(['id_user' => $this->_user->getId(),
'libelle' => $this->_getParam('selection_label')]));
if (!$this->view->selection) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
......@@ -1568,6 +1592,22 @@ class AbonneController extends ZendAfi_Controller_Action {
return $this->_redirectClose($this->_getReferer());
}
if ($this->_getParam('ajax')) {
$this->view->selection
->removeNotice($this->view->record)
->save();
return $this->_helper->json(['anchor' =>
$this->view->tagAction((new Intonation_Library_Selection)
->setView($this->view)
->setUser($this->_user)
->setRecord($this->view->record)
->setTitle($this->_getParam('selection_label'))
->setImage($this->_getParam('image'))
->setRevertImage($this->_getParam('revert-image'))
->getAction())]);
}
if ($this->_getParam('delete')) {
$this->view->selection
->removeNotice($this->view->record)
......@@ -1605,6 +1645,76 @@ class AbonneController extends ZendAfi_Controller_Action {
}
public function supprimerLaSelectionAction() {
$this->view->titre = $this->_('Supprimer une sélection');
$this->view->selection = (($selection = Class_PanierNotice::find($this->_getParam('selection_id')))
? $selection
: Class_PanierNotice::findFirstBy(['id_user' => $this->_user->getId(),
'libelle' => $this->_getParam('selection_label')]));
if (!$this->view->selection) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
if (!$this->view->selection->isMine()) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
if ($this->_getParam('delete')) {
$this->view->selection->delete();
$this->_helper->notify($this->_('La sélection a bien été supprimée'),
['status' => 'delete']);
return $this->_redirectClose($this->view->url(['action' => 'selections']));
}
}
public function renommerLaSelectionAction() {
$this->view->titre = $this->_('Renommer une sélection');
$this->view->selection = (($selection = Class_PanierNotice::find($this->_getParam('selection_id')))
? $selection
: Class_PanierNotice::findFirstBy(['id_user' => $this->_user->getId(),
'libelle' => $this->_getParam('selection_label')]));
if (!$this->view->selection) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
if (!$this->view->selection->isMine()) {
$this->_helper->notify($this->_('Une erreur c\'est produite.'), ['status' => 'error']);
return $this->_redirectClose($this->_getReferer());
}
$this->view->form = new ZendAfi_Form();
$this->view->form
->addElement('text',
'libelle',
['value' => $this->view->selection->getLibelle(),
'placeholder' => 'Titre de la sélection'])
->addUniqDisplayGroup('group')
->setAction($this->view->url());
if(!$this->_request->isPost())
return;
$this->view->selection->setLibelle($this->_request->getPost('libelle'));
if(!$this->view->form->isValidModelAndArray($selection, $this->_request->getPost()))
return;
$selection->save();
$selection->index();
$this->_helper->notify($this->_('La sélection a bien été renommée.'), ['status' => 'success']);
return $this->_redirectClose($this->_getReferer());
}
public function mesAvisAction() {
}
......@@ -1707,4 +1817,34 @@ class AbonneController extends ZendAfi_Controller_Action {
$response->setHeader('Access-Control-Allow-Origin', '*');
$response->setBody($data);
}
public function reserverAction() {
session_write_close();
$this->view->titre = $this->_('Réserver un document');
if (!$record = Class_Notice::find($this->_getParam('record_id', 0)))
return $this->_response->setHttpResponseCode(520);
$nb_notices_oeuvre = Class_Notice::countBy(['clef_oeuvre' => $record->getClefOeuvre(),
'id_notice not' => $record->getId()]);
if (!$record->hasExemplaires())
return $this->_response->setHttpResponseCode(520);
$cond = ['id_notice' => $record->getId()];
$session = Zend_Registry::get('session');
$cond['id_bib'] = $session->id_bibs;
$items = ($items = Class_Exemplaire::findAllBy(array_filter($cond)))
? $items
: Class_Exemplaire::findAllBy($params);
$items = (new Class_Profil_ItemsFilter())->select(Class_Profil::getCurrentProfil(), $items);
$this->view->items = (new Class_CommSigb())->getDispoExemplaires($items);
$record->updateFacetsFromExemplaires();
}
}
......@@ -99,9 +99,11 @@ class RechercheController extends ZendAfi_Controller_Action {
$this->_extractMultifacetsPost())) {
$url = $this->newCriteresRecherches($params)
->getUrlWithMultifacetsUpdate($multifacets);
$this->_redirect($this->view->url($url, null, true),
isset($params ['titre']) ? ($url ['titre'] = $params ['titre']) : '';
return $this->_redirect($this->view->url($url, null, true),
['prependBase' => false]);
return;
}
$criteres_recherche = $this->newCriteresRecherches($params);
......@@ -110,10 +112,11 @@ class RechercheController extends ZendAfi_Controller_Action {
$criteres_recherche->updateRubrique('guidee');
if ($this->_request->isPost()) {
$params = $criteres_recherche->getUrlCriteresWithFacettes();
$criteria_params = $criteres_recherche->getUrlCriteresWithFacettes();
// preserve module as we may come from Telephone_RechercheController
$params['module'] = $this->_request->getModuleName();
return $this->_redirect($this->view->url($params, null, true),
$criteria_params['module'] = $this->_request->getModuleName();
isset($params ['titre']) ? ($criteria_params ['titre'] = $params ['titre']) : '';
return $this->_redirect($this->view->url($criteria_params, null, true),
['prependBase' => false]);
}
......
<?php
echo $this->Notice_Exemplaires($this->items);
<?php
$description = $this->_('Supprimer la sélection %s qui contient %d document(s)',
$this->selection->getLibelle(),
$this->selection->numberOfNotices());
echo $this->renderDeleteQuestion($description, ['delete' => '1']);
......@@ -332,7 +332,7 @@ class Class_CriteresRecherche {
public function getFacettesUrlEncoded() {
$facettes = $this->getFacettes();
return $facettes ? implode('-',$facettes) : null;
return $facettes ? implode('-', $facettes) : null;
}
......@@ -605,8 +605,7 @@ class Class_CriteresRecherche {
$this->visitByRechercheType($visitor);
$facettes = $this->getFacettes();
foreach($facettes as $facette)
foreach($this->getFacettes() as $facette)
$visitor->visitFacette($facette);
foreach($this->getMultiFacets() as $facet)
......@@ -769,25 +768,30 @@ class Class_CriteresRecherche {
public function getUrlCriteresWithFacettes() {
$intersect=$this->_params;
if ($this->getFacettesUrlEncoded()!='')
$intersect['facettes']=$this->getFacettesUrlEncoded();
$intersect = $this->_params;
if ($facettes = $this->getFacettesUrlEncoded())
$intersect['facettes'] = $facettes;
unset($intersect['facette']);
unset($intersect['filtres']);
if ($intersect)
return array_merge(['controller' => 'recherche',
'action' => 'simple'],
$intersect);
return ['controller'=>'recherche',
return ['controller' => 'recherche',
'action' => 'simple'];
}
public function getCVSUrlCriteresWithFacettes() {
$intersect=$this->_params;
if ($this->getFacettesUrlEncoded()!='')
$intersect['facettes']=$this->getFacettesUrlEncoded();
if ($facettes = $this->getFacettesUrlEncoded())
$intersect['facettes'] = $facettes;
unset($intersect['facette']);
unset($intersect['filtres']);
if ($intersect)
......@@ -835,11 +839,14 @@ class Class_CriteresRecherche {
public function getUrlCriteresWithoutElement($element) {
$intersect=$this->_params;
if ($this->getFacettesUrlEncoded()!='')
$intersect['facettes']=$this->getFacettesUrlEncoded();
if ($facettes = $this->getFacettesUrlEncoded())
$intersect['facettes'] = $facettes;
unset($intersect['facette']);
unset($intersect[$element]);
unset($intersect['filtres']);
return array_merge(['controller' => 'recherche',
'action' => 'simple'],
$intersect);
......@@ -848,8 +855,10 @@ class Class_CriteresRecherche {
public function getUrlCriteresWithoutTri() {
$intersect=$this->_params;
if ($this->getFacettesUrlEncoded()!='')
$intersect['facettes']=$this->getFacettesUrlEncoded();
if ($facettes = $this->getFacettesUrlEncoded())
$intersect['facettes'] = $facettes;
unset($intersect['facette']);
unset($intersect['filtres']);
unset($intersect['tri']);
......@@ -977,6 +986,11 @@ class Class_CriteresRecherche {
}
public function getProfil() {
return $this->_profil;
}
public function getFormat() {
return $this->getParam('liste_format')
? $this->getParam('liste_format')
......@@ -1027,4 +1041,11 @@ class Class_CriteresRecherche {
protected function _getBookmark() {
return Class_User_BookmarkedSearch::find($this->getParam('bookmarked_search'));
}
public function isEmpty() {
return ! ($this->hasExpressionRecherche()
|| $this->getFacettes()
|| $this->getMultiFacets());
}
}
......@@ -128,12 +128,13 @@ class Class_WebService_Lastfm extends Class_WebService_Abstract {
public function getMorceaux($titre, $auteur) {
$album=$this->getAlbum($titre,$auteur);
if(!$album) return false;
if (!$album = $this->getAlbum($titre,$auteur))
return false;
$data = $this->httpGet($album['url']);
$dom = new Zend_Dom_Query($data);
$elements = $dom->queryXpath('//td[@class="chartlist-name"]//span/a');
$elements = $dom->queryXpath('//td[@class="chartlist-name"]/a');
if (!$elements->count())
return ['nb_resultats' => 0];
......
......@@ -139,6 +139,7 @@ class ZendAfi_View_Helper_AdvancedSearch extends ZendAfi_View_Helper_BaseHelper
$form->populate($request->getParams());
$form->setAction($this->view->url(['controller' => 'recherche',
'action' => 'simple',
'titre' => $this->_('Recherche avancée'),
'form_id' => $form_id],
null, true));
return $form;
......
......@@ -70,7 +70,12 @@ div:hover > .img_as_background {
.card-img-overlay a:hover,
.card-img-overlay a:visited {
color: var(--front-overlay-text);
display: grid;
display: block;
height: 100%;
}
.card-img-overlay a > div {
display: grid !important;
height: 100%;
}
......@@ -81,12 +86,20 @@ p > i {
margin-right: 0.5em;
}
.previous > i:first-child,
.next > i:first-child,
.card-columns .card-footer a,
.widget.rech_simple i:first-child,
.nav-link i:first-child,
.carousel-control-prev i:first-child,
.carousel-control-next i:first-child {
margin-right: 0;
}
.d-table .next {
padding-left: 100%;
}
.card-body.behind_image {
position: absolute;
top: 0;
......@@ -263,6 +276,7 @@ pre {
}
[class*="carousel-control"] {
margin: 30% 0;
width: auto;
}
......@@ -450,17 +464,21 @@ header.col {
font-size: 1em;
}
.card .card-columns .card-img-overlay h3,
.card .card-columns .card-img-overlay h4,
.card .card-columns .card-img-overlay {
.img-thumbnail .card-columns .card-img-overlay h3,
.img-thumbnail .card-columns .card-img-overlay h4,
.img-thumbnail .card-columns .card-img-overlay {
font-size: 0.875em;
padding: 0;
}
.no_wrap {
.w-s_nowrap {
white-space: nowrap;
}
.w-s_normal {
white-space: normal;
}
dl.row {
margin: 0;
}
......@@ -472,4 +490,70 @@ dl.row {
.rating-score {
display: inline-flex;
}
\ No newline at end of file
}
.list-group-item:first-child {
padding-top: 0 !important;
margin-top: 0 !important;
}
.card-deck .button_text,
.card-columns .button_text {
display: none !important;
}
.button_text_d_none > a > .button_text {
display: none !important;
}
.dropdown-menu .button_text {
display: inline-block !important;
}
.search_tools .nav.nav-fill > li.nav-item:first-child {
text-align: left;
}
.search_tools .nav.nav-fill > li.nav-item:last-child {
text-align: right;
}
.dropdown-menu label {
flex: 100%;
max-width: 100%;
}
.user_ico {
height: 32px;
}
.badge-group .badge.text-truncate {
max-width: 150px;
}
.dropleft.dropup .dropdown-menu {
top: auto !important;
bottom: -0.5em !important;
right: 105% !important;
left: auto !important;
transform: none !important;
}
.card-footer .dropleft.dropup .dropdown-menu {
bottom: 1.5em !important;
right: -0.5em !important;
}
.jumbotron .dropleft.dropup .dropdown-menu {
bottom: auto !important;
top: 100% !important;
right: 0 !important;
}
.card-deck > .card,
.card-columns > .card {
overflow: hidden;
}
<?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_Search_Criteria extends Class_CriteresRecherche {
public function from($criteria) {
$this->_params = $criteria->getCriteres();
$this->_profil = $criteria->getProfil();
$this->setTime($criteria->getTime());
$this->_validate_facette = $criteria->getValidateFacette();
return $this;
}
public function getUrlCriteresWithoutElement($element) {
$intersect = $this->_params;
if ('' != $this->getFacettesUrlEncoded())
$intersect['facettes'] = $this->getFacettesUrlEncoded();
unset($intersect['facette']);
unset($intersect[$element]);
unset($intersect['filtres']);
return array_merge(['controller' => 'recherche',
'action' => 'simple'],
$intersect);
}
public function getUrlRemoveAllFacet($facet) {
$code = $facet->getRubrique()->getCode();
$url_without_multifacet = $this->getUrlRemoveMultiFacet($code);
$url_without_facet = parent::getUrlRemoveFacette($facet);
$url = $this->getUrlRetourListe();
$url['facettes'] = isset($url_without_facet['facettes'])
? $url_without_facet['facettes']
: null;
$url['multifacets'] = isset($url_without_multifacet['multifacets'])
? $url_without_multifacet['multifacets']
: null;
$url['page'] = null;
$url['genre'] = null;
$url['facette'] = null;
return $url;
}
public function getUrlRemoveFacette($facette) {
return $this->getUrlRemoveAllFacet($facette);
}
}
<?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_Selection extends Class_Entity {
use Trait_Translator;
protected $_cache;
protected function _getImageForContext() {
return $this->_isIn()
? $this->getImage()
: $this->getRevertImage();
}
protected function _getTitleForContext() {
$record = $this->getRecord()->getTitrePrincipal(' ');
$selection = $this->getTitle();
return $this->_isIn()
? $this->_('Retirer le document %s de la sélection %s',
$record,
$selection)
: $this->_('Ajouter le document %s à la sélection %s',
$record,
$selection);
}
protected function _getUrlForContext() {
$action = $this->_isIn()
? 'supprimer-de-la-selection'
: 'ajouter-le-document-a-la-selection';