Skip to content
Snippets Groups Projects
Commit c3ad8141 authored by Ghislain Loas's avatar Ghislain Loas
Browse files

sandbox remove unused files

parent 8699f3aa
Branches
Tags
5 merge requests!2334Master,!2102#57574 : correction orthographe des jours de la semaine,!2068Dev#57305 story status sandbox improve search page,!2064Dev#57305 story status sandbox improve search page,!2063Sandbox improve search page
Pipeline #655 failed with stage
in 8 minutes and 21 seconds
......@@ -592,10 +592,9 @@ class RechercheController extends ZendAfi_Controller_Action {
public function suggestajaxAction() {
if (!$startsWith = trim($this->_getParam('startsWith'))) {
$this->_helper->json([]);
return;
}
if (!$startsWith = trim($this->_getParam('startsWith')))
return $this->_helper->json([]);
$results = Class_Autocomplete_Index::searchAll($startsWith);
$terms = Class_Autocomplete_IndexSearcher::extractTerms($startsWith);
$term_regex = '/('.implode('|', $terms).')/iu';
......
......@@ -85,7 +85,7 @@ class Class_Profil_Preferences {
}
protected function setModulePref($profile, $definition, $pref) {
public function setModulePref($profile, $definition, $pref) {
$profile->setCfgModulesPreferences($pref,
$definition->getController(),
$definition->getAction(),
......
<?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_Form_Decorator_AutoCompleteSelector extends Zend_Form_Decorator_Abstract {
public function render($content) {
return $content
. $this->_element->getView()->autoCompleteSelector($this->_element->getConfig());
}
}
?>
\ No newline at end of file
<?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_Form_Element_AutoCompleteSelector extends Zend_Form_Element_Xhtml {
protected $_config;
public function __construct($spec, $options = null) {
parent::__construct($spec, $options);
$this->_config = (new Class_Entity());
$this->_config
->setSpec($spec)
->setOptions($options);
$decorators = $this->_decorators;
$this->_decorators = ['AutoCompleteSelector' => new ZendAfi_Form_Decorator_AutoCompleteSelector()];
foreach ($decorators as $name => $value) {
$this->_decorators[$name] = $value;
}
$this->removeDecorator('ViewHelper');
}
public function getConfig() {
return $this->_config;
}
}
?>
\ No newline at end of file
......@@ -72,7 +72,7 @@ class ZendAfi_Form_Search_Advanced extends ZendAfi_Form {
'operateur_collection',
['multiOptions' => $this->_getOperators()])
->addElement('autoCompleteSelector',
->addElement('text',
'rech_collection',
['label' => $this->_('Collections')])
......
<?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_AutoCompleteSelector extends ZendAfi_View_Helper_BaseHelper {
protected $_config;
public function autoCompleteSelector($config) {
$this->_config = $config;
return $this->_tag('div' ,
$this->_selectedValues()
. $this->_searchValues()
. $this->_availableValues(),
['class' => 'auto-complete-selector']);
}
protected function _selectedValues() {
if(!$values = $this->_config->getValues())
return $this->_tag('div',
null,
['class' => 'auto-complete-selector-values']);
$results = [];
foreach($values as $value)
$results[] = $this->_tag('span', $value);
return $this->_tag('div',
implode($results),
['class' => 'auto-complete-selector-values']);
}
protected function _searchValues() {
if(!$url = $this->_config->getSearchUrl())
return '';
return $this->_tag('div',
$this->_tag('input',
null,
array_filter(['name' => $this->_config->getSearchName(),
'id' => $this->_config->getSearchId(),
'placeholder' => $this->_config->getSearchPlaceHolder(),
'value' => $this->_config->getSearchValue(),
'type' => 'text'])),
['class' => 'auto-complete-selector-search']);
}
protected function _availableValues() {
if(!$values = $this->_config->getAvailableValues())
return '';
return $this->_tag('div',
$this->_tag('ul',
implode($available_items)),
['class' => 'auto-complete-selector-available-items']);
}
}
?>
\ No newline at end of file
......@@ -26,6 +26,15 @@ class SearchResultTest extends AbstractControllerTestCase {
public function setUp() {
parent::setUp();
(new Class_Profil_Preferences())->setModulePref(Class_Profil::getCurrentProfil(),
(new Class_Entity())
->setController('recherche')
->setAction('resultat')
->setSubAction('simple'),
['header_composition' => 'Advanced;History;Display;Order;PageSize;']);
$this->dispatch('/opac/recherche/pomme', true);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment