1.6.02 routeur d'espace dans la config de RFM WIP

This commit is contained in:
Fred Tempez 2024-02-29 15:37:29 +01:00
parent d2dc4c64c0
commit fc197b647d
4 changed files with 26 additions and 9 deletions

View File

@ -142,6 +142,7 @@ class JsonDb extends \Prowebcraft\Dot
*/ */
public function save() public function save()
{ {
/// $v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT | JSON_PRETTY_PRINT);
$v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT); $v = json_encode($this->data, JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
$l = strlen($v); $l = strlen($v);
$t = 0; $t = 0;

View File

@ -352,7 +352,8 @@ class layout extends common
$items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>'; $items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>';
$items .= '<wbr>&nbsp;|&nbsp;'; $items .= '<wbr>&nbsp;|&nbsp;';
if ( if (
$this->getUser('permission', 'filemanager') === true $this->getUser('permission', 'filemanager') === true
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none'
) { ) {
$items .= '<wbr>' . template::ico('folder', [ $items .= '<wbr>' . template::ico('folder', [
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']),
@ -519,7 +520,8 @@ class layout extends common
) { ) {
// Affiche l'icône RFM // Affiche l'icône RFM
if ($this->getUser('permission', 'filemanager') === true) { if ($this->getUser('permission', 'filemanager') === true
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none') {
$itemsRight .= '<li>' . template::ico('folder', [ $itemsRight .= '<li>' . template::ico('folder', [
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']),
'attr' => 'data-lity', 'attr' => 'data-lity',
@ -1060,7 +1062,8 @@ class layout extends common
if ( if (
( (
$this->getUser('group') === self::GROUP_EDITOR $this->getUser('group') === self::GROUP_EDITOR
&& $this->getUser('permission', 'filemanager') && $this->getUser('permission', 'filemanager') === true
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none'
) )
|| $this->getUser('group') === self::GROUP_ADMIN || $this->getUser('group') === self::GROUP_ADMIN
) { ) {

View File

@ -760,16 +760,18 @@ class user extends common
self::$sharePath = $this->getSubdirectories('./site/file/source'); self::$sharePath = $this->getSubdirectories('./site/file/source');
// Exclure les espaces des cours // Exclure les espaces des cours
/*
foreach (array_keys($this->getData(['course'])) as $courseId) { foreach (array_keys($this->getData(['course'])) as $courseId) {
self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) { self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) {
return strpos($key, $courseId) === false; return strpos($key, $courseId) === false;
}); });
} }
*/
self::$sharePath = array_flip(self::$sharePath); self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tout le gestionnaire de fichiers'], self::$sharePath); self::$sharePath = array_merge(['none' => 'Aucun Accès'], self::$sharePath);
// self::$sharePath = array_merge(['' => 'Aucun dossier'], self::$sharePath);
self::$sharePath = array_merge(['' => 'Confiné dans le dossier de l\'espace ouvert'], self::$sharePath); self::$sharePath = array_merge(['' => 'Confiné dans le dossier de l\'espace ouvert'], self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tout le gestionnaire de fichiers'], self::$sharePath);
// Liste des modules installés // Liste des modules installés
self::$listModules = helper::getModules(); self::$listModules = helper::getModules();
@ -960,16 +962,18 @@ class user extends common
self::$sharePath = $this->getSubdirectories('./site/file/source'); self::$sharePath = $this->getSubdirectories('./site/file/source');
// Exclure les espaces des cours // Exclure les espaces des cours
/*
foreach (array_keys($this->getData(['course'])) as $courseId) { foreach (array_keys($this->getData(['course'])) as $courseId) {
self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) { self::$sharePath = array_filter(self::$sharePath, function ($key) use ($courseId) {
return strpos($key, $courseId) === false; return strpos($key, $courseId) === false;
}); });
} }
*/
self::$sharePath = array_flip(self::$sharePath); self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tout le gestionnaire de fichiers'], self::$sharePath); self::$sharePath = array_merge(['none' => 'Aucun Accès'], self::$sharePath);
//self::$sharePath = array_merge(['' => 'Aucun dossier'], self::$sharePath);
self::$sharePath = array_merge(['' => 'Confiné dans le dossier de l\'espace ouvert'], self::$sharePath); self::$sharePath = array_merge(['' => 'Confiné dans le dossier de l\'espace ouvert'], self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tout le gestionnaire de fichiers'], self::$sharePath);
// Liste des modules installés // Liste des modules installés
self::$listModules = helper::getModules(); self::$listModules = helper::getModules();

View File

@ -96,14 +96,23 @@
<?php echo template::select('profilEditCoursePath', $module::$sharePath, [ <?php echo template::select('profilEditCoursePath', $module::$sharePath, [
'label' => 'Dossier depuis un espace', 'label' => 'Dossier depuis un espace',
'class' => 'filemanager', 'class' => 'filemanager',
'selected' => '.' . $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'coursePath']), /*
* 'none' interdit l'accès au gestionnaire de fichier
* Ce n'est pas un chemin donc on n'ajoute pas le .
*/
'selected' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'coursePath']) !== 'none'
? '.' . $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'coursePath'])
: $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'coursePath'])
]); ?> ]); ?>
</div> </div>
<div class="col5"> <div class="col5">
<?php echo template::select('profilEditHomePath', $module::$sharePath, [ <?php echo template::select('profilEditHomePath', $module::$sharePath, [
'label' => 'Dossier depuis l\'accueil', 'label' => 'Dossier depuis l\'accueil',
'class' => 'filemanager', 'class' => 'filemanager',
'selected' => '.' . $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'homePath']), // 'none' interdit l'accès au gestionnaire de fichier au niveau de l'accueil
'selected' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'homePath']) !== 'none'
? '.' . $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'homePath'])
: $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'homePath'])
]); ?> ]); ?>
</div> </div>
</div> </div>