From 54f776fb2f9133d3b5f5748180663b139c890e59 Mon Sep 17 00:00:00 2001 From: Ghislain Loas <ghislo@sandbox.pergame.net> Date: Fri, 2 Sep 2016 17:25:12 +0200 Subject: [PATCH] sandbox improve search page first commit with explo --- .../scripts/recherche/resultatRecherche.phtml | 5 +- library/Class/CriteresRecherche.php | 24 ++- library/Class/MoteurRecherche.php | 5 +- library/Class/MoteurRecherche/Result.php | 3 + library/Class/Profil.php | 16 ++ library/ZendAfi/Form/Search/Advanced.php | 136 +++++++++++++++++ library/ZendAfi/Form/Search/Display.php | 25 ++++ library/ZendAfi/Form/Search/ResultsByPage.php | 25 ++++ .../ZendAfi/View/Helper/RenderFormInFront.php | 137 ++++++++++++++++++ .../Helper/SearchResult/AbstractWidget.php | 39 +++++ .../View/Helper/SearchResult/Advanced.php | 30 ++++ .../View/Helper/SearchResult/Display.php | 44 ++++++ .../View/Helper/SearchResult/Order.php | 45 ++++++ .../Helper/SearchResult/ResultsByPage.php | 44 ++++++ public/opac/css/global.css | 76 +++++++++- 15 files changed, 643 insertions(+), 11 deletions(-) create mode 100644 library/ZendAfi/Form/Search/Advanced.php create mode 100644 library/ZendAfi/Form/Search/Display.php create mode 100644 library/ZendAfi/Form/Search/ResultsByPage.php create mode 100644 library/ZendAfi/View/Helper/RenderFormInFront.php create mode 100644 library/ZendAfi/View/Helper/SearchResult/AbstractWidget.php create mode 100644 library/ZendAfi/View/Helper/SearchResult/Advanced.php create mode 100644 library/ZendAfi/View/Helper/SearchResult/Display.php create mode 100644 library/ZendAfi/View/Helper/SearchResult/Order.php create mode 100644 library/ZendAfi/View/Helper/SearchResult/ResultsByPage.php diff --git a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml index 57607f6b61c..937d12bb99b 100644 --- a/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml +++ b/application/modules/opac/views/scripts/recherche/resultatRecherche.phtml @@ -13,7 +13,10 @@ $this->openBoite($this->titre); ?> <div class="resultats_page"> <?php - echo $this->tagTriRecherche($this->criteres_recherche); + echo $this->searchResult_Advanced($this->criteres_recherche); + echo $this->searchResult_Order($this->criteres_recherche); + echo $this->searchResult_ResultsByPage($this->criteres_recherche); + echo $this->searchResult_Display($this->criteres_recherche); echo $this->tagTitreEtNombreDeResultats($this->search_result, $this->search_duration); echo $this->tagNombreDePages($this->criteres_recherche->getPage()); diff --git a/library/Class/CriteresRecherche.php b/library/Class/CriteresRecherche.php index 0a0b301cd68..fd4ca02d55a 100644 --- a/library/Class/CriteresRecherche.php +++ b/library/Class/CriteresRecherche.php @@ -145,6 +145,17 @@ class Class_CriteresRecherche { } + public function getAvailablePageSize() { + $profil_param = $this->_profil->getSearchResultPageSize(); + return [ $profil_param => $profil_param, + '10' => 10, + '20' => 20, + '30' => 30, + '50' => 50, + '100' => 100]; + } + + /** * @param $rech array paramètres de recherche et leurs valeurs * @return Class_CritereRecherche @@ -562,7 +573,6 @@ class Class_CriteresRecherche { $filtered_params = []; $params= $this->replaceEmptyRechercheByStar($params); - foreach($valid_parameters as $key) { if (array_isset($key, $params)) { if (preg_match('/^operateur_/', $key) @@ -821,4 +831,16 @@ class Class_CriteresRecherche { $this->_profil = null; return $this; } + + + public function getFormat() { + return $this->getParam('liste_format') + ? $this->getParam('liste_format') + : $this->_profil->getSearchResultDisplayFormat(); + } + + + public function getAvailableFormats() { + return Class_Systeme_ModulesAppli::getAvailableListeNoticeFormat(); + } } diff --git a/library/Class/MoteurRecherche.php b/library/Class/MoteurRecherche.php index 1a8f480a1fe..eff38d70171 100644 --- a/library/Class/MoteurRecherche.php +++ b/library/Class/MoteurRecherche.php @@ -290,8 +290,11 @@ class Class_MoteurRecherche { if (!$operateur) $operateur = 'and'; + if($type_recherche == 'commence' && $name == 'titres') + $name = 'alpha_titre'; + // Type de recherche - $condition = ($type_recherche == 'fulltext') + $condition = (($type_recherche == 'fulltext') || ($name != 'alpha_titre')) ? "MATCH(".$name.") AGAINST('".$recherche."' IN BOOLEAN MODE)" : $name . " like '" . $recherche . "%'"; diff --git a/library/Class/MoteurRecherche/Result.php b/library/Class/MoteurRecherche/Result.php index ca7b2c8427f..9b104ef0bf2 100644 --- a/library/Class/MoteurRecherche/Result.php +++ b/library/Class/MoteurRecherche/Result.php @@ -74,6 +74,9 @@ class Class_MoteurRecherche_Result { if (!$this->_records_query) return []; + var_dump($this->_records_query); + + $data = $this->_fetchFromCache($this->_records_query); $this->_ids = array_column($data, 0); $this->_facets = array_column($data, 1); diff --git a/library/Class/Profil.php b/library/Class/Profil.php index c8c6d5efa38..86aea71a67f 100644 --- a/library/Class/Profil.php +++ b/library/Class/Profil.php @@ -1994,6 +1994,22 @@ class Class_Profil extends Storm_Model_Abstract { } + public function getSearchResultPageSize() { + $settings = $this->getSearchResultSettings(); + return isset($settings['liste_nb_par_page']) + ? $settings['liste_nb_par_page'] + : 5; + } + + + public function getSearchResultDisplayFormat() { + $settings = $this->getSearchResultSettings(); + return isset($settings['liste_format']) + ? $settings['liste_format'] + : Class_Systeme_ModulesAppli::LISTE_FORMAT_VIGNETTES; + } + + public function getConfigurationOf($module,$action, $action2) { $cfg = $this->getCfgModulesAsArray(); $default_cfg = (new Class_Systeme_ModulesAppli())->getValeursParDefaut($module, $action); diff --git a/library/ZendAfi/Form/Search/Advanced.php b/library/ZendAfi/Form/Search/Advanced.php new file mode 100644 index 00000000000..01b84c8a8cd --- /dev/null +++ b/library/ZendAfi/Form/Search/Advanced.php @@ -0,0 +1,136 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_Form_Search_Advanced extends ZendAfi_Form { + public function init() { + parent::init(); + return $this + + ->addElement('select', + 'operateur_titres', + ['multiOptions' => $this->_getOperators()]) + ->addElement('select', + 'type_recherche', + ['multiOptions' => ['fulltext' => $this->_('Contient'), + 'commence' => $this->_('Commence par')]]) + ->addElement('text', + 'rech_titres', + ['label' => $this->_('Titres')]) + + ->addElement('select', + 'operateur_auteurs', + ['multiOptions' => $this->_getOperators()]) + ->addElement('text', + 'rech_auteurs', + ['label' => $this->_('Auteurs')]) + + ->addElement('select', + 'operateur_editeur', + ['multiOptions' => $this->_getOperators()]) + ->addElement('text', + 'rech_editeur', + ['label' => $this->_('Editeurs')]) + + /* ->addElement('select', */ + /* 'operateur_matieres', */ + /* ['multiOptions' => $this->_getOperators()]) */ + /* ->addElement('text', */ + /* 'rech_matieres', */ + /* ['label' => $this->_('Sujets')]) */ + + /* ->addElement('select', */ + /* 'operateur_dewey', */ + /* ['multiOptions' => $this->_getOperators()]) */ + /* ->addElement('text', */ + /* 'rech_dewey', */ + /* ['label' => $this->_('Centres d\'intérêt')]) */ + + /* ->addElement('select', */ + /* 'operateur_collection', */ + /* ['multiOptions' => $this->_getOperators()]) */ + /* ->addElement('text', */ + /* 'rech_collection', */ + /* ['label' => $this->_('Collections')]) */ + + /* ->addElement('dateRangePicker', */ + /* 'annee_range', */ + /* ['label' => $this->_('Période de publication'), */ + /* 'start' => ['name' => 'annee_debut'], */ + /* 'end' => ['name' => 'annee_fin']]) */ + + ->addElement('select', + 'nouveaute', + ['label' => $this->_('Nouveautés de moins de'), + 'multiOptions' => ['0' => $this->_('Pas de restriction sur la nouveauté'), + '1' => $this->_('Nouveautés de moins d\'un mois'), + '3' => $this->_('Nouveautés de moins de trois mois'), + '6' => $this->_('Nouveautés de moins de six mois'), + '12' => $this->_('Nouveautés de moins d\'un an')]]) + + ->addDisplayGroup([ + 'operateur_titres', + 'type_recherche', + 'rech_titres'], + 'title_group', + ['legend' => $this->_('Titres')]) + + ->addDisplayGroup(['operateur_auteurs', + 'rech_auteurs'], + 'author_group', + ['legend' => $this->_('Auteurs')]) + + ->addDisplayGroup(['operateur_editeur', + 'rech_editeur'], + 'editor_group', + ['legend' => $this->_('Editeurs')]) + + ->addDisplayGroup(['nouveaute'], + 'novelty_group', + ['legend' => $this->_('Nouveautés')]); + + /* 'operateur_matieres', */ + /* 'rech_matieres', */ + + /* 'operateur_dewey', */ + /* 'rech_dewey', */ + + /* 'operateur_collection', */ + /* 'rech_collection', */ + + /* 'annee_range', */ + + /* 'nouveaute', */ + + /* ], */ + /* 'advanced_search_fieldset', */ + /* ['legend' => $this->_('Filtrer la recherche')]) */ + /* ; */ + } + + + protected function _getOperators() { + return ['and' => $this->_('et'), + 'or' => $this->_('ou'), + 'and not' => $this->_('sauf')]; + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Search/Display.php b/library/ZendAfi/Form/Search/Display.php new file mode 100644 index 00000000000..977dedff614 --- /dev/null +++ b/library/ZendAfi/Form/Search/Display.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_Form_Search_Display extends ZendAfi_Form { +} +?> \ No newline at end of file diff --git a/library/ZendAfi/Form/Search/ResultsByPage.php b/library/ZendAfi/Form/Search/ResultsByPage.php new file mode 100644 index 00000000000..be622978c6d --- /dev/null +++ b/library/ZendAfi/Form/Search/ResultsByPage.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_Form_Search_ResultsByPage extends ZendAfi_Form { +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/RenderFormInFront.php b/library/ZendAfi/View/Helper/RenderFormInFront.php new file mode 100644 index 00000000000..3ec53b1e84b --- /dev/null +++ b/library/ZendAfi/View/Helper/RenderFormInFront.php @@ -0,0 +1,137 @@ +<?php +/** + * Copyright (c) 2012, 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 ZendAfi_View_Helper_RenderForminFront extends ZendAfi_View_Helper_BaseHelper { + + public function renderFormInFront($form) { + if (!$form) + return; + + if (!$this->_isFormContainsSubmit($form)) + $this->_addSubmitFor($form); + + $this->_setupDecoratorsForForm($form); + return $form->render(); + } + + + protected function _addSubmitFor($form) { + $id = 'submit_form_id_' . $form->getAttrib('id'); + $form->addElement('submit', + $id, + ['label' => $this->_('Valider'), + 'class' => 'button bouton']); + $form->getElement($id)->addDecorator('HtmlTag', ['tag' => 'div', + 'class' => 'form_submit']); + return $form; + } + + + protected function _isFormContainsSubmit($form) { + $isFormContainsSubmit = false; + + foreach($form->getElements() as $element) + $isFormContainsSubmit = ($isFormContainsSubmit || ($element->helper == 'formSubmit')); + + return $isFormContainsSubmit; + } + + + protected function _setupDecoratorsForForm($form) { + $params = ['FormElements', + ['HtmlTag', + ['tag' => 'div']], + 'fieldset']; + + $form + ->setDisplayGroupDecorators($params) + ->removeDecorator('HtmlTag'); + + foreach ($form->getElements() as $element) + $element->setDecorators($this->_customElement($element)); + + return $this; + } + + + protected function _customElement($element) { + $newDecorators = []; + + if('formSelect' == $element->helper) + $element->setAttrib('class' , 'button bouton'); + + if ('formText' == $element->helper) { + $element->onkeypress = 'if (event.keyCode == 13) {this.form.submit();return false;}'; + $element->setAttrib('class' , 'button bouton'); + } + + if($element->isRequired()) + $element->required = 'required'; + + $decorators = $element->getDecorators(); + + foreach ($decorators as $name => $decorator) { + $name = explode('_', $name); + $name = end($name); + $name = strtolower($name); + + switch ($name) { + case 'label': + $newDecorators[] = [['input_data' => 'HtmlTag'], + ['tag' => 'div', + 'class' => 'form_input']]; + $decorator->setOptions([]); + $decorator->setOption('wrap', ['tag' => 'div', + 'attribs' => ['class' => 'form_label']]); + $newDecorators[$name] = $decorator; + $newDecorators[] = ['HtmlTag', ['tag' => 'div']]; + break; + + case 'link': + $decorator->setOption('tag', 'div'); + $newDecorators[$name] = $decorator; + $newDecorators[] = ['HtmlTag', ['tag' => 'div']]; + break; + + case 'dtddwrapper': + break; + + case 'viewhelper': + $decorator->setOption('tag', 'div'); + $newDecorators[$name] = $decorator; + break; + + case 'multipleselection': + $newDecorators[] = [ ['input_data' => 'HtmlTag'], + ['tag' => 'div', + 'class' => 'multiple-selection-hook ' . $element->getId()]]; + $decorator->setOption('tag', 'div'); + $newDecorators[$name] = $decorator; + break; + + default: + $newDecorators[$name] = $decorator; + break; + } + } + + return $newDecorators; + } +} \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/SearchResult/AbstractWidget.php b/library/ZendAfi/View/Helper/SearchResult/AbstractWidget.php new file mode 100644 index 00000000000..c2be5cc9756 --- /dev/null +++ b/library/ZendAfi/View/Helper/SearchResult/AbstractWidget.php @@ -0,0 +1,39 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_View_Helper_SearchResult_AbstractWidget extends ZendAfi_View_Helper_BaseHelper { + protected function _renderWidget($form, $button, $class) { + $form->setMethod('GET'); + $form->setAttrib('class', $class . '_form'); + $form->setAction($this->view->url(['module' => 'opac', + 'controller' => 'recherche', + 'action' => 'simple'])); + return $this->_tag('div', + $this->_tag('button', + $button, + ['class' => 'button bouton', + 'onclick' => '$(this).parent().toggleClass(\'show\');']) . + $this->view->renderFormInFront($form), + ['class' => $class . '_widget']); + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/SearchResult/Advanced.php b/library/ZendAfi/View/Helper/SearchResult/Advanced.php new file mode 100644 index 00000000000..9646f2826cf --- /dev/null +++ b/library/ZendAfi/View/Helper/SearchResult/Advanced.php @@ -0,0 +1,30 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_View_Helper_SearchResult_Advanced extends ZendAfi_View_Helper_SearchResult_AbstractWidget { + public function searchResult_Advanced($search_criteria) { + return $this->_renderWidget(ZendAfi_Form_Search_Advanced::newWith($search_criteria->getCriteres()), + $this->_('Options de recherche avancée'), + 'advanced_search'); + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/SearchResult/Display.php b/library/ZendAfi/View/Helper/SearchResult/Display.php new file mode 100644 index 00000000000..7ff5024edde --- /dev/null +++ b/library/ZendAfi/View/Helper/SearchResult/Display.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_View_Helper_SearchResult_Display extends ZendAfi_View_Helper_BaseHelper { + public function searchResult_Display($search_criteria) { + $display_selected = $search_criteria->getFormat(); + $url_str = $this->view->url(['controller' => 'recherche', + 'action' => 'simple', + 'liste_format' => null]); + + $onchange = "var format=$('#lsite_format').val();document.location='" . $url_str . "/liste_format/'+format;"; + + $html = $this->view->tag('label', $this->_('Affichage'), ['for' => 'liste_format']) + . ' ' . $this->view->formSelect('lsite_format', + $display_selected, + ['onchange' => $onchange, + 'class' => 'bouton button'], + $search_criteria->getAvailableFormats()); + + return $this->view + ->tag('div', $this->view->tag('span', $html), + ['class' => '']); + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/SearchResult/Order.php b/library/ZendAfi/View/Helper/SearchResult/Order.php new file mode 100644 index 00000000000..3d9c6ed28f0 --- /dev/null +++ b/library/ZendAfi/View/Helper/SearchResult/Order.php @@ -0,0 +1,45 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_View_Helper_SearchResult_Order extends ZendAfi_View_Helper_BaseHelper { + public function searchResult_Order($search_criteria) { + if (!$url = $search_criteria->getUrlCriteresWithoutTri()) + return; + + $tri_selected = $search_criteria->getTri(); + $url_str = $this->view->url($url, null, true); + + $onchange = "var tri=$('#tri').val();document.location='" . $url_str . "/tri/'+tri;"; + + $html = $this->view->tag('label', $this->_('Trier par'), ['for' => 'tri']) + . ' ' . $this->view->formSelect('tri', + $tri_selected, + ['onchange' => $onchange, + 'class' => 'bouton button'], + $search_criteria->getListeTris()); + + return $this->view + ->tag('div', $this->view->tag('span', $html), + ['class' => 'tri-recherche']); + } +} +?> \ No newline at end of file diff --git a/library/ZendAfi/View/Helper/SearchResult/ResultsByPage.php b/library/ZendAfi/View/Helper/SearchResult/ResultsByPage.php new file mode 100644 index 00000000000..829ba0839e1 --- /dev/null +++ b/library/ZendAfi/View/Helper/SearchResult/ResultsByPage.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright (c) 2012-2014, 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 ZendAfi_View_Helper_SearchResult_ResultsByPage extends ZendAfi_View_Helper_BaseHelper { + public function searchResult_ResultsByPage($search_criteria) { + $page_size_selected = $search_criteria->getPageSize(); + $url_str = $this->view->url(['controller' => 'recherche', + 'action' => 'simple', + 'page_size' => null]); + + $onchange = "var nb=$('#page_size').val();document.location='" . $url_str . "/page_size/'+nb;"; + + $html = $this->view->tag('label', $this->_('Nombre de résultats'), ['for' => 'page_size']) + . ' ' . $this->view->formSelect('page_size', + $page_size_selected, + ['onchange' => $onchange, + 'class' => 'bouton button'], + $search_criteria->getAvailablePageSize()); + + return $this->view + ->tag('div', $this->view->tag('span', $html), + ['class' => '']); + } +} +?> \ No newline at end of file diff --git a/public/opac/css/global.css b/public/opac/css/global.css index 630fb310b85..1a422e17b68 100644 --- a/public/opac/css/global.css +++ b/public/opac/css/global.css @@ -378,9 +378,6 @@ table.calendar_main {margin-left: auto; margin-right: auto} margin-bottom: 5px; } -.boiteMilieu .contenu {overflow:hidden} - - /* Calendrier */ .calendar_day_event_start {text-decoration: none;font-weight:bold;} .calendar_today_clickable {border-bottom: 1px solid} @@ -765,13 +762,18 @@ input[type='url'] {border:1px solid #C8C8C8;} font-size: 0.95em; line-height:1.2em; color: #5f5f5f; - background-color: #f0f0f0; - border: 1px solid #5f5f5f; cursor: pointer; padding: 0.2em; margin: 0.2em; } + +.bouton:not(div):not([type="text"]), +.bouton:not(div):not([type="text"]):visited { + background-color: #f0f0f0; + border: 1px solid #5f5f5f; +} + .panier_index .bouton:not(div) { width: 31%; display: inline-block; @@ -779,8 +781,8 @@ input[type='url'] {border:1px solid #C8C8C8;} float: left; } -.bouton:not(div):focus, -.bouton:not(div):hover { +.bouton:not(div):not([type="text"]):focus, +.bouton:not(div):not([type="text"]):hover { color: #f0f0f0; background-color: #5f5f5f; } @@ -1613,7 +1615,6 @@ body.abonne_multimedia-hold-view .actions a { margin: 5px 0px 5px 5px; } -.resultats_page div.tri-recherche , .resultats_page div.nb-pages-recherche { float:right; clear:right; @@ -3379,4 +3380,63 @@ th.actions { .search-sentence .expressionRecherche { font-size: 1em; +} + +.opac.recherche_simple div[class*="_widget"] fieldset { + width: 45%; + border: none; + border-top: 1px solid; +} + +.opac.recherche_simple div[class*="_widget"] fieldset div , +.opac.recherche_simple div[class*="_widget"] fieldset { + display: inline-block; + vertical-align: top; +} + +.opac.recherche_simple div[class*="_widget"] fieldset .form_label { + position: absolute; + visibility: hidden; +} + +.opac.recherche_simple div[class*="_widget"] { + margin-bottom: 1em; +} + +.opac.recherche_simple div[class*="_widget"] form{ + background: white; + border-bottom: 2px solid; + border-top: 2px solid; + border-color: transparent; + max-height: 0; + overflow: hidden; + position: absolute; + transition-duration: .5s; + transition-property: all; + width: 100%; + z-index: 1; +} + +.opac.recherche_simple div[class*="_widget"].show form { + border-color: black; + max-height: 400px; +} + +[type="text"].bouton, +[type="text"].button { + cursor: initial; +} + +.resultats_page { + position: relative; +} + +.resultats_page > div { + display: inline-block; + vertical-align: top; +} + +.resultats_page div.info-recherche, +.resultats_page div.criteres_recherche { + width: 100%; } \ No newline at end of file -- GitLab