commentaires de page simplification de la configuration

This commit is contained in:
Deltacms 2024-02-07 12:08:25 +01:00
parent 501d101b07
commit 77c13948fd
9 changed files with 38 additions and 82 deletions

View File

@ -55,9 +55,6 @@ class common {
const DELTA_VERSION = '5.0.01';
const DELTA_UPDATE_CHANNEL = "v5";
// Pour la pagination des commentaires de bas de page
const ITEMSPAGE = 3;
public static $actions = [];
public static $coreModuleIds = [
'config',

View File

@ -99,14 +99,12 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) {
// Rechercher l'adresse en fonction du mail
$singleuser = '';
if( $this->getData(['config', 'social', 'comment', 'user']) !== '' ) $singleuser = $this->getData(['user', $listUsers[$this->getData(['config', 'social', 'comment', 'user'])], 'mail']);
$singlemail = $this->getData(['config', 'social', 'comment', 'mail']);
$group = $this->getData(['config', 'social', 'comment', 'group']);
// Verification si le mail peut être envoyé
if(
self::$inputNotices === [] && (
$group > 0 ||
$singleuser !== '' ||
$singlemail !== '' )
$singleuser !== '')
) {
// Utilisateurs dans le groupe
$to = [];
@ -121,10 +119,6 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) {
if (!empty($singleuser)) {
$to[] = $singleuser;
}
// Mail désigné
if (!empty($singlemail)) {
$to[] = $singlemail;
}
if($to) {
// Sujet du mail
$subject = $this->getData(['config', 'social', 'comment', 'subject']);
@ -173,12 +167,13 @@ $pagesComment = '';
if ( !isset($_SESSION[$commentNumPage] )) $_SESSION[$commentNumPage] = 1;
$dataPage = $this->getData(['comment', $this->getUrl(0), 'data']);
if ( NULL !== $dataPage && is_array($dataPage) && $dataPage !== [] ) {
$nbPage = ceil(count( $dataPage) / self::ITEMSPAGE);
$nbItemPage = $this->getData(['config', 'social', 'comment', 'nbItemPage']);
$nbPage = ceil(count( $dataPage) / $nbItemPage);
if( $_SESSION[$commentNumPage] > $nbPage ) $_SESSION[$commentNumPage] = $nbPage;
if( $_SESSION[$commentNumPage] <= 0 ) $_SESSION[$commentNumPage] = 1;
$paramPage = $this->getUrl() .'/'. $_SESSION[$commentNumPage];
// Pagination
$pagination = helper::pagination($dataPage, $paramPage, self::ITEMSPAGE);
$pagination = helper::pagination($dataPage, $paramPage, $nbItemPage);
// Liste des pages
$pagesComment = $pagination['pages'];
// Inverse l'ordre du tableau
@ -295,8 +290,8 @@ echo template::formOpenFile('commentPageFormForm', $action);
<?php
// Affichage des messages
echo '<div id="commentAnchor" class="block msgs">';
if($data):
if( $data ){
echo '<div id="commentAnchor" class="block msgs">';
foreach( $data as $key1=>$value1){
if( is_array($value1)){
foreach( $value1 as $key2=>$value2){
@ -304,10 +299,9 @@ if($data):
}
}
}
else:
echo template::speech('<div style=" text-align: center;">'.$text['core']['showComment'][6].'</div>' );
endif;
echo '</div>';
echo '</div>';
}
if($pagesComment && $nbPage > 1){ ?>
<?php $disabledNext = false;
$disabledPrev = false;

View File

@ -172,11 +172,11 @@ class config extends common {
// Variable pour les champs de commentaires dans Social
public static $listUsers = [];
public static $logoWidth = [
'40' => '40%',
'60' => '60%',
'80' => '80%',
'100' => '100%'
public static $nbItemPage = [
'1' => '1',
'3' => '3',
'5' => '5',
'10' => '10'
];
/**
@ -496,12 +496,9 @@ class config extends common {
'button' => $this->getInput('socialConfigButton'),
'group' => $this->getInput('socialConfigGroup'),
'user' => $this->getInput('socialConfigUser'),
'mail' => $this->getInput('socialConfigMail'),
'subject' => $this->getInput('socialConfigSubject'),
'captcha' => $this->getInput('socialConfigCaptcha', helper::FILTER_BOOLEAN),
'signature' => $this->getInput('socialConfigSignature'),
'logoUrl' => $this->getInput('socialConfigLogo'),
'logoWidth' => $this->getInput('socialConfigLogoWidth')
'nbItemPage' => $this->getInput('socialConfigNbItemPage')
]
],
'smtp' => [

View File

@ -186,22 +186,16 @@ $text['core_config_view']['social'][20] = 'Configuration';
$text['core_config_view']['social'][21] = 'Leave empty to keep the default text.';
$text['core_config_view']['social'][22] = 'Submit button text';
$text['core_config_view']['social'][23] = 'Send the entered data by email:';
$text['core_config_view']['social'][24] = 'Select at least one group, one user or enter an email. Your server must allow email sending.';
$text['core_config_view']['social'][24] = 'Select at least one group or one user. Your server must allow email sending.';
$text['core_config_view']['social'][25] = 'Leave empty to keep the default text.';
$text['core_config_view']['social'][26] = 'Mail subject';
$text['core_config_view']['social'][27] = 'To groups from ';
$text['core_config_view']['social'][28] = 'Editors = editors + administrators<br> Members = members + editors + administrators';
$text['core_config_view']['social'][29] = 'Has one member';
$text['core_config_view']['social'][30] = 'Has an email address';
$text['core_config_view']['social'][31] = 'An email or a mailing list';
$text['core_config_view']['social'][32] = 'Reply to sender from notification email';
$text['core_config_view']['social'][33] = 'This option allows you to respond directly to the sender of the message if they have indicated a valid email.';
$text['core_config_view']['social'][34] = 'Select signature type';
$text['core_config_view']['social'][35] = 'Select the site logo';
$text['core_config_view']['social'][36] = 'Logo';
$text['core_config_view']['social'][37] = 'Select logo width';
$text['core_config_view']['social'][38] = '38';
$text['core_config_view']['social'][39] = '39';
$text['core_config_view']['social'][37] = 'Number of comments displayed on a page';
$text['core_config_view']['social'][40] = 'Validate a captcha in order to submit the form';
$text['core_config']['generateFiles'][0] = 'Updated sitemap and robots.txt files';
$text['core_config']['generateFiles'][1] = 'Writing failure, site map not updated';

View File

@ -186,22 +186,16 @@ $text['core_config_view']['social'][20] = 'Configuración';
$text['core_config_view']['social'][21] = 'Déjelo vacío para mantener el texto predeterminado.';
$text['core_config_view']['social'][22] = 'Enviar texto del botón';
$text['core_config_view']['social'][23] = 'Enviar los datos ingresados por correo electrónico:';
$text['core_config_view']['social'][24] = 'Seleccione al menos un grupo, un usuario o ingrese un correo electrónico. Su servidor debe permitir el envío de correo electrónico.';
$text['core_config_view']['social'][24] = 'Seleccione al menos un grupo o un usuario. Su servidor debe permitir el envío de correo electrónico.';
$text['core_config_view']['social'][25] = 'Déjelo vacío para mantener el texto predeterminado.';
$text['core_config_view']['social'][26] = 'Asunto del correo';
$text['core_config_view']['social'][27] = 'A grupos de';
$text['core_config_view']['social'][28] = 'Editores = editores + administradores<br> Miembros = miembros + editores + administradores';
$text['core_config_view']['social'][29] = 'Tiene un miembro';
$text['core_config_view']['social'][30] = 'Tiene una dirección de correo electrónico';
$text['core_config_view']['social'][31] = 'Un correo electrónico o una lista de correo';
$text['core_config_view']['social'][32] = 'Responder al remitente desde el correo electrónico de notificación';
$text['core_config_view']['social'][33] = 'Esta opción le permite responder directamente al remitente del mensaje si ha indicado un correo electrónico válido.';
$text['core_config_view']['social'][34] = 'Seleccionar tipo de firma';
$text['core_config_view']['social'][35] = 'Seleccione el logotipo del sitio';
$text['core_config_view']['social'][36] = 'Logotipo';
$text['core_config_view']['social'][37] = 'Seleccionar ancho del logotipo';
$text['core_config_view']['social'][38] = '38';
$text['core_config_view']['social'][39] = '39';
$text['core_config_view']['social'][37] = 'Número de comentarios mostrados en una página';
$text['core_config_view']['social'][40] = 'Validar un captcha para enviar el formulario';
$text['core_config']['generateFiles'][0] = 'Mapa del sitio actualizado y archivos robots.txt';

View File

@ -186,22 +186,16 @@ $text['core_config_view']['social'][20] = 'Configuration';
$text['core_config_view']['social'][21] = 'Laissez vide afin de conserver le texte par défaut.';
$text['core_config_view']['social'][22] = 'Texte du bouton de soumission';
$text['core_config_view']['social'][23] = 'Envoyer par mail les données saisies :';
$text['core_config_view']['social'][24] = 'Sélectionnez au moins un groupe, un utilisateur ou saississez un email. Votre serveur doit autoriser les envois de mail.';
$text['core_config_view']['social'][24] = 'Sélectionnez au moins un groupe ou un utilisateur. Votre serveur doit autoriser les envois de mail.';
$text['core_config_view']['social'][25] = 'Laissez vide afin de conserver le texte par défaut.';
$text['core_config_view']['social'][26] = 'Sujet du mail';
$text['core_config_view']['social'][27] = 'Aux groupes à partir de ';
$text['core_config_view']['social'][28] = 'Editeurs = éditeurs + administrateurs<br> Membres = membres + éditeurs + administrateurs';
$text['core_config_view']['social'][29] = 'A un membre';
$text['core_config_view']['social'][30] = 'A une adresse email';
$text['core_config_view']['social'][31] = 'Un email ou une liste de diffusion';
$text['core_config_view']['social'][32] = 'Répondre à l\'expéditeur depuis le mail de notification';
$text['core_config_view']['social'][33] = 'Cette option permet de répondre directement à l\'expéditeur du message si celui-ci a indiqué un email valide.';
$text['core_config_view']['social'][34] = 'Sélectionner le type de signature';
$text['core_config_view']['social'][35] = 'Sélectionnez le logo du site';
$text['core_config_view']['social'][36] = 'Logo';
$text['core_config_view']['social'][37] = 'Sélectionner la largeur du logo';
$text['core_config_view']['social'][38] = '38';
$text['core_config_view']['social'][39] = '39';
$text['core_config_view']['social'][37] = 'Nombre de commentaires affichés sur une page';
$text['core_config_view']['social'][40] = 'Valider un captcha afin de soumettre le formulaire';
$text['core_config']['generateFiles'][0] = 'Mises à jour des fichiers sitemap et robots.txt';

View File

@ -108,43 +108,21 @@ include('./core/module/config/lang/'. $this->getData(['config', 'i18n', 'langAdm
'selected' => $this->getData(['config', 'social', 'comment', 'user'])
]); ?>
</div>
<div class="col4">
<?php echo template::text('socialConfigMail', [
'label' => $text['core_config_view']['social'][30],
'value' => $this->getData(['config', 'social', 'comment', 'mail']),
'help' => $text['core_config_view']['social'][31]
]); ?>
</div>
</div>
</div>
</div>
<div class="row" >
<div class="col4">
<?php echo template::select('socialConfigSignature', $signature, [
'label' => $text['core_config_view']['social'][34],
'selected' => $this->getData(['config', 'social', 'comment', 'signature'])
]); ?>
</div>
<div class="col4">
<?php echo template::file('socialConfigLogo', [
'help' => $text['core_config_view']['social'][35],
'label' => $text['core_config_view']['social'][36],
'value' => $this->getData(['config', 'social', 'comment', 'logoUrl'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('socialConfigLogoWidth', config::$logoWidth, [
'label' => $text['core_config_view']['social'][37],
'selected' => $this->getData(['config', 'social', 'comment', 'logoWidth'])
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<div class="col4">
<?php echo template::checkbox('socialConfigCaptcha', true, $text['core_config_view']['social'][40], [
'checked' => $this->getData(['config', 'social', 'comment', 'captcha'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('socialConfigNbItemPage', config::$nbItemPage, [
'label' => $text['core_config_view']['social'][37],
'selected' => $this->getData(['config', 'social', 'comment', 'nbItemPage'])
]); ?>
</div>
</div>
</div>
</div>

View File

@ -17,7 +17,15 @@ class init extends common {
'twitterId' => '',
'youtubeId' => '',
'youtubeUserId' => '',
'githubId' => ''
'githubId' => '',
'comment' => [
'button' => '',
'group' => '',
'user' => '',
'subject' => '',
'captcha' => true,
'nbItemPage' => '3'
]
],
'timezone' => 'Europe/Paris',
'proxyUrl' => '',

View File

@ -330,7 +330,7 @@ class page extends common {
$data = $this->getData(['comment', $this->getUrl(2), 'data']);
if($data) {
// Pagination
$pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE);
$pagination = helper::pagination($data, $this->getUrl(), $this->getData(['config', 'social', 'comment', 'nbItemPage' ]));
// Liste des pages
self::$pages = $pagination['pages'];
// Inverse l'ordre du tableau