Commit f6210361 authored by Ghislain Loas's avatar Ghislain Loas

dev #71715 improve file explorer search

parent 5f2e1717
- ticket #71715 : Explorateur de fichiers : ajout de la possiblité de rechercher des dossiers.
\ No newline at end of file
......@@ -332,7 +332,7 @@ class Class_FileManager_FileSystem {
$this->_cached_paths[] = $term . $path;
$closure = function() use ($term, $path) {
$cmd = sprintf("find %s -type f -iname '*%s*'",
$cmd = sprintf('find %s -iname "*%s*"',
$path,
$term);
......@@ -343,7 +343,12 @@ class Class_FileManager_FileSystem {
sort($found, SORT_NATURAL);
return array_filter(array_map([$this, 'fileAt'], $found));
if(Class_FileManager_FileSystem::LISTING_LIMIT < count($found)) {
$this->_oversized[] = $path;
$found = array_slice($found, 0, Class_FileManager_FileSystem::LISTING_LIMIT);
}
return array_filter(array_map([Class_FileManager, 'find'], $found));
};
return (new Storm_Cache())
......
......@@ -407,13 +407,16 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp
protected function _search($term, $item, $key, $settings) {
$url = $this->view->url(['search_' . $key => null]) . '&search_' . $key;
$onclick = $this->view->isPopup()
? sprintf("var value = encodeURIComponent($(this).closest('div').find('input').val());opacDialogFromUrl(addPath('%s=' + value, '&render=popup'));return false;", $url)
: sprintf("var value = encodeURIComponent($(this).closest('div').find('input').val());document.location = '%s=' + value;return false;", $url);
return $this->_tag('input', '', ['type' => 'text',
'value' => $term,
'placeholder' => $term ? $term : $this->_('Rechercher'),
'name' => 'search_' . $key]) .
? sprintf("var value = encodeURIComponent($(this).closest('div').find('input').val());opacDialogFromUrl(addPath('%s=' + value, '&render=popup'));", $url)
: sprintf("var value = encodeURIComponent($(this).closest('div').find('input').val());document.location = '%s=' + value;", $url);
return $this->_tag('input',
null,
['type' => 'text',
'value' => $term,
'placeholder' => $term ? $term : $this->_('Rechercher'),
'name' => 'search_' . $key,
'onkeypress' => sprintf('if (event.keyCode==13) {%s}', $onclick)]) .
$this->view->button((new Class_Entity)
->setText($this->_tag('i', '', ['class' => 'fa fa-search']))
->setTitle($this->_('Rechercher le terme saisie'))
......
......@@ -35,10 +35,8 @@ class ZendAfi_View_Helper_Admin_Head extends ZendAfi_View_Helper_BaseHelper {
->showNotifications()
->loadPrettyPhoto();
Class_Admin_Skin::current()->renderScriptsOn($head_scripts);
$script_loader = Class_ScriptLoader::getInstance();
Class_Admin_Skin::current()->renderScriptsOn($script_loader);
$script_loader->addJQueryReady('setupAnchorsTarget();')
->addJQueryReady('selectArticle();')
->addJQueryReady('selectArticleCategory();')
......
......@@ -267,11 +267,16 @@ body .file-manager .tree > ul {
padding: 5px;
}
body .file-manager .browser_tools input,
body .file-manager .admin-button {
margin: 5px;
padding: 0px 10px;
}
body .file-manager .browser_tools input {
line-height: 1.62em;
}
body .file-manager p,
body #opac-dialog p,
body #opac-dialog .path_linked_to_models,
......@@ -286,4 +291,4 @@ body .file-manager #image_preview {
max-width: 400px;
max-height: 200px;
margin: 1%;
}
}
\ No newline at end of file
Markdown is supported
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