Feat : Gamutable des messages : ajout de l'action de changement de statut

This commit is contained in:
cy_altern 2025-07-02 13:16:09 +02:00
parent 8afcf7f39c
commit dddf1b8352
8 changed files with 54 additions and 31 deletions

View file

@ -0,0 +1,23 @@
<?php
if (!defined('_ECRIRE_INC_VERSION')) return;
function action_changer_statut_message_dist(){
include_spip('inc/autoriser');
if (!autoriser("modifier","message")) {
return false;
}
$securiser_action = charger_fonction('securiser_action', 'inc');
$args = $securiser_action();
list($id_message, $statut) = explode('-', $args);
if (!intval($id_message) || !in_array($statut, ['prepa', 'prop', 'publie', 'poubelle'])) {
return false;
}
sql_updateq('spip_messages', ['statut' => $statut], ['id_message=' . $id_message]);
// Cache
include_spip('inc/invalideur');
suivre_invalideur("id='messages/$id_message'");
}

View file

@ -43,7 +43,7 @@ function gamucontact_declarer_tables_objets_sql($tables) {
'date_heure' => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
'date_fin' => "datetime NOT NULL DEFAULT '0000-00-00 00:00:00'",
'rv' => "varchar(3) NOT NULL DEFAULT ''",
'statut' => "varchar(6) NOT NULL DEFAULT '0'",
'statut' => "varchar(10) NOT NULL DEFAULT '0'",
'id_auteur' => "bigint(21) NOT NULL DEFAULT '0'",
'destinataires' => 'text NOT NULL',
'ip' => "varchar(50) NOT NULL DEFAULT '0'",

View file

@ -30,6 +30,9 @@ function gamucontact_upgrade($nom_meta_base_version, $version_cible) {
$maj['1.0.5'] = array(array('maj_tables', array('spip_messages')));
$maj['1.0.6'] = array(array('maj_tables', array('spip_messages')));
$maj['1.0.7'] = array(array('maj_tables', array('spip_messages')));
$maj['1.0.8'] = array(
array('sql_alter', "TABLE spip_messages CHANGE statut statut VARCHAR(10) NOT NULL DEFAULT '0'"),
);
include_spip('base/upgrade');
maj_plugin($nom_meta_base_version, $version_cible, $maj);

View file

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

View file

@ -13,6 +13,7 @@
]
"objet": "Objet",
"statut": "Statut",
"actions": "Actions",
"nom": "Expéditeur",
"email_contact": "Email",
"telephone": "Tel",
@ -36,13 +37,11 @@
]
"email_contact" : "input"
},
"filtreColValeurs" : {
[(#REM) "statut": "prop" ]
},
"filtreColValeurs" : {},
"classes": {
"id": "w80p",
"objet": "minw150p",
"statut": "minw80p",
"objet": "minw250p",
"statut": "minw100p",
"formulaire": "w150p"
}
}
@ -55,28 +54,22 @@
[(#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>
})]
#SET{args,#ID_MESSAGE}
[(#STATUT|!={publie}|oui)
#SET{args, #GET{args}|concat{-}|concat{publie}}
[(#SET{actions,
<a class="url_action" data-id="#ID_MESSAGE" href="[(#URL_ACTION_AUTEUR{changer_statut_message,#GET{args}})]">
<i title="Publier le message" class="fa fa-check fa-2x grise" aria-hidden="true"></i>
</a>
})]
][(#STATUT|=={publie}|oui)
#SET{args, #GET{args}|concat{-}|concat{poubelle}}
[(#SET{actions,
<a class="url_action" data-id="#ID_MESSAGE" href="[(#URL_ACTION_AUTEUR{changer_statut_message,#GET{args}})]">
<i title="Passer à la poubelle le message" class="fa fa-trash fa-2x rouge" aria-hidden="true"></i>
</a>
})]
]
{
"html": {
@ -89,6 +82,7 @@
]
"objet": [(#OBJET|json_encode)],
"statut": [(#GET{statut}|json_encode)],
"actions": [(#GET{actions}|json_encode)],
"nom": [(#NOM|json_encode)],
"email_contact": [(#EMAIL_CONTACT|json_encode)],
"telephone": [(#TELEPHONE|json_encode)],
@ -104,6 +98,7 @@
]
"objet": [(#OBJET|json_encode)],
"statut": [(#STATUT|json_encode)],
"actions": "",
"nom": [(#NOM|json_encode)],
"email_contact": [(#EMAIL_CONTACT|json_encode)],
"telephone": [(#TELEPHONE|json_encode)],

View file

@ -26,6 +26,7 @@ $GLOBALS[$GLOBALS['idx_lang']] = array(
// M
'message' => 'Message',
'messages_envoyes_site' => 'Messages sent on the website',
// N
'nom' => 'Name',

View file

@ -26,6 +26,7 @@ $GLOBALS[$GLOBALS['idx_lang']] = array(
// M
'message' => 'Message',
'messages_envoyes_site' => 'Messages envoyés sur le site',
// N
'nom' => 'Nom',

View file

@ -1,12 +1,12 @@
<paquet
prefix="gamucontact"
categorie="communication"
version="1.0.8"
version="1.0.9"
etat="test"
compatibilite="[3.2.10;4.*]"
logo="./gamucontact-xx.svg"
documentation=""
schema="1.0.7"
schema="1.0.8"
>
<nom>GamuContact</nom>