jquery pour désactiver les sélecteurs de filemanager

This commit is contained in:
Fred Tempez 2023-05-11 18:33:25 +02:00
parent ab46dd9ab2
commit c57b0e26e5
5 changed files with 101 additions and 24 deletions

View File

@ -12,12 +12,13 @@
*/
$(document).ready(function(){
$(document).ready(function () {
$(".userEditGroupProfil").hide();
$("#userEditGroupProfil" + $("#userEditGroup").val()).show();
});
$("#userEditGroup").on("change", function() {
$(".userEditGroupProfil").hide();
$("#userEditGroupProfil" + $(this).val()).show();
}).trigger("change");
$("#userEditGroup").on("change", function () {
$(".userEditGroupProfil").hide();
$("#userEditGroupProfil" + $(this).val()).show();
});
});

View File

@ -0,0 +1,29 @@
/**
* This file is part of Zwii.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$(document).ready(function () {
// Désactive tous les éléments de la classe "filemanager" si le checkbox avec l'id "profilEditFileManager" est décoché au chargement de la page
if (!$("#profilAddFileManager").prop("checked")) {
$(".filemanager").prop("disabled", true);
}
// À chaque inversion de l'état du checkbox avec l'id "profilEditFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état
$("#profilAddFileManager").change(function () {
if (!$(this).prop("checked")) {
$(".filemanager").prop("disabled", true);
} else {
$(".filemanager").prop("disabled", false);
}
});
});

View File

@ -56,7 +56,8 @@
</div>
<div class="col6">
<?php echo template::select('profilAddPath', $module::$sharePath, [
'label' => 'Racine du dossier'
'label' => 'Racine du dossier',
'class' => 'filemanager',
]); ?>
</div>
</div>
@ -68,19 +69,19 @@
</h4>
<div class="row">
<div class="col2">
<?php echo template::checkbox('profilAddFolderCreate', true, 'Création'); ?>
<?php echo template::checkbox('profilAddFolderCreate', true, 'Création', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddFolderDelete', true, 'Effacement', ); ?>
<?php echo template::checkbox('profilAddFolderDelete', true, 'Effacement', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddFolderRename', true, 'Nommage'); ?>
<?php echo template::checkbox('profilAddFolderRename', true, 'Nommage', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddFolderCopycut', true, 'Coupé collé'); ?>
<?php echo template::checkbox('profilAddFolderCopycut', true, 'Coupé collé', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddFolderChmod', true, 'Droits sur les dossiers'); ?>
<?php echo template::checkbox('profilAddFolderChmod', true, 'Droits sur les dossiers', ['class' => 'filemanager']); ?>
</div>
</div>
</div>
@ -94,39 +95,39 @@
</h4>
<div class="row">
<div class="col2">
<?php echo template::checkbox('profilAddDownload', true, 'Téléchargement'); ?>
<?php echo template::checkbox('profilAddDownload', true, 'Téléchargement', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddEdit', true, 'Edition'); ?>
<?php echo template::checkbox('profilAddEdit', true, 'Edition', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddCreate', true, 'Création'); ?>
<?php echo template::checkbox('profilAddCreate', true, 'Création', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddRename', true, 'Nommage'); ?>
<?php echo template::checkbox('profilAddRename', true, 'Nommage', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddUpload', true, 'Téléversement'); ?>
<?php echo template::checkbox('profilAddUpload', true, 'Téléversement', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddDelete', true, 'Effacement'); ?>
<?php echo template::checkbox('profilAddDelete', true, 'Effacement', ['class' => 'filemanager']); ?>
</div>
</div>
<div class="row">
<div class="col2">
<?php echo template::checkbox('profilAddPreview', true, 'Prévisualisation'); ?>
<?php echo template::checkbox('profilAddPreview', true, 'Prévisualisation', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddDuplicate', true, 'Duplication'); ?>
<?php echo template::checkbox('profilAddDuplicate', true, 'Duplication', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddExtract', true, 'Extraction'); ?>
<?php echo template::checkbox('profilAddExtract', true, 'Extraction', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddCopycut', true, 'Coupé collé'); ?>
<?php echo template::checkbox('profilAddCopycut', true, 'Coupé collé', ['class' => 'filemanager']); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilAddChmod', true, 'Droits sur les fichiers'); ?>
<?php echo template::checkbox('profilAddChmod', true, 'Droits sur les fichiers', ['class' => 'filemanager']); ?>
</div>
</div>
</div>

View File

@ -0,0 +1,29 @@
/**
* This file is part of Zwii.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
$(document).ready(function () {
// Désactive tous les éléments de la classe "filemanager" si le checkbox avec l'id "profilEditFileManager" est décoché au chargement de la page
if (!$("#profilEditFileManager").prop("checked")) {
$(".filemanager").prop("disabled", true);
}
// À chaque inversion de l'état du checkbox avec l'id "profilEditFileManager", désactive ou active tous les éléments de la classe "filemanager" en fonction de l'état
$("#profilEditFileManager").change(function () {
if (!$(this).prop("checked")) {
$(".filemanager").prop("disabled", true);
} else {
$(".filemanager").prop("disabled", false);
}
});
});

View File

@ -59,6 +59,7 @@
<div class="col6">
<?php echo template::select('profilEditPath', $module::$sharePath, [
'label' => 'Racine du dossier',
'class' => 'filemanager',
'selected' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'path'])
]); ?>
</div>
@ -72,26 +73,31 @@
<div class="row">
<div class="col2">
<?php echo template::checkbox('profilEditFolderCreate', true, 'Création', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'create'])
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'create']),
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditFolderDelete', true, 'Effacement', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'delete'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditFolderRename', true, 'Nommage', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'rename'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditFolderCopycut', true, 'Coupé collé', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'copycut'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditFolderChmod', true, 'Droits sur les dossiers', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'folder', 'chmod'])
]); ?>
</div>
@ -108,31 +114,37 @@
<div class="row">
<div class="col2">
<?php echo template::checkbox('profilEditDownload', true, 'Téléchargement', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'download'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditEdit', true, 'Edition', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'edit'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditCreate', true, 'Création', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'create'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditRename', true, 'Nommage', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'rename'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditUpload', true, 'Téléversement', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'upload'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditDelete', true, 'Effacement', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'delete'])
]); ?>
</div>
@ -140,26 +152,31 @@
<div class="row">
<div class="col2">
<?php echo template::checkbox('profilEditPreview', true, 'Prévisualisation', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'preview'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditDuplicate', true, 'Duplication', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'duplicate'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditExtract', true, 'Extraction', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'extract'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditCopycut', true, 'Coupé collé', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'copycut'])
]); ?>
</div>
<div class="col2">
<?php echo template::checkbox('profilEditChmod', true, 'Droits sur les fichiers', [
'class' => 'filemanager',
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'file', 'chmod'])
]); ?>
</div>