path select WIP

This commit is contained in:
Fred Tempez 2023-03-22 17:46:08 +01:00
parent 95c8b7a975
commit 39e27d5082
2 changed files with 130 additions and 90 deletions

View File

@ -56,6 +56,10 @@ class user extends common
public static $languagesInstalled = [];
public static $sharePath = [
'/site/file/source/'
];
/**
* Ajout
*/
@ -488,12 +492,15 @@ class user extends common
]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'user/group',
'redirect' => helper::baseUrl() . 'user/group',
'notification' => helper::translate('Modifications enregistrées'),
'state' => true
]);
}
self::$sharePath = $this->getSubdirectories('./site/file/source');
self::$sharePath = array_flip(self::$sharePath);
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Editer groupe'),
@ -618,7 +625,7 @@ class user extends common
}
// Cas 3 le délai de bloquage court
if ($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout']) > time()) {
$notification = sprintf(helper::translate('Accès bloqué %d minutes', ($this->getData(['config', 'connect', 'timeout']) / 60)));
$notification = sprintf(helper::translate('Accès bloqué %d minutes'), ($this->getData(['config', 'connect', 'timeout']) / 60));
}
// Valeurs en sortie
@ -878,4 +885,35 @@ class user extends common
exit();
}
/**
* Liste les dossier contenus dans RFM
*/
function getSubdirectories($dir, $basePath = '') {
$subdirs = array();
// Ouvrez le répertoire spécifié
$dh = opendir($dir);
// Parcourez tous les fichiers et répertoires dans le répertoire
while (($file = readdir($dh)) !== false) {
// Ignorer les entrées de répertoire parent et actuel
if ($file == '.' || $file == '..') {
continue;
}
// Construisez le chemin complet du fichier ou du répertoire
$path = $dir . '/' . $file;
// Vérifiez si c'est un répertoire
if (is_dir($path)) {
// Construisez la clé et la valeur pour le tableau associatif
$key = $basePath . '/' . $file;
$value = $path . '/';
// Ajouter la clé et la valeur au tableau associatif
$subdirs[$key] = $value;
// Appeler la fonction récursivement pour ajouter les sous-répertoires
$subdirs = array_merge($subdirs, $this->getSubdirectories($path, $key));
}
}
// Fermez le gestionnaire de dossier
closedir($dh);
return $subdirs;
}
}

View File

@ -18,66 +18,62 @@
<?php echo helper::translate('Opérations sur les fichiers'); ?>
</h4>
<div class="row">
<div class="col12">
<div class="row">
<div class="col2">
<?php echo template::checkbox('groupEditDownload', true, 'Téléchargement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'download'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditEdit', true, 'Edition', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'edit'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditCreate', true, 'Création', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'create'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditRename', true, 'Nommage', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'rename'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditUpload', true, 'Téléversement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'upload'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditDelete', true, 'Effacement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'delete'])
]); ?>
</div>
</div>
<div class="row">
<div class="col2">
<?php echo template::checkbox('groupEditPreview', true, 'Prévisualisation', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'preview'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditDuplicate', true, 'Duplication', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'duplicate'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditExtract', true, 'Extraction', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'extract'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditCopycut', true, 'Coupé collé', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'copycut'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditPermission', true, 'Permissions', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'permission'])
]); ?>
</div>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditDownload', true, 'Téléchargement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'download'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditEdit', true, 'Edition', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'edit'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditCreate', true, 'Création', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'create'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditRename', true, 'Nommage', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'rename'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditUpload', true, 'Téléversement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'upload'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditDelete', true, 'Effacement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'delete'])
]); ?>
</div>
</div>
<div class="row">
<div class="col2">
<?php echo template::checkbox('groupEditPreview', true, 'Prévisualisation', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'preview'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditDuplicate', true, 'Duplication', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'duplicate'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditExtract', true, 'Extraction', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'extract'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditCopycut', true, 'Coupé collé', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'copycut'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditPermission', true, 'Permissions', [
'checked' => $this->getData(['group', $this->getUrl(2), 'file', 'permission'])
]); ?>
</div>
</div>
</div>
@ -90,34 +86,40 @@
<?php echo helper::translate('Opérations sur les dossiers'); ?>
</h4>
<div class="row">
<div class="col12">
<div class="row">
<div class="col2">
<?php echo template::checkbox('groupEditFolderCreate', true, 'Création', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'create'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderDelete', true, 'Effacement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'delete'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderRename', true, 'Nommage', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'rename'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderCopycut', true, 'Coupé collé', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'copycut'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderPermission', true, 'Permissions', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'permission'])
]); ?>
</div>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderCreate', true, 'Création', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'create'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderDelete', true, 'Effacement', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'delete'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderRename', true, 'Nommage', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'rename'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderCopycut', true, 'Coupé collé', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'copycut'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('groupEditFolderPermission', true, 'Permissions', [
'checked' => $this->getData(['group', $this->getUrl(2), 'folder', 'permission'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::select('connectAttempt', $module::$sharePath, [
'label' => 'Racinde du dossier partagé',
'selected' => $this->getData(['group', $this->getUrl(2), 'path'])
]); ?>
</div>
</div>
</div>