This commit is contained in:
Fred Tempez 2023-11-09 08:48:04 +01:00
commit c41c504afd
7 changed files with 206 additions and 78 deletions

View File

@ -50,7 +50,7 @@ class common
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '1.0.69';
const ZWII_VERSION = '1.0.72';
// URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/campus-update/raw/branch/master/';

View File

@ -26,6 +26,7 @@ class course extends common
'delete' => self::GROUP_ADMIN,
'category' => self::GROUP_ADMIN,
'categoryAdd' => self::GROUP_ADMIN,
'categoryEdit' => self::GROUP_ADMIN,
'categoryDelete' => self::GROUP_ADMIN,
'user' => self::GROUP_ADMIN,
'userAdd' => self::GROUP_ADMIN,
@ -312,13 +313,11 @@ class course extends common
self::$courseCategories[] = [
$categoryId,
$categoryTitle,
/**
template::button('categoryEdit' . $categoryId, [
'href' => helper::baseUrl() . 'course/categoryEdit/' . $categoryId,
'value' => template::ico('pencil'),
'help' => 'Éditer'
]),
*/
template::button('courseDelete' . $categoryId, [
'class' => 'categoryDelete buttonRed',
'href' => helper::baseUrl() . 'course/categoryDelete/' . $categoryId,
@ -363,6 +362,35 @@ class course extends common
]);
}
public function categoryEdit()
{
// Soumission du formulaire
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
$this->isPost()
) {
$categoryId = $this->getUrl(2);
$this->setData([
'category',
$categoryId,
$this->getInput('categoryEditTitle', helper::FILTER_STRING_SHORT, true)
]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'course/category',
'notification' => helper::translate('Catégorie éditée'),
'state' => true
]);
}
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Éditer une catégorie'),
'view' => 'categoryEdit'
]);
}
public function categoryDelete()
{

View File

@ -16,7 +16,7 @@
</div>
<?php if($module::$courseCategories): ?>
<?php echo template::table([5,6,1], $module::$courseCategories, ['Id', 'Titre', '']); ?>
<?php echo template::table([5,5,1,1], $module::$courseCategories, ['Id', 'Titre', '','']); ?>
<?php else: ?>
<?php echo template::speech('Aucune catégorie'); ?>
<?php endif; ?>

View File

@ -0,0 +1,18 @@
/**
* 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/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,31 @@
<?php echo template::formOpen('categoryEditForm'); ?>
<div class="row">
<div class="col1">
<?php echo template::button('categoryEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'course/category',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('categoryEditSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Paramètres'); ?>
</h4>
<div class="row">
<div class="col12">
<?php
echo template::text('categoryEditTitle', [
'label' => 'Nom de la catégorie',
'value' => $this->getData(['category',$this->getUrl(2)])
]); ?>
</div>
</div>
</div>
</div>
</div>

View File

@ -421,19 +421,14 @@ class user extends common
null,
$this->getData(['config', 'smtp', 'from'])
);
// Valeurs en sortie
$this->addOutput([
'notification' => ($sent === true ? helper::translate('Un mail a été envoyé pour confirmer la réinitialisation') : $sent),
'state' => ($sent === true ? true : null)
]);
}
// L'utilisateur n'existe pas
else {
// Valeurs en sortie
$this->addOutput([
'notification' => helper::translate('Utilisateur inexistant')
]);
}
// L'utilisateur n'existe pas, on ne le précise pas
// Valeurs en sortie
$this->addOutput([
'notification' => helper::translate('Un mail a été envoyé pour confirmer la réinitialisation'),
'state' => ($sent === true ? true : null)
]);
}
// Valeurs en sortie
$this->addOutput([
@ -1129,6 +1124,7 @@ class user extends common
$this->addOutput([
'redirect' => helper::baseUrl(),
'notification' => 'Invalide : '. $message
'state' => false,
]);
}
// Accès autorisé

View File

@ -7,52 +7,65 @@
/**
* Quand tinyMCE est invoqué hors connexion, initialiser privateKey
*/
if (typeof (privateKey) == 'undefined') {
if (typeof (privateKey) == "undefined") {
var privateKey = null;
};
tinymce.init({
// Classe où appliquer l'éditeur
// Classe où appliquer l"éditeur
selector: ".editorWysiwyg",
// Aperçu dans le pied de page
setup: function (ed) {
ed.on('change', function (e) {
if (ed.id === 'themeFooterText') {
$("#footerText").html(tinyMCE.get('themeFooterText').getContent());
ed.on("change", function (e) {
if (ed.id === "themeFooterText") {
$("#footerText").html(tinyMCE.get("themeFooterText").getContent());
}
if (ed.id === 'themeHeaderText') {
$("#featureContent").html(tinyMCE.get('themeHeaderText').getContent());
if (ed.id === "themeHeaderText") {
$("#featureContent").html(tinyMCE.get("themeHeaderText").getContent());
}
});
},
// Langue
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'),
language: getCookie("ZWII_UI") === null ? "fr_FR" : getCookie("ZWII_UI"),
// Plugins
plugins: "advlist anchor autolink autoresize autosave codemirror contextmenu colorpicker fullscreen hr image imagetools link lists media paste searchreplace tabfocus table template textcolor visualblocks nonbreaking emoticons charmap",
// Contenu du menu
menu: {
edit: {title: 'Edit', items: 'undo redo | selectall searchreplace | cut copy paste pastetext | style'},
insert: {title: 'Insert', items: 'template | nonbreaking hr charmap anchor | abbr insertdatetime '},
format: {title: 'Format', items: 'underline strikethrough superscript subscript | forecolor backcolor | formats | removeformat'},
table: {title: 'Table', items: 'inserttable tableprops deletetable | cell row column'},
edit: {
title: "Edit",
items: "undo redo | selectall searchreplace | cut copy paste pastetext"
},
insert: {
title: "Insert",
items: "template | nonbreaking hr charmap anchor"
},
format: {
title: "Format",
items: " bold underline strikethrough superscript subscript | | formats | removeformat"
},
tools: {
title: "Tools",
items: ""
},
table: {
title: "Table",
items: "inserttable tableprops deletetable | cell row column"
},
},
// Contenu de la barre d'outils
toolbar: [
"fontselect fontsizeselect formatselect | bold italic strikethrough forecolor backcolor",
"link image ImgPen media | alignleft aligncenter alignright alignjustify | " +
"numlist bullist | outdent indent removeformat"
],
"undo redo | fontsizeselect | h1 h2 h3 | alignleft aligncenter alignright alignjustify | bold forecolor backcolor| bullist numlist | link image media | outdent indent removeformat | fullscreen",
],
toolbar_sticky: true,
fontsize_formats:
"8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 30pt 36pt 48pt 60pt 72pt 96pt",
fontsize_formats: "8pt 9pt 10pt 11pt 12pt 14pt 18pt 24pt 30pt 36pt 48pt 60pt 72pt 96pt",
theme: "silver",
max_height: 600,
// CodeMirror
codemirror: {
indentOnInit: true, // Whether or not to indent code on init.
path: 'codemirror', // Path to CodeMirror distribution
saveCursorPosition: false, // Insert caret marker
config: { // CodeMirror config object
path: "codemirror", // Path to CodeMirror distribution
saveCursorPosition: false, // Insert caret marker
config: { // CodeMirror config object
fullscreen: true,
/*mode: 'application/x-httpd-php',*/
lineNumbers: true,
@ -60,32 +73,45 @@ tinymce.init({
mode: "htmlmixed"
},
jsFiles: [
'mode/php/php.js',
'mode/css/css.js',
'mode/htmlmixed/htmlmixed.js',
'mode/htmlembedded/htmlembedded.js',
'mode/javascript/javascript.js',
'mode/xml/xml.js',
'addon/search/searchcursor.js',
'addon/search/search.js',
"mode/php/php.js",
"mode/css/css.js",
"mode/htmlmixed/htmlmixed.js",
"mode/htmlembedded/htmlembedded.js",
"mode/javascript/javascript.js",
"mode/xml/xml.js",
"addon/search/searchcursor.js",
"addon/search/search.js",
],
/*
cssFiles: [
'theme/cobalt.css',
],*/
width: 800, // Default value is 800
height: 500 // Default value is 550
width: 800, // Default value is 800
height: 500 // Default value is 550
},
// Cibles de la target
target_list: [
{ title: 'None', value: '' },
{ title: 'Nouvel onglet', value: '_blank' }
target_list: [{
title: 'None',
value: ''
},
{
title: 'Nouvel onglet',
value: '_blank'
}
],
// Target pour lightbox
rel_list: [
{ title: 'None', value: '' },
{ title: 'Une popup (Lity)', value: 'data-lity' },
{ title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' }
rel_list: [{
title: 'None',
value: ''
},
{
title: 'Une popup (Lity)',
value: 'data-lity'
},
{
title: 'Une galerie d\'images (SimpleLightbox)',
value: 'gallery'
}
],
// Titre des image
image_title: true,
@ -141,29 +167,57 @@ tinymce.init({
// Contenu du bouton insérer
insert_button_items: "anchor hr table",
// Contenu du bouton formats
style_formats: [
{
title: "Headers", items: [
{ title: "Header 1", format: "h1" },
{ title: "Header 2", format: "h2" },
{ title: "Header 3", format: "h3" },
{ title: "Header 4", format: "h4" },
{ title: "Header 5", format: "h5" },
{ title: "Header 6", format: "h6" }
style_formats: [{
title: "Headers",
items: [{
title: "Header 1",
format: "h1"
},
{
title: "Header 2",
format: "h2"
},
{
title: "Header 3",
format: "h3"
},
{
title: "Header 4",
format: "h4"
},
{
title: "Header 5",
format: "h5"
},
{
title: "Header 6",
format: "h6"
}
]
},
{
title: "Blocks", items: [
{ title: "Paragraph", format: "p" },
{ title: "Citation", format: "blockquote" },
{ title: "Div", format: "div" },
{ title: "Pre", format: "pre" }
title: "Blocks",
items: [{
title: "Paragraph",
format: "p"
},
{
title: "Citation",
format: "blockquote"
},
{
title: "Div",
format: "div"
},
{
title: "Pre",
format: "pre"
}
]
}
],
// Templates
templates: [
{
templates: [{
title: "Lien de retour",
url: baseUrl + "core/vendor/tinymce/templates/back_home.html",
description: "Insère un lien de retour à l'accueil de la plate-forme."
@ -239,7 +293,9 @@ tinymce.init({
var id_alarm = "#blogArticleContentAlarm"
var contentLength = 0;
ed.on("keydown", function (e) {
contentLength = ed.getContent({ format: 'text' }).length;
contentLength = ed.getContent({
format: 'text'
}).length;
if (contentLength > maxlength) {
$(id_alarm).html("Vous avez atteint le maximum de " + maxlength + " caractères ! ");
if (e.keyCode != 8 && e.keyCode != 46) {
@ -247,19 +303,19 @@ tinymce.init({
e.stopPropagation();
return false;
}
}
else {
} else {
if (maxlength - contentLength < alarmCaraMin) {
$(id_alarm).html((maxlength - contentLength) + " caractères restants");
}
else {
} else {
$(id_alarm).html(" ");
}
}
});
// Limitation y compris lors d'un copier/coller
ed.on("paste", function (e) {
contentLeng = ed.getContent({ format: 'text' }).length - 16;
contentLeng = ed.getContent({
format: 'text'
}).length - 16;
var data = e.clipboardData.getData('Text');
if (data.length > (maxlength - contentLeng)) {
$(id_alarm).html("Vous alliez dépasser le maximum de " + maxlength + " caractères ! ");
@ -267,8 +323,7 @@ tinymce.init({
} else {
if (maxlength - contentLeng < alarmCaraMin) {
$(id_alarm).html((maxlength - contentLeng - data.length) + " caractères restants");
}
else {
} else {
$(id_alarm).html(" ");
}
return true;