This commit is contained in:
Fred Tempez 2023-12-14 13:44:24 +01:00
parent b1c8ea8047
commit 729152bef1
6 changed files with 180 additions and 171 deletions

View File

@ -1033,6 +1033,9 @@ class layout extends common
$rightItems = '';
if (
$this->getUser('group') >= self::GROUP_EDITOR
// ZwiiCampus ------
&& self::$siteContent !== 'home'
// ZwiiCampus ------
&& $this->getUser(
'permission',
'filemanager'

View File

@ -177,6 +177,9 @@ class course extends common
]
]);
// Dossier du gestionnaire de fichier
mkdir(self::FILE_DIR . 'source/' . $courseId);
// Copie du thème
$sourceId = $this->getInput('courseAddTheme');
copy(self::DATA_DIR . $sourceId . '/theme.json', self::DATA_DIR . $courseId . '/theme.json');
@ -303,6 +306,11 @@ class course extends common
$success = $this->deleteDir(self::DATA_DIR . $courseId);
$this->deleteData(['course', $courseId]);
$this->deleteData(['enrolment', $courseId]);
}
// Dossier du gestionnaire de fichier
if (is_dir(self::FILE_DIR . 'source/' . $courseId)) {
$this->deleteDir(self::FILE_DIR . 'source/' . $courseId);
}
// Valeurs en sortie

View File

@ -17,7 +17,7 @@ $(document).ready(function () {
*/
$(".courseDelete").on("click", function () {
var _this = $(this);
var message = "<?php echo helper::translate('Supprimer cet espace ?'); ?>";
var message = "<?php echo helper::translate('Supprimer cet espace et les documents du gestionnaire de fichier ?'); ?>";
return core.confirm(message, function () {
$(location).attr("href", _this.attr("href"));
});

View File

@ -414,7 +414,7 @@ class init extends common
'copycut' => false,
'chmod' => false,
'share' => true,
'path' => './site/file/source/partage/',
'path' => '',
],
'page' => [
'add' => false,
@ -496,7 +496,7 @@ class init extends common
'copycut' => true,
'chmod' => true,
'share' => true,
'path' => './site/file/source/partage/',
'path' => '',
],
'page' => [
'add' => true,

View File

@ -651,11 +651,9 @@ class user extends common
$oldProfil = $this->getInput('profilEditOldProfil', helper::FILTER_STRING_SHORT);
// Gère le chemin
$fileManager = $this->getInput('profilEditFileManager', helper::FILTER_BOOLEAN);
$path = $this->getInput('profilEditPath');
// Sécurité supplémentaire
if (
$group <= self::GROUP_ADMIN
&& $fileManager
&& empty($path)
$group < self::GROUP_EDITOR
) {
$fileManager = false;
}
@ -691,7 +689,7 @@ class user extends common
'rename' => $this->getInput('profilEditFolderRename', helper::FILTER_BOOLEAN),
'copycut' => $this->getInput('profilEditFolderCopycut', helper::FILTER_BOOLEAN),
'chmod' => $this->getInput('profilEditFolderChmod', helper::FILTER_BOOLEAN),
'path' => $path,
'path' => $this->getInput('profilEditPath'),
],
'page' => [
'add' => $this->getInput('profilEditPageAdd', helper::FILTER_BOOLEAN),
@ -740,13 +738,8 @@ class user extends common
self::$sharePath = $this->getSubdirectories('./site/file/source');
self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tous les dossiers'], self::$sharePath);
self::$sharePath = array_merge([null => 'Aucun dossier'], self::$sharePath);
// Chemin vers les dossiers du gestionnaire de fichier
self::$sharePath = $this->getSubdirectories('./site/file/source');
self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tous les dossiers'], self::$sharePath);
self::$sharePath = array_merge([null => 'Aucun dossier'], self::$sharePath);
//self::$sharePath = array_merge(['' => 'Aucun dossier'], self::$sharePath);
self::$sharePath = array_merge(['' => 'Dossier du cours'], self::$sharePath);
// Liste des modules installés
self::$listModules = helper::getModules();
@ -809,11 +802,9 @@ class user extends common
$profil = count($this->getData(['profil', $group]));
// Gère le chemin
$fileManager = $this->getInput('profilAddFileManager', helper::FILTER_BOOLEAN);
$path = $this->getInput('profilAddPath');
// Sécurité supplémentaire
if (
$group <= self::GROUP_ADMIN
&& $fileManager
&& empty($path)
$group < self::GROUP_EDITOR
) {
$fileManager = false;
}
@ -846,7 +837,7 @@ class user extends common
'rename' => $this->getInput('profilAddFolderRename', helper::FILTER_BOOLEAN),
'copycut' => $this->getInput('profilAddFolderCopycut', helper::FILTER_BOOLEAN),
'chmod' => $this->getInput('profilAddFolderChmod', helper::FILTER_BOOLEAN),
'path' => $path,
'path' => $this->getInput('profilAddPath'),
],
'page' => [
'add' => $this->getInput('profilAddPageAdd', helper::FILTER_BOOLEAN),
@ -903,13 +894,8 @@ class user extends common
self::$sharePath = $this->getSubdirectories('./site/file/source');
self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tous les dossiers'], self::$sharePath);
self::$sharePath = array_merge([null => 'Aucun dossier'], self::$sharePath);
// Chemin vers les dossiers du gestionnaire de fichier
self::$sharePath = $this->getSubdirectories('./site/file/source');
self::$sharePath = array_flip(self::$sharePath);
self::$sharePath = array_merge(['./site/file/source/' => 'Tous les dossiers'], self::$sharePath);
self::$sharePath = array_merge([null => 'Aucun dossier'], self::$sharePath);
//self::$sharePath = array_merge(['' => 'Aucun dossier'], self::$sharePath);
self::$sharePath = array_merge(['' => 'Dossier du cours'], self::$sharePath);
// Liste des modules installés
self::$listModules = helper::getModules();

View File

@ -19,6 +19,7 @@ setlocale(LC_CTYPE, $lang);
/* Lecture du groupe de l'utilisateur connecté pour attribuer les droits et les dossiers */
$userId = $_COOKIE['ZWII_USER_ID'];
$courseId = $_COOKIE['ZWII_SITE_CONTENT'];
$u = json_decode(file_get_contents('../../../site/data/user.json'), true);
$g = json_decode(file_get_contents('../../../site/data/profil.json'), true);
@ -57,7 +58,18 @@ if (!is_null($u) && !is_null($g) && !is_null($userId)) {
if (!is_null($profil)) {
$file = $g['profil'][$group][$profil]['file'];
$folder = $g['profil'][$group][$profil]['folder'];
$uploadDir = './site/file/source/';
// Pointe vers le dossier du cours
if (
isset($courseId)
&& $courseId != 'home'
&& $g['profil'][$group][$profil]['folder']['path'] === ''
) {
$uploadDir = './site/file/source/' . $courseId . '/';
} else {
$uploadDir = $g['profil'][$group][$profil]['folder']['path'];
}
$currentPath = '../../../' . $uploadDir;
if (!is_dir($currentPath)) {
mkdir($currentPath);