From ba3f6caf38389648f28e4b1e7f811fa75a0de989 Mon Sep 17 00:00:00 2001 From: chankalan Date: Thu, 11 Feb 2021 21:48:20 +0100 Subject: [PATCH] =?UTF-8?q?r=C3=A9visions=20sql=20+=20champ=20fichier=20du?= =?UTF-8?q?=20podcast=20(sinon=20il=20faudrait=20que=20ce=20soit=20un=20do?= =?UTF-8?q?cument=20de=20la=20m=C3=A9diath=C3=A8que=20au=20format=20son=20?= =?UTF-8?q?(mp3,=20ogg...))?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base/podcast.php | 9 +- fabrique_diff.diff | 203 ++---------------------------- fabrique_podcast.php | 25 +++- formulaires/editer_podcast.html | 4 + lang/podcast_fr.php | 2 + paquet.xml | 6 +- podcast_administrations.php | 6 +- prive/objets/contenu/podcast.html | 5 + readme.md | 5 +- 9 files changed, 58 insertions(+), 207 deletions(-) diff --git a/base/podcast.php b/base/podcast.php index c37506c..d7cc2a4 100644 --- a/base/podcast.php +++ b/base/podcast.php @@ -49,8 +49,9 @@ function podcast_declarer_tables_objets_sql($tables) { 'field'=> array( 'id_podcast' => 'bigint(21) NOT NULL', 'id_article' => 'bigint(21) NOT NULL DEFAULT 0', - 'code' => 'tinytext NOT NULL DEFAULT ""', - 'duree' => 'tinytext NOT NULL DEFAULT ""', + 'code' => 'varchar(25) NOT NULL DEFAULT ""', + 'fichier' => 'tinytext NOT NULL DEFAULT ""', + 'duree' => 'varchar(25) NOT NULL DEFAULT ""', 'maj' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP' ), 'key' => array( @@ -59,8 +60,8 @@ function podcast_declarer_tables_objets_sql($tables) { ), 'titre' => 'code AS titre, "" AS lang', #'date' => '', - 'champs_editables' => array('code', 'duree', 'id_article'), - 'champs_versionnes' => array('code', 'duree', 'id_article'), + 'champs_editables' => array('code', 'fichier', 'duree', 'id_article'), + 'champs_versionnes' => array('code', 'fichier', 'duree', 'id_article'), 'rechercher_champs' => array(), 'tables_jointures' => array(), diff --git a/fabrique_diff.diff b/fabrique_diff.diff index d7da545..f94ad4c 100644 --- a/fabrique_diff.diff +++ b/fabrique_diff.diff @@ -1,194 +1,13 @@ -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/action: supprimer_chapitre.php -diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/.backup/podcast/base/podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/podcast/base/podcast.php -28a29 -> $interfaces['table_des_tables']['chapitres'] = 'chapitres'; -63a65,91 -> 'tables_jointures' => array(), -> -> -> ); -> -> $tables['spip_chapitres'] = array( -> 'type' => 'chapitre', -> 'principale' => 'oui', -> 'field'=> array( -> 'id_chapitre' => 'bigint(21) NOT NULL', -> 'id_podcast' => 'bigint(21) NOT NULL DEFAULT 0', -> 'titre' => 'tinytext NOT NULL DEFAULT ""', -> 'nom_identifiant' => 'tinytext NOT NULL DEFAULT ""', -> 'sujet_principal' => 'int(6) NOT NULL DEFAULT 0', -> 'debut' => 'varchar(25) NOT NULL DEFAULT ""', -> 'fin' => 'varchar(25) NOT NULL DEFAULT ""', -> 'maj' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP' -> ), -> 'key' => array( -> 'PRIMARY KEY' => 'id_chapitre', -> 'KEY id_podcast' => 'id_podcast', -> ), -> 'titre' => 'titre AS titre, "" AS lang', -> #'date' => '', -> 'champs_editables' => array('titre', 'nom_identifiant', 'sujet_principal', 'debut', 'fin', 'id_podcast'), -> 'champs_versionnes' => array('titre', 'nom_identifiant', 'sujet_principal', 'debut', 'fin', 'id_podcast'), -> 'rechercher_champs' => array("titre" => 5), -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/formulaires: editer_chapitre.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/formulaires: editer_chapitre.php -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/lang: chapitre_fr.php -diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/.backup/podcast/paquet.xml ../sites/fabrique.spip/tmp/cache/fabrique/podcast/paquet.xml +diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../plugins/fabrique_auto/.backup/podcast/paquet.xml ../plugins/fabrique_auto/podcast/paquet.xml +4c4 +< version="1.1.1" +--- +> version="1.1.2" +9c9 +< schema="1.0.0" +--- +> schema="1.2.2" 12c12 -< Paquet généré le 2021-02-10 07:11:23 +< Paquet généré le 2021-02-11 21:24:46 --- -> Paquet généré le 2021-02-11 09:30:30 -diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/.backup/podcast/podcast_administrations.php ../sites/fabrique.spip/tmp/cache/fabrique/podcast/podcast_administrations.php -54c54 -< $maj['create'] = array(array('maj_tables', array('spip_podcasts'))); ---- -> $maj['create'] = array(array('maj_tables', array('spip_podcasts', 'spip_chapitres'))); -79a80 -> sql_drop_table('spip_chapitres'); -82,84c83,85 -< sql_delete('spip_documents_liens', sql_in('objet', array('podcast'))); -< sql_delete('spip_mots_liens', sql_in('objet', array('podcast'))); -< sql_delete('spip_auteurs_liens', sql_in('objet', array('podcast'))); ---- -> sql_delete('spip_documents_liens', sql_in('objet', array('podcast', 'chapitre'))); -> sql_delete('spip_mots_liens', sql_in('objet', array('podcast', 'chapitre'))); -> sql_delete('spip_auteurs_liens', sql_in('objet', array('podcast', 'chapitre'))); -86,88c87,89 -< sql_delete('spip_versions', sql_in('objet', array('podcast'))); -< sql_delete('spip_versions_fragments', sql_in('objet', array('podcast'))); -< sql_delete('spip_forum', sql_in('objet', array('podcast'))); ---- -> sql_delete('spip_versions', sql_in('objet', array('podcast', 'chapitre'))); -> sql_delete('spip_versions_fragments', sql_in('objet', array('podcast', 'chapitre'))); -> sql_delete('spip_forum', sql_in('objet', array('podcast', 'chapitre'))); -diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/.backup/podcast/podcast_autorisations.php ../sites/fabrique.spip/tmp/cache/fabrique/podcast/podcast_autorisations.php -143a144,233 -> // ----------------- -> // Objet chapitres -> -> -> -> -> /** -> * Autorisation de voir (chapitres) -> * -> * @param string $faire Action demandée -> * @param string $type Type d'objet sur lequel appliquer l'action -> * @param int $id Identifiant de l'objet -> * @param array $qui Description de l'auteur demandant l'autorisation -> * @param array $opt Options de cette autorisation -> * @return bool true s'il a le droit, false sinon -> **/ -> function autoriser_chapitres_voir_dist($faire, $type, $id, $qui, $opt) { -> return true; -> } -> -> /** -> * Autorisation de voir (chapitre) -> * -> * @param string $faire Action demandée -> * @param string $type Type d'objet sur lequel appliquer l'action -> * @param int $id Identifiant de l'objet -> * @param array $qui Description de l'auteur demandant l'autorisation -> * @param array $opt Options de cette autorisation -> * @return bool true s'il a le droit, false sinon -> **/ -> function autoriser_chapitre_voir_dist($faire, $type, $id, $qui, $opt) { -> return true; -> } -> -> /** -> * Autorisation de créer (chapitre) -> * -> * @param string $faire Action demandée -> * @param string $type Type d'objet sur lequel appliquer l'action -> * @param int $id Identifiant de l'objet -> * @param array $qui Description de l'auteur demandant l'autorisation -> * @param array $opt Options de cette autorisation -> * @return bool true s'il a le droit, false sinon -> **/ -> function autoriser_chapitre_creer_dist($faire, $type, $id, $qui, $opt) { -> return in_array($qui['statut'], array('0minirezo', '1comite')); -> } -> -> /** -> * Autorisation de modifier (chapitre) -> * -> * @param string $faire Action demandée -> * @param string $type Type d'objet sur lequel appliquer l'action -> * @param int $id Identifiant de l'objet -> * @param array $qui Description de l'auteur demandant l'autorisation -> * @param array $opt Options de cette autorisation -> * @return bool true s'il a le droit, false sinon -> **/ -> function autoriser_chapitre_modifier_dist($faire, $type, $id, $qui, $opt) { -> return in_array($qui['statut'], array('0minirezo', '1comite')); -> } -> -> /** -> * Autorisation de supprimer (chapitre) -> * -> * @param string $faire Action demandée -> * @param string $type Type d'objet sur lequel appliquer l'action -> * @param int $id Identifiant de l'objet -> * @param array $qui Description de l'auteur demandant l'autorisation -> * @param array $opt Options de cette autorisation -> * @return bool true s'il a le droit, false sinon -> **/ -> function autoriser_chapitre_supprimer_dist($faire, $type, $id, $qui, $opt) { -> return in_array($qui['statut'], array('0minirezo', '1comite')); -> } -> -> -> /** -> * Autorisation de créer l'élément (chapitre) dans un podcasts -> * -> * @param string $faire Action demandée -> * @param string $type Type d'objet sur lequel appliquer l'action -> * @param int $id Identifiant de l'objet -> * @param array $qui Description de l'auteur demandant l'autorisation -> * @param array $opt Options de cette autorisation -> * @return bool true s'il a le droit, false sinon -> **/ -> function autoriser_podcast_creerchapitredans_dist($faire, $type, $id, $qui, $opt) { -> return ($id and autoriser('voir', 'podcasts', $id) and autoriser('creer', 'chapitre')); -> } -diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/.backup/podcast/podcast_pipelines.php ../sites/fabrique.spip/tmp/cache/fabrique/podcast/podcast_pipelines.php -57a58,78 -> -> if ($e['type'] === 'podcast') { -> $flux['data'] .= recuperer_fond( -> 'prive/objets/liste/chapitres', -> array( -> 'titre' => _T('chapitre:titre_chapitres'), -> 'id_podcast' => $id_objet -> ) -> ); -> -> if (autoriser('creerchapitredans', 'podcasts', $id_objet)) { -> include_spip('inc/presentation'); -> $flux['data'] .= icone_verticale( -> _T('chapitre:icone_creer_chapitre'), -> generer_url_ecrire('chapitre_edit', "id_podcast=$id_objet"), -> 'chapitre-24.png', -> 'new', -> 'right' -> ) . "
"; -> } -> } -74a96,98 -> if ($flux['args']['type'] == 'podcast' and $nb = sql_countsel('spip_chapitres', array('id_podcast=' . $id))) { -> $texte .= '
' . singulier_ou_pluriel($nb, 'chapitre:info_1_chapitre', 'chapitre:info_nb_chapitres') . "
\n"; -> } -92a117,119 -> } -> if ($flux['args']['objet'] == 'podcast' and $id_podcast = intval($flux['args']['id_objet'])) { -> $flux['data']['chapitres'] = sql_countsel('spip_chapitres', 'id_podcast= ' . intval($id_podcast)); -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/objets/contenu: chapitre.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/objets/infos: chapitre.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/objets/liste: chapitres.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/squelettes/contenu: chapitre_edit.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/squelettes/hierarchie: chapitre.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/squelettes/hierarchie: chapitre_edit.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/saisies: chapitres.html -Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/saisies-vues: chapitres.html \ No newline at end of file +> Paquet généré le 2021-02-11 21:25:22 \ No newline at end of file diff --git a/fabrique_podcast.php b/fabrique_podcast.php index 4b4fac3..c2a8edd 100644 --- a/fabrique_podcast.php +++ b/fabrique_podcast.php @@ -2,7 +2,7 @@ /** * Fichier généré par la Fabrique de plugin v7 - * le 2021-02-11 09:30:30 + * le 2021-02-11 21:25:22 * * Ce fichier de sauvegarde peut servir à recréer * votre plugin avec le plugin «Fabrique» qui a servi à le créer. @@ -44,7 +44,7 @@ $data = array ( 'url' => '', ), ), - 'version' => '1.0.0', + 'version' => '1.1.2', 'auteur' => 'chankalan,vcalame', 'auteur_lien' => '', 'licence' => 'GNU/GPL', @@ -53,7 +53,7 @@ $data = array ( 'compatibilite' => '[3.2.8;3.3.*]', 'documentation' => '', 'administrations' => 'on', - 'schema' => '1.0.0', + 'schema' => '1.2.2', 'formulaire_config' => 'on', 'formulaire_config_titre' => '', 'fichiers' => @@ -112,7 +112,7 @@ $data = array ( array ( 'nom' => 'code', 'champ' => 'code', - 'sql' => 'tinytext NOT NULL DEFAULT \'\'', + 'sql' => 'varchar(25) NOT NULL DEFAULT \'\'', 'caracteristiques' => array ( 0 => 'editable', @@ -125,10 +125,25 @@ $data = array ( 'saisie_options' => '', ), 1 => + array ( + 'nom' => 'fichier', + 'champ' => 'fichier', + 'sql' => 'tinytext NOT NULL DEFAULT \'\'', + 'caracteristiques' => + array ( + 0 => 'editable', + 1 => 'versionne', + ), + 'recherche' => '', + 'saisie' => 'input', + 'explication' => 'url du fichier son', + 'saisie_options' => '', + ), + 2 => array ( 'nom' => 'durée', 'champ' => 'duree', - 'sql' => 'tinytext NOT NULL DEFAULT \'\'', + 'sql' => 'varchar(25) NOT NULL DEFAULT \'\'', 'caracteristiques' => array ( 0 => 'editable', diff --git a/formulaires/editer_podcast.html b/formulaires/editer_podcast.html index 6328c50..5208132 100644 --- a/formulaires/editer_podcast.html +++ b/formulaires/editer_podcast.html @@ -16,6 +16,10 @@ label=<:article:titre_article:/>})] + [(#SAISIE{input, fichier, + label=<:podcast:champ_fichier_label:/>, + explication=<:podcast:champ_fichier_explication:/> })] + [(#SAISIE{input, duree, label=<:podcast:champ_duree_label:/>, explication=<:podcast:champ_duree_explication:/> })] diff --git a/lang/podcast_fr.php b/lang/podcast_fr.php index 2bd3574..ef6748a 100644 --- a/lang/podcast_fr.php +++ b/lang/podcast_fr.php @@ -16,6 +16,8 @@ $GLOBALS[$GLOBALS['idx_lang']] = array( 'champ_code_label' => 'code', 'champ_duree_explication' => 'La durée de l\'émission sous la forme « ?? »', 'champ_duree_label' => 'durée', + 'champ_fichier_explication' => 'url du fichier son', + 'champ_fichier_label' => 'fichier', 'confirmer_supprimer_podcast' => 'Confirmez-vous la suppression de ce podcast ?', // I diff --git a/paquet.xml b/paquet.xml index 9feb7a3..0cc532b 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,15 +1,15 @@ diff --git a/podcast_administrations.php b/podcast_administrations.php index 8f780fe..6ae54d4 100644 --- a/podcast_administrations.php +++ b/podcast_administrations.php @@ -51,8 +51,12 @@ function podcast_upgrade($nom_meta_base_version, $version_cible) { # ); # ... - $maj['create'] = array(array('maj_tables', array('spip_podcasts'))); + $maj['create'] = array(array('maj_tables', array('spip_podcasts', 'spip_chapitres'))); +// $maj['create'] = array(array('maj_tables', array('spip_podcasts'))); $maj['1.1.0'] = array(array('maj_tables', array('spip_chapitres'))); + $maj['1.2.0'] = array(array('maj_tables', array('spip_podcasts,spip_chapitres'))); + $maj['1.2.1'] = array(array('maj_tables', array('spip_podcasts'))); + $maj['1.2.2'] = array(array('maj_tables', array('spip_podcasts'))); include_spip('base/upgrade'); maj_plugin($nom_meta_base_version, $version_cible, $maj); diff --git a/prive/objets/contenu/podcast.html b/prive/objets/contenu/podcast.html index ebdfa43..4c66ae0 100644 --- a/prive/objets/contenu/podcast.html +++ b/prive/objets/contenu/podcast.html @@ -4,6 +4,11 @@ (#CODE) ] +[
+
<:podcast:champ_fichier_label:/> :
+ (#FICHIER) +
] + [
<:podcast:champ_duree_label:/> :
(#DUREE) diff --git a/readme.md b/readme.md index c2fa59d..4dac780 100644 --- a/readme.md +++ b/readme.md @@ -2,5 +2,6 @@ Un nouvel objet éditorial pour SPIP : "Podcast", qui gère le lecteur Podlove spécialement pour l'émission de l'April "Libre à vous !" -- Podcast --- chapitre +* Article +** Podcast +*** Chapitre