WIP gamutable des messages : afficher le message complet en popin + ajout du changement de statut

This commit is contained in:
cy_altern 2025-07-02 01:03:56 +02:00
parent 5bcf3af1bd
commit 8afcf7f39c
7 changed files with 87 additions and 30 deletions

View file

@ -38,7 +38,7 @@ function gamucontact_declarer_tables_objets_sql($tables) {
'nom' => "varchar(255) NOT NULL",
'telephone' => "varchar(55) NOT NULL",
'email_contact' => "varchar(255) NOT NULL",
'origine' => 'tinytext NOT NULL DEFAULT ""',
'origine' => "tinytext NOT NULL",
'type' => "varchar(25) NOT NULL DEFAULT ''",
'date_heure' => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
'date_fin' => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",

View file

@ -1,6 +1,8 @@
[(#REM)
neutraliser l'accès aux messages créés par le formulaire de contact
si pas 0minirezo neutraliser l'accès aux messages créés par le formulaire de contact
via le scaffolding pour ?page=message
]<INCLURE{fond=content/404,env} />
][(#AUTORISER{0minirezo}|non) <INCLURE{fond=content/404,env} />
][(#AUTORISER{0minirezo}|oui) <INCLURE{fond=inclure/vue_message,env} />]

View file

@ -26,4 +26,3 @@ function gamucontact_autoriser() {
function gamucontact_autoriser_messages_voir_dist($faire, $type, $id, $qui, $opt) {
return in_array($qui['statut'], ['0minirezo']);
}

View file

@ -1,9 +1,8 @@
[(#AUTORISER{voir,messages}|sinon_interdire_acces)]
#SET{url,#URL_PAGE{json_messages.json}}
<div class="">
[(#SET{titre_un,<i class="fa fa-send"></i> Messages envoyés sur le site})]
<div class="">
<div class="gamucontact-gamutable">
<INCLURE{fond=inclure/gamutable,
titregamutable=#GET{titre_un},

28
inclure/vue_message.html Normal file
View file

@ -0,0 +1,28 @@
[(#REM)
afficher le contenu d'un message de contact
si ENV{message_seul} on affiche que le texte
]<div class="inner">
<BOUCLE_message(MESSAGES){id_message}{tout}>
[(#ENV{message_seul}|non)
<h2>Message n°[(#ID_MESSAGE)] <small>reçu le [(#DATE|affdate{d/m/Y à H:i:s})]</small></h2>
<div class="objet">
<strong>Objet :</strong> [(#OBJET)]
</div>
<div class="origine">
<strong>Origine :</strong> <a class="small nowrap" href="[(#ORIGINE)]" title="Accéder à la page d'origine du message">[(#ORIGINE|couper{35})...]</a>
</div>
[<div class="formulaire">
<strong>Formulaire :</strong> (#TITRE|replace{Formulaire de, ''})
</div>]
<div class="expediteur">
<strong>Expéditeur :</strong> [(#NOM)]
[<br><strong>Email :</strong> (#EMAIL_CONTACT)]
[<br><strong>Téléphone :</strong> (#TELEPHONE)]
</div>
]
<div class="texte">
<strong>Message :</strong> [(#TEXTE)]
</div>
</BOUCLE_message>
</div>

View file

@ -3,22 +3,26 @@
[(#ENV{id}|setenv{id_message})]
[{
"header":{
"id": "_",
"date": "Date",
"formulaire": "Formulaire",
[(#CONFIG{gamucontact/gamutable_afficher_type}|oui)
"type": "Type",
]
"objet": "Objet",
"statut": "Statut",
"nom": "Expéditeur",
"email_contact": "Email",
"telephone": "Tel",
"message": "Message"
"header":{
"id": "_",
"date": "Date",
"origine": "Page origine",
"formulaire": "Formulaire",
[(#CONFIG{gamucontact/gamutable_afficher_type}|oui)
"type": "Type",
]
"objet": "Objet",
"statut": "Statut",
"nom": "Expéditeur",
"email_contact": "Email",
"telephone": "Tel",
"message": "Message"
},
"crayons":{
"statut": ""
"crayons": {
[(#REM)
"statut": "message",
"nom": "message"
]
},
"ordreCol" : {
"date": "desc"
@ -32,7 +36,9 @@
]
"email_contact" : "input"
},
"filtreColValeurs" : {},
"filtreColValeurs" : {
[(#REM) "statut": "prop" ]
},
"classes": {
"id": "w80p",
"objet": "minw150p",
@ -42,19 +48,41 @@
}
<B_messages>
,
<BOUCLE_messages(MESSAGES){statut?}{','}{!par date_heure}>
[(#SET{message, <div class="aff_masq" data-aff_masq="[(#ID_MESSAGE)]">[(#TEXTE*|couper{150})]</div>
<div class="message_complet js-hidden" id="message_[(#ID_MESSAGE)]">
[(#TEXTE*)]
</div>
})]
<BOUCLE_messages(MESSAGES){','}{!par date_heure}>
[(#SET{message, <a class="modalbox" href="[(#URL_PAGE{message, id_message=#ID_MESSAGE}|parametre_url{message_seul, oui})]" title="Afficher le texte complet du message"><i class="gt-lien"></i> [(#TEXTE*|couper{100})]</a>})]
#SET{statut, #LISTE{prepa,prop,publie,poubelle}|str_replace{#LISTE{Brouillon,Proposé,Publié,Poubelle}, #STATUT}}
#SET{formulaire, #TITRE|replace{Formulaire de, ''}}
[(#SET{origine_, <a class="small nowrap" href="#ORIGINE" title="Accéder à la page d'origine du message">[(#ORIGINE|couper{35})...]</a>})]
[(#SET{origine, article origine})]
#SET{args,#ID_MESSAGE|concat{-}|concat{#STATUT}}
[(#SET{statut,
<a
class="url_action"
data-id="#ID_MESSAGE"
href="[(#URL_ACTION_AUTEUR{changer_statut_message,#GET{args}})]"
>
[(#STATUT|!={publie}|oui)
<i
title="Publier le message"
class="fa fa-check fa-2x grise"
aria-hidden="true"
></i>
] [(#STATUT|=={publie}|oui)
<i
title="Passer à la poubelle le message"
class="fa fa-trash fa-2x rouge"
aria-hidden="true"
></i>
]
</a>
})]
{
"html": {
"id": #ID_MESSAGE,
"date": [(#DATE_HEURE|affdate{d/m/Y H:i:s}|json_encode)],
"origine": [(#GET{origine}|json_encode)],
"formulaire": [(#GET{formulaire}|json_encode)],
[(#CONFIG{gamucontact/gamutable_afficher_type}|oui)
"type": [(#TYPE|json_encode)],
@ -69,12 +97,13 @@
"search": {
"id": #ID_MESSAGE,
"date": [(#DATE_HEURE|affdate{Y-m-d H:i:s}|json_encode)],
"origine": [(#ORIGINE|json_encode)],
"formulaire": [(#GET{formulaire}|json_encode)],
[(#CONFIG{gamucontact/gamutable_afficher_type}|oui)
"type": [(#TYPE|json_encode)],
]
"objet": [(#OBJET|json_encode)],
"statut": [(#GET{statut}|json_encode)],
"statut": [(#STATUT|json_encode)],
"nom": [(#NOM|json_encode)],
"email_contact": [(#EMAIL_CONTACT|json_encode)],
"telephone": [(#TELEPHONE|json_encode)],

View file

@ -6,7 +6,7 @@
compatibilite="[3.2.10;4.*]"
logo="./gamucontact-xx.svg"
documentation=""
schema="1.0.8"
schema="1.0.7"
>
<nom>GamuContact</nom>