créer la table spip_messages si besoin (SPIP 4 : organiseur absent)

This commit is contained in:
cy_altern 2021-06-14 13:49:56 +02:00
parent b2c90febf4
commit 336aada63f
6 changed files with 66 additions and 19 deletions

58
base/gamucontact.php Normal file
View file

@ -0,0 +1,58 @@
<?php
/**
* Déclarations relatives à la base de données
*
*/
if (!defined('_ECRIRE_INC_VERSION')) {
return;
}
/**
* Interfaces de la table messages
*
* @param array $interfaces
* @return array
*/
function gamucontact_declarer_tables_interfaces($interfaces) {
$interfaces['table_des_tables']['messages'] = 'messages';
return $interfaces;
}
/**
* Declaration des champs de la table messages
*
* @param array $tables
* @return array
*/
function gamucontact_declarer_tables_objets_sql($tables) {
$tables['spip_messages'] = [
'principale' => 'oui',
'field'=> [
'id_message' => 'bigint(21) NOT NULL',
'titre' => 'text NOT NULL',
'objet' => "varchar(255) NOT NULL",
'texte' => 'longtext NOT NULL',
'nom' => "varchar(255) NOT NULL",
'telephone' => "varchar(55) NOT NULL",
'email_contact' => "varchar(255) NOT NULL",
'type' => "varchar(6) 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'",
'rv' => "varchar(3) NOT NULL DEFAULT ''",
'statut' => "varchar(6) NOT NULL DEFAULT '0'",
'id_auteur' => "bigint(21) NOT NULL DEFAULT '0'",
'destinataires' => 'text NOT NULL',
'maj' => 'timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
],
'key' => array(
'PRIMARY KEY' => 'id_message',
'KEY statut' => 'statut',
'KEY id_auteur' => 'id_auteur',
)
];
return $tables;
}

View file

@ -27,7 +27,7 @@ function gamucontact_upgrade($nom_meta_base_version, $version_cible) {
$maj = array(); $maj = array();
$maj['create'] = array(array('maj_tables', array('spip_messages'))); $maj['create'] = array(array('maj_tables', array('spip_messages')));
$maj['1.0.4'] = array(array('maj_tables', array('spip_messages'))); $maj['1.0.5'] = array(array('maj_tables', array('spip_messages')));
include_spip('base/upgrade'); include_spip('base/upgrade');
maj_plugin($nom_meta_base_version, $version_cible, $maj); maj_plugin($nom_meta_base_version, $version_cible, $maj);

View file

@ -2,7 +2,6 @@
/** /**
* Définit les autorisations du plugin GamuContact * Définit les autorisations du plugin GamuContact
* *
zsh:1: command not found: qa
* @copyright 2021 * @copyright 2021
* @author tofulm * @author tofulm
* @licence GNU/GPL * @licence GNU/GPL

View file

@ -57,13 +57,3 @@ $GLOBALS['gamucontact'] = [
], ],
]; ];
function gamucontact_declarer_tables_objets_sql($tables) {
$tables['spip_messages']['field']['telephone'] = "varchar(55) NOT NULL";
$tables['spip_messages']['field']['nom'] = "varchar(255) NOT NULL";
$tables['spip_messages']['field']['objet'] = "varchar(255) NOT NULL";
$tables['spip_messages']['field']['email_contact'] = "varchar(255) NOT NULL";
return $tables;
}

View file

@ -10,8 +10,8 @@
[<img src="(#LOGO_SITE_SPIP|image_reduire{200}|extraire_attribut{src}|url_absolue)" >] [<img src="(#LOGO_SITE_SPIP|image_reduire{200}|extraire_attribut{src}|url_absolue)" >]
<br> <br>
<br> <br>
<h1><:gamucontact:formulaire_contact:></h1> <h1>#NOM_SITE_SPIP : <:gamucontact:formulaire_contact:></h1>
<BOUCLE_message(MESSAGES){id_message}{statut?}{tout}> <BOUCLE_message(MESSAGES){id_message}>
<div class="message"> <div class="message">
[<strong><:gamucontact:nom:> : </strong> (#NOM)<br>] [<strong><:gamucontact:nom:> : </strong> (#NOM)<br>]
[<strong><:gamucontact:email:> : </strong> (#EMAIL_CONTACT)<br>] [<strong><:gamucontact:email:> : </strong> (#EMAIL_CONTACT)<br>]

View file

@ -1,12 +1,12 @@
<paquet <paquet
prefix="gamucontact" prefix="gamucontact"
categorie="communication" categorie="communication"
version="1.0.2" version="1.0.3"
etat="dev" etat="dev"
compatibilite="[3.3.0-dev;4.0.*]" compatibilite="[3.2.10;4.0.*]"
logo="./gamucontact-xx.svg" logo="./gamucontact-xx.svg"
documentation="" documentation=""
schema="1.0.4" schema="1.0.5"
> >
<nom>GamuContact</nom> <nom>GamuContact</nom>
@ -20,7 +20,7 @@
<pipeline nom="autoriser" inclure="gamucontact_autorisations.php" /> <pipeline nom="autoriser" inclure="gamucontact_autorisations.php" />
<pipeline nom="declarer_tables_objets_sql" inclure="gamucontact_options.php" /> <pipeline nom="declarer_tables_objets_sql" inclure="base/gamucontact.php" />
<pipeline nom="declarer_tables_interfaces" inclure="base/gamucontact.php" />
</paquet> </paquet>