Commit afe8b4d6 authored by Ghislain Loas's avatar Ghislain Loas

Merge branch 'dev#71715_explorateur_de_fichiers' into 'master'

Dev#71715 explorateur de fichiers

See merge request afi/opacce!2508
parents 410b602c 28194192
- 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())
......
......@@ -405,15 +405,21 @@ class ZendAfi_View_Helper_Admin_FileManager extends ZendAfi_View_Helper_BaseHelp
protected function _search($term, $item, $key, $settings) {
if($item->isFile())
return '';
$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 dans "%s"', $item->getPath()),
'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'))
......
......@@ -25,6 +25,8 @@ class ZendAfi_View_Helper_Admin_FileManager_File extends ZendAfi_View_Helper_Bas
if(!$settings)
$settings = (new Class_Entity)->setSelectFile(false);
$url = $this->view->absoluteUrl($file->getUrl(), null, true);
$dt = [
$this->_tag('dt', $this->_('Nom :')),
$this->_tag('dd', $file->getName()),
......@@ -49,18 +51,24 @@ class ZendAfi_View_Helper_Admin_FileManager_File extends ZendAfi_View_Helper_Bas
];
if($file->isFile())
$dt = array_merge($dt,
[$this->_tag('dt', $this->_('Url public :')),
$this->_tag('dd', urldecode($url))]);
$dl = $this->_tag('dl', implode(array_filter($dt)));
$url = $this->view->absoluteUrl($file->getUrl(), null, true) . '?version='. time(); // force reload image
$url_reload = $url . '?version='. time(); // force reload image
$open_new_tab = ($file->isFile()
? $this->view->tagAnchor($url,
? $this->view->tagAnchor($url_reload,
$this->_('Accéder à "%s" dans un nouvel onglet.', $file->getName()),
['target' => '_blank'])
: '');
$preview = $this->view->tag('p',
($file->isImage()
? $this->view->tagImg($url)
? $this->view->tagImg($url_reload)
: $this->view->tag('i', '', ['class' => $file->getFontAwesome()])), ['class' => 'main-file']);
$models = ($models = $file->getModels())
......
......@@ -46,7 +46,6 @@ body .file-manager div.actions a {
body .file-manager div.actions a {
float: none;
display: block;
}
body[class*="file-manager"] #image_preview,
......@@ -57,11 +56,12 @@ body .file-manager .browser li.wall-item,
body .file-manager .file-manager-contextmenu,
body .file-manager .file-manager-tools > div,
body .file-manager .tree > ul,
body .file-manager .browser {
body .file-manager .browser,
body .file-manager .browser table {
vertical-align: top;
box-shadow: 1px 1px 5px var(--widget-shadow);
padding: 0.4%;
margin: 0 0.4%;
padding: 1ex 0.4%;
margin: 1ex 0.4%;
}
body .file-manager dt .fa,
......@@ -83,7 +83,7 @@ body .file-manager a.opened {
body .file-manager .browser h2 {
text-transform: none;
padding: 0;
margin: 0 0 0.5em 0;
margin: 1ex 0;
border: none;
color: var(--nav-background);
}
......@@ -144,7 +144,7 @@ body .file-manager .browser.current_browser {
}
body .file-manager .browser h2 {
font-size: 1em;
font-size: 1.2em;
white-space: nowrap;
}
......@@ -255,8 +255,25 @@ body .file-manager .browser dl + a {
clear: left;
}
body .file-manager .actions a {
display: none;
margin-left: 0;
margin-right: 5px;
}
body .file-manager .file-manager-contextmenu a,
body .file-manager .actions > a.file,
body .file-manager .actions > a.directory {
display: block;
}
body .file-manager .show_actions > .actions > a {
display: inline-block;
margin: 0 1em 0 0;
}
body .file-manager .show_actions > .actions > a:empty {
margin: 0;
}
body .file-manager .show_actions > .actions > a:first-child {
......@@ -267,11 +284,17 @@ 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;
width: 40%;
}
body .file-manager p,
body #opac-dialog p,
body #opac-dialog .path_linked_to_models,
......@@ -286,4 +309,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