gestion poubelle sur widget fichier (ref #242)
This commit is contained in:
parent
016f09983f
commit
3438392632
|
@ -109,7 +109,7 @@ class FileController extends Controller
|
||||||
|
|
||||||
if($fs->exists($fulldirectory)) {
|
if($fs->exists($fulldirectory)) {
|
||||||
$finder = new Finder();
|
$finder = new Finder();
|
||||||
$finder->depth('== 0')->sortByName()->in($fulldirectory)->exclude('thumb')->exclude('thumbmini');
|
$finder->depth('== 0')->sortByName()->in($fulldirectory)->exclude('thumb')->exclude('thumbmini')->exclude('__trash');
|
||||||
|
|
||||||
foreach ($finder as $file) {
|
foreach ($finder as $file) {
|
||||||
if(is_dir($file)) {
|
if(is_dir($file)) {
|
||||||
|
@ -148,6 +148,10 @@ class FileController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Flag poubelle
|
||||||
|
$fgtrash=false;
|
||||||
|
if(stripos($subdirectory,"_trash")==1) $fgtrash=true;
|
||||||
|
|
||||||
// Trie du tableu
|
// Trie du tableu
|
||||||
$sort = array_column($files, $preference["widgetsortdirectory"][$directory]);
|
$sort = array_column($files, $preference["widgetsortdirectory"][$directory]);
|
||||||
array_multisort($sort, SORT_ASC, $files);
|
array_multisort($sort, SORT_ASC, $files);
|
||||||
|
@ -171,6 +175,7 @@ class FileController extends Controller
|
||||||
'canadd' => $canupdate,
|
'canadd' => $canupdate,
|
||||||
'view' => $preference["widgetviewdirectory"][$directory],
|
'view' => $preference["widgetviewdirectory"][$directory],
|
||||||
'sort' => $preference["widgetsortdirectory"][$directory],
|
'sort' => $preference["widgetsortdirectory"][$directory],
|
||||||
|
'fgtrash' => $fgtrash,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +211,7 @@ class FileController extends Controller
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
if($data["subdirectory"]=="thumb"||$data["subdirectory"]=="thumbmini") {
|
if($data["subdirectory"]=="thumb"||$data["subdirectory"]=="thumbmini"||$data["subdirectory"]=="__trash") {
|
||||||
$form->addError(new FormError('Nom de répertoire réservé, merci de choisir un autre nom de répertoire'));
|
$form->addError(new FormError('Nom de répertoire réservé, merci de choisir un autre nom de répertoire'));
|
||||||
$this->get('session')->getFlashBag()->clear();
|
$this->get('session')->getFlashBag()->clear();
|
||||||
$request->getSession()->getFlashBag()->add("error", 'Nom de répertoire réservé, merci de choisir un autre nom de répertoire');
|
$request->getSession()->getFlashBag()->add("error", 'Nom de répertoire réservé, merci de choisir un autre nom de répertoire');
|
||||||
|
@ -234,6 +239,142 @@ class FileController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function trashAction(Request $request,$access="config")
|
||||||
|
{
|
||||||
|
// S'assurer que c'est un appel ajax
|
||||||
|
if (!$request->isXmlHttpRequest()) {
|
||||||
|
return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$output=array();
|
||||||
|
$directory=$request->request->get('directory');
|
||||||
|
|
||||||
|
// Récupération du répertoire source et le nom du fichier
|
||||||
|
$racine=$this->get('kernel')->getRootDir()."/../uploads/file";
|
||||||
|
$directory=$request->request->get('directory');
|
||||||
|
$dirsource =$request->request->get('subdirectory');
|
||||||
|
$namesource =$request->request->get('filename');
|
||||||
|
|
||||||
|
$this->getPermission($access,$directory);
|
||||||
|
$fs = new Filesystem();
|
||||||
|
|
||||||
|
// Déplacer le fichier
|
||||||
|
$urlsource=$racine."/".$directory."/".$dirsource."/".$namesource;
|
||||||
|
$urldestination=$racine."/".$directory."/__trash/".$dirsource."/".$namesource;
|
||||||
|
$fs->mkdir($racine."/".$directory."/__trash/".$dirsource);
|
||||||
|
if($fs->exists($urlsource)) {
|
||||||
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else $fs->rename($urlsource,$urldestination,true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Déplacer le thumb
|
||||||
|
$fs->mkdir($racine."/".$directory."/__trash/".$dirsource."/thumb");
|
||||||
|
$urlsource=$racine."/".$directory."/".$dirsource."/thumb/".$namesource;
|
||||||
|
$urldestination=$racine."/".$directory."/__trash/".$dirsource."/thumb/".$namesource;
|
||||||
|
if($fs->exists($urlsource)) {
|
||||||
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else $fs->rename($urlsource,$urldestination,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Déplacer le thumbmini
|
||||||
|
$fs->mkdir($racine."/".$directory."/__trash/".$dirsource."/thumbmini");
|
||||||
|
$urlsource=$racine."/".$directory."/".$dirsource."/thumbmini/".$namesource;
|
||||||
|
$urldestination=$racine."/".$directory."/__trash/".$dirsource."/thumbmini/".$namesource;
|
||||||
|
if($fs->exists($urlsource)) {
|
||||||
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else $fs->rename($urlsource,$urldestination,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = new Response(json_encode($output));
|
||||||
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function restaureAction(Request $request,$access="config")
|
||||||
|
{
|
||||||
|
// S'assurer que c'est un appel ajax
|
||||||
|
if (!$request->isXmlHttpRequest()) {
|
||||||
|
return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$output=array();
|
||||||
|
$directory=$request->request->get('directory');
|
||||||
|
|
||||||
|
// Récupération du répertoire source et le nom du fichier
|
||||||
|
$racine=$this->get('kernel')->getRootDir()."/../uploads/file";
|
||||||
|
$directory=$request->request->get('directory');
|
||||||
|
$dirsource =$request->request->get('subdirectory');
|
||||||
|
$namesource =$request->request->get('filename');
|
||||||
|
|
||||||
|
$this->getPermission($access,$directory);
|
||||||
|
$fs = new Filesystem();
|
||||||
|
|
||||||
|
// Déplacer le fichier
|
||||||
|
$dirdestination=str_replace("__trash/","",$dirsource);
|
||||||
|
$urlsource=$racine."/".$directory."/".$dirsource."/".$namesource;
|
||||||
|
$urldestination=str_replace("__trash/","/",$urlsource);
|
||||||
|
$fs->mkdir($racine."/".$directory."/".$dirdestination);
|
||||||
|
if($fs->exists($urlsource)) {
|
||||||
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else $fs->rename($urlsource,$urldestination,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Déplacer le thumb
|
||||||
|
$urlsource=$racine."/".$directory."/".$dirsource."/thumb/".$namesource;
|
||||||
|
$urldestination=str_replace("__trash/","/",$urlsource);
|
||||||
|
$fs->mkdir($racine."/".$directory."/".$dirdestination."/thumb");
|
||||||
|
if($fs->exists($urlsource)) {
|
||||||
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else $fs->rename($urlsource,$urldestination,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Déplacer le thumbmini
|
||||||
|
$urlsource=$racine."/".$directory."/".$dirsource."/thumbmini/".$namesource;
|
||||||
|
$urldestination=str_replace("__trash/","/",$urlsource);
|
||||||
|
$fs->mkdir($racine."/".$directory."/".$dirdestination."/thumbmini");
|
||||||
|
if($fs->exists($urlsource)) {
|
||||||
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else $fs->rename($urlsource,$urldestination,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$response = new Response(json_encode($output));
|
||||||
|
$response->headers->set('Content-Type', 'application/json');
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function purgetrashAction($directory,Request $request,$access="config")
|
||||||
|
{
|
||||||
|
$output=array();
|
||||||
|
|
||||||
|
$this->getPermission($access,$directory);
|
||||||
|
$fs = new Filesystem();
|
||||||
|
$url=$this->get('kernel')->getRootDir()."/../uploads/file/".$directory."/__trash";
|
||||||
|
if($fs->exists($url)) {
|
||||||
|
$fs->remove($url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->redirectToRoute('cadoles_core_'.$access.'_file_list',['directory'=>$directory]);
|
||||||
|
}
|
||||||
|
|
||||||
public function deleteAction(Request $request,$access="config")
|
public function deleteAction(Request $request,$access="config")
|
||||||
{
|
{
|
||||||
// S'assurer que c'est un appel ajax
|
// S'assurer que c'est un appel ajax
|
||||||
|
@ -267,7 +408,7 @@ class FileController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$output=array();
|
$output=array();
|
||||||
$directory=$request->request->get('directory');+
|
$directory=$request->request->get('directory');
|
||||||
|
|
||||||
// Récupération du répertoire source et le nom du fichier
|
// Récupération du répertoire source et le nom du fichier
|
||||||
$racine=$this->get('kernel')->getRootDir()."/../uploads/file";
|
$racine=$this->get('kernel')->getRootDir()."/../uploads/file";
|
||||||
|
@ -276,7 +417,6 @@ class FileController extends Controller
|
||||||
$dirdestination =$request->request->get('dirdestination');
|
$dirdestination =$request->request->get('dirdestination');
|
||||||
$namedestination =$request->request->get('namedestination');
|
$namedestination =$request->request->get('namedestination');
|
||||||
|
|
||||||
$destid=$request->request->get('destid');
|
|
||||||
|
|
||||||
$this->getPermission($access,$directory);
|
$this->getPermission($access,$directory);
|
||||||
$fs = new Filesystem();
|
$fs = new Filesystem();
|
||||||
|
@ -285,7 +425,12 @@ class FileController extends Controller
|
||||||
$urlsource=$racine."/".$dirsource."/".$namesource;
|
$urlsource=$racine."/".$dirsource."/".$namesource;
|
||||||
$urldestination=$racine."/".$dirdestination."/".$namedestination;
|
$urldestination=$racine."/".$dirdestination."/".$namedestination;
|
||||||
if($fs->exists($urlsource)) {
|
if($fs->exists($urlsource)) {
|
||||||
$fs->rename($urlsource,$urldestination);
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$fs->rename($urlsource,$urldestination, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Déplacer le thumb
|
// Déplacer le thumb
|
||||||
|
@ -293,7 +438,12 @@ class FileController extends Controller
|
||||||
$urlsource=$racine."/".$dirsource."/thumb/".$namesource;
|
$urlsource=$racine."/".$dirsource."/thumb/".$namesource;
|
||||||
$urldestination=$racine."/".$dirdestination."/thumb/".$namedestination;
|
$urldestination=$racine."/".$dirdestination."/thumb/".$namedestination;
|
||||||
if($fs->exists($urlsource)) {
|
if($fs->exists($urlsource)) {
|
||||||
$fs->rename($urlsource,$urldestination);
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$fs->rename($urlsource,$urldestination, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Déplacer le thumbmini
|
// Déplacer le thumbmini
|
||||||
|
@ -301,7 +451,12 @@ class FileController extends Controller
|
||||||
$urlsource=$racine."/".$dirsource."/thumbmini/".$namesource;
|
$urlsource=$racine."/".$dirsource."/thumbmini/".$namesource;
|
||||||
$urldestination=$racine."/".$dirdestination."/thumbmini/".$namedestination;
|
$urldestination=$racine."/".$dirdestination."/thumbmini/".$namedestination;
|
||||||
if($fs->exists($urlsource)) {
|
if($fs->exists($urlsource)) {
|
||||||
$fs->rename($urlsource,$urldestination);
|
if(is_dir($urlsource)) {
|
||||||
|
$fs->mirror($urlsource,$urldestination);
|
||||||
|
$fs->remove($urlsource);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$fs->rename($urlsource,$urldestination, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new Response(json_encode($output));
|
$response = new Response(json_encode($output));
|
||||||
|
@ -309,6 +464,7 @@ class FileController extends Controller
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function viewAction($directory,$filename,Request $request,$access="config")
|
public function viewAction($directory,$filename,Request $request,$access="config")
|
||||||
{
|
{
|
||||||
$this->getPermission($access,$directory);
|
$this->getPermission($access,$directory);
|
||||||
|
|
|
@ -74,6 +74,18 @@ cadoles_core_config_file_subdirectory:
|
||||||
path: /config/file/subdirectory/{id}/{type}
|
path: /config/file/subdirectory/{id}/{type}
|
||||||
defaults: { _controller: CadolesCoreBundle:File:subdirectory, access: config }
|
defaults: { _controller: CadolesCoreBundle:File:subdirectory, access: config }
|
||||||
|
|
||||||
|
cadoles_core_config_file_trash:
|
||||||
|
path: /config/file/trash/
|
||||||
|
defaults: { _controller: CadolesCoreBundle:File:trash, access: config }
|
||||||
|
|
||||||
|
cadoles_core_config_file_restaure:
|
||||||
|
path: /config/file/restaure/
|
||||||
|
defaults: { _controller: CadolesCoreBundle:File:restaure, access: config }
|
||||||
|
|
||||||
|
cadoles_core_config_file_purgetrash:
|
||||||
|
path: /config/file/purgetrash/{directory}
|
||||||
|
defaults: { _controller: CadolesCoreBundle:File:purgetrash, access: config }
|
||||||
|
|
||||||
cadoles_core_config_file_delete:
|
cadoles_core_config_file_delete:
|
||||||
path: /config/file/delete/
|
path: /config/file/delete/
|
||||||
defaults: { _controller: CadolesCoreBundle:File:delete, access: config }
|
defaults: { _controller: CadolesCoreBundle:File:delete, access: config }
|
||||||
|
@ -107,6 +119,18 @@ cadoles_core_user_file_subdirectory:
|
||||||
path: /user/file/subdirectory/{id}/{type}
|
path: /user/file/subdirectory/{id}/{type}
|
||||||
defaults: { _controller: CadolesCoreBundle:File:subdirectory, access: user }
|
defaults: { _controller: CadolesCoreBundle:File:subdirectory, access: user }
|
||||||
|
|
||||||
|
cadoles_core_user_file_trash:
|
||||||
|
path: /user/file/trash/
|
||||||
|
defaults: { _controller: CadolesCoreBundle:File:trash, access: user }
|
||||||
|
|
||||||
|
cadoles_core_user_file_restaure:
|
||||||
|
path: /user/file/restaure/
|
||||||
|
defaults: { _controller: CadolesCoreBundle:File:restaure, access: user }
|
||||||
|
|
||||||
|
cadoles_core_user_file_purgetrash:
|
||||||
|
path: /user/file/purgetrash/{directory}
|
||||||
|
defaults: { _controller: CadolesCoreBundle:File:purgetrash, access: user }
|
||||||
|
|
||||||
cadoles_core_user_file_delete:
|
cadoles_core_user_file_delete:
|
||||||
path: /user/file/delete
|
path: /user/file/delete
|
||||||
defaults: { _controller: CadolesCoreBundle:File:delete, access: user }
|
defaults: { _controller: CadolesCoreBundle:File:delete, access: user }
|
||||||
|
@ -128,6 +152,7 @@ cadoles_core_user_file_show:
|
||||||
defaults: { _controller: CadolesCoreBundle:File:show, access: user }
|
defaults: { _controller: CadolesCoreBundle:File:show, access: user }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#== Ajax =================================================================================================================
|
#== Ajax =================================================================================================================
|
||||||
cadoles_core_ajax_country_list:
|
cadoles_core_ajax_country_list:
|
||||||
path: /ajax/country/list
|
path: /ajax/country/list
|
||||||
|
|
|
@ -381,6 +381,15 @@ a.item-update {
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
a.item-restaure {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
right: 25px;
|
||||||
|
top: 2px;
|
||||||
|
z-index: 1000;
|
||||||
|
}
|
||||||
|
|
||||||
a.item-delete {
|
a.item-delete {
|
||||||
display: none;
|
display: none;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
<div id="explorer">
|
<div id="explorer">
|
||||||
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups" style="margin-top:5px">
|
<div class="btn-toolbar" role="toolbar" aria-label="Toolbar with button groups" style="margin-top:5px">
|
||||||
{% if canupdate %}
|
{% if canupdate and not fgtrash %}
|
||||||
<div class="btn-group mr-2" role="group" aria-label="First group">
|
<div class="btn-group mr-2" role="group" aria-label="First group">
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Téléchargez vos Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': directory,'type':'all','subdirectory':subdirectory}) }}');" title="Ajouter des fichiers">
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Téléchargez vos Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': directory,'type':'all','subdirectory':subdirectory}) }}');" title="Ajouter des fichiers">
|
||||||
<i class="fa fa-upload"></i>
|
<i class="fa fa-upload"></i>
|
||||||
|
@ -49,7 +49,6 @@
|
||||||
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Création Répertoire','{{ path('cadoles_core_'~access~'_file_subdirectory',{'id': directory,'type':'all','subdirectory':subdirectory}) }}');" title="Ajouter un Répertoire">
|
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Création Répertoire','{{ path('cadoles_core_'~access~'_file_subdirectory',{'id': directory,'type':'all','subdirectory':subdirectory}) }}');" title="Ajouter un Répertoire">
|
||||||
<i class="fa fa-folder-plus"></i>
|
<i class="fa fa-folder-plus"></i>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -88,6 +87,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="btn-group mr-2" role="group" aria-label="Third group">
|
||||||
|
<a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':'__trash' }) }}" type="button" class="btn btn-primary"><i class="fas fa-trash"></i></a>
|
||||||
|
{% if fgtrash %}
|
||||||
|
<a href="{{ path('cadoles_core_'~access~'_file_purgetrash',{'directory':directory }) }}" type="button" class="btn btn-primary" data-method="delete" data-confirm="Souhaitez-vous purger votre poubelle ? Cette action sera irrévocable.">Purger la poubelle</a>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,11 +111,13 @@
|
||||||
{% set sub = sub~"/"~parent %}
|
{% set sub = sub~"/"~parent %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class="brea.dcrumb-item directory" data-dir="{{datadir}}" data-name="{{ parent }}"><a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':sub }) }}">{{parent|raw}}</a></li>
|
{% set tmpdirname = parent|replace({'__trash': 'Poubelle'}) %}
|
||||||
|
<li class="brea.dcrumb-item directory" data-dir="{{datadir}}" data-name="{{ parent }}"><a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':sub }) }}">{{tmpdirname|raw}}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% if not subdirectory is empty %}
|
{% if not subdirectory is empty %}
|
||||||
<li class="breadcrumb-item directory" data-dir="{{directory}}/{{sub}}" data-name="{{dirname}}"><a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':subdirectory }) }}">{{dirname|raw}}</a></li>
|
{% set tmpdirname = dirname|replace({'__trash': 'Poubelle'}) %}
|
||||||
|
<li class="breadcrumb-item directory" data-dir="{{directory}}/{{sub}}" data-name="{{dirname}}"><a href="{{ path('cadoles_core_'~access~'_file_list',{'directory':directory,'subdirectory':subdirectory }) }}">{{tmpdirname|raw}}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</ol>
|
</ol>
|
||||||
|
@ -124,9 +133,19 @@
|
||||||
<div id="{{dir.name|e('js')|raw }}" class="grid-item grid-{{view}} directory" data-dir="{{directory}}/{{subdirectory}}" data-name="{{dir.name}}">
|
<div id="{{dir.name|e('js')|raw }}" class="grid-item grid-{{view}} directory" data-dir="{{directory}}/{{subdirectory}}" data-name="{{dir.name}}">
|
||||||
<div class="grid-item-content">
|
<div class="grid-item-content">
|
||||||
{% if canadd %}
|
{% if canadd %}
|
||||||
|
{% if fgtrash %}
|
||||||
|
<a style="cursor:pointer;" onClick="restaureFile('{{ directory }}','{{subdirectory}}','{{dir.name|e('js')|raw }}')" class="item-restaure">
|
||||||
|
<i class="fa fa-undo" title="Restaurer le fichier"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
<a style="cursor:pointer;" onClick="delFile('{{ directory }}','{{subdirectory}}','{{dir.name|e('js')|raw }}')" class="item-delete">
|
<a style="cursor:pointer;" onClick="delFile('{{ directory }}','{{subdirectory}}','{{dir.name|e('js')|raw }}')" class="item-delete">
|
||||||
<i class="fa fa-trash" title="Supprimer le dossier"></i>
|
<i class="fa fa-trash" title="Supprimer le dossier"></i>
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a style="cursor:pointer;" onClick="trashFile('{{ directory }}','{{subdirectory}}','{{dir.name|e('js')|raw }}')" class="item-delete">
|
||||||
|
<i class="fa fa-trash" title="Supprimer le dossier"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if subdirectory is empty %}
|
{% if subdirectory is empty %}
|
||||||
|
@ -153,9 +172,19 @@
|
||||||
<div class="grid-item grid-{{view}} file" data-dir="{{directory}}/{{subdirectory}}" data-name="{{file.name}}">
|
<div class="grid-item grid-{{view}} file" data-dir="{{directory}}/{{subdirectory}}" data-name="{{file.name}}">
|
||||||
<div class="grid-item-content">
|
<div class="grid-item-content">
|
||||||
{% if canadd %}
|
{% if canadd %}
|
||||||
|
{% if fgtrash %}
|
||||||
|
<a style="cursor:pointer;" onClick="restaureFile('{{ directory }}','{{subdirectory}}','{{file.name|e('js')|raw }}')" class="item-restaure">
|
||||||
|
<i class="fa fa-undo" title="Restaurer le fichier"></i>
|
||||||
|
</a>
|
||||||
|
|
||||||
<a style="cursor:pointer;" onClick="delFile('{{ directory }}','{{subdirectory}}','{{file.name|e('js')|raw }}')" class="item-delete">
|
<a style="cursor:pointer;" onClick="delFile('{{ directory }}','{{subdirectory}}','{{file.name|e('js')|raw }}')" class="item-delete">
|
||||||
<i class="fa fa-trash" title="Supprimer le fichier"></i>
|
<i class="fa fa-trash" title="Supprimer le fichier"></i>
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<a style="cursor:pointer;" onClick="trashFile('{{ directory }}','{{subdirectory}}','{{file.name|e('js')|raw }}')" class="item-delete">
|
||||||
|
<i class="fa fa-trash" title="Supprimer le fichier"></i>
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %}
|
{% if file.minefamily=="text" or file.minefamily=="image" or file.minetype == "application/pdf" %}
|
||||||
|
@ -207,6 +236,8 @@
|
||||||
}
|
}
|
||||||
$(".item-delete").css("color",color);
|
$(".item-delete").css("color",color);
|
||||||
$(".item-delete > i").css("color",color);
|
$(".item-delete > i").css("color",color);
|
||||||
|
$(".item-restaure").css("color",color);
|
||||||
|
$(".item-restaure > i").css("color",color);
|
||||||
$(".grid-item-title > h2").css("color",color);
|
$(".grid-item-title > h2").css("color",color);
|
||||||
|
|
||||||
$('#mymodal').on('shown.bs.modal', function() {
|
$('#mymodal').on('shown.bs.modal', function() {
|
||||||
|
@ -293,9 +324,47 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Trasher un fichier
|
||||||
|
function trashFile(directory,subdirectory,filename) {
|
||||||
|
var r = confirm("Confirmez-vous la mise à la poubelle de ce fichier ? Vous pourrez le récupèrer si besoin.");
|
||||||
|
if (r == true) {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "{{ path('cadoles_core_'~access~'_file_trash') }}",
|
||||||
|
data: {
|
||||||
|
directory:directory,
|
||||||
|
subdirectory:subdirectory,
|
||||||
|
filename:filename
|
||||||
|
},
|
||||||
|
success: function() {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Restaurer un fichier
|
||||||
|
function restaureFile(directory,subdirectory,filename) {
|
||||||
|
var r = confirm("Confirmez-vous la restauration de ce fichier ?");
|
||||||
|
if (r == true) {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "{{ path('cadoles_core_'~access~'_file_restaure') }}",
|
||||||
|
data: {
|
||||||
|
directory:directory,
|
||||||
|
subdirectory:subdirectory,
|
||||||
|
filename:filename
|
||||||
|
},
|
||||||
|
success: function() {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Supprimer un fichier
|
// Supprimer un fichier
|
||||||
function delFile(directory,subdirectory,filename) {
|
function delFile(directory,subdirectory,filename) {
|
||||||
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
|
var r = confirm("Confirmez-vous la suppression définitive de ce fichier ?");
|
||||||
if (r == true) {
|
if (r == true) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
@ -217,6 +217,7 @@
|
||||||
$( ".grid-item-content").hover(function() {
|
$( ".grid-item-content").hover(function() {
|
||||||
$(this).children(".item-heart").show();
|
$(this).children(".item-heart").show();
|
||||||
$(this).children(".item-delete").show();
|
$(this).children(".item-delete").show();
|
||||||
|
$(this).children(".item-restaure").show();
|
||||||
$(this).children(".item-update").show();
|
$(this).children(".item-update").show();
|
||||||
$(this).children(".item-preview").show();
|
$(this).children(".item-preview").show();
|
||||||
});
|
});
|
||||||
|
@ -224,6 +225,7 @@
|
||||||
$( ".grid-item-content" ).mouseleave(function() {
|
$( ".grid-item-content" ).mouseleave(function() {
|
||||||
$(this).children(".item-heart").hide();
|
$(this).children(".item-heart").hide();
|
||||||
$(this).children(".item-delete").hide();
|
$(this).children(".item-delete").hide();
|
||||||
|
$(this).children(".item-restaure").hide();
|
||||||
$(this).children(".item-update").hide();
|
$(this).children(".item-update").hide();
|
||||||
$(this).children(".item-preview").hide();
|
$(this).children(".item-preview").hide();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue