From e0fe7e837fa7c2a9c8ddec4c9689da36cbb08336 Mon Sep 17 00:00:00 2001 From: chankalan Date: Wed, 10 Feb 2021 07:46:37 +0100 Subject: [PATCH] initial commit --- action/supprimer_podcast.php | 118 ++++++++ base/podcast.php | 70 +++++ fabrique_diff.diff | 272 ++++++++++++++++++ fabrique_podcast.php | 217 ++++++++++++++ formulaires/configurer_podcast.html | 22 ++ formulaires/editer_podcast.html | 28 ++ formulaires/editer_podcast.php | 135 +++++++++ lang/paquet-podcast_fr.php | 14 + lang/podcast_fr.php | 48 ++++ paquet.xml | 57 ++++ podcast_administrations.php | 91 ++++++ podcast_autorisations.php | 143 +++++++++ podcast_fonctions.php | 23 ++ podcast_options.php | 24 ++ podcast_pipelines.php | 96 +++++++ prive/objets/contenu/podcast.html | 12 + prive/objets/infos/podcast.html | 22 ++ prive/objets/liste/podcasts.html | 34 +++ .../contenu/configurer_podcast.html | 7 + prive/squelettes/contenu/podcast_edit.html | 36 +++ prive/squelettes/hierarchie/podcast.html | 10 + prive/squelettes/hierarchie/podcast_edit.html | 1 + saisies-vues/podcasts.html | 20 ++ saisies/podcasts.html | 13 + 24 files changed, 1513 insertions(+) create mode 100644 action/supprimer_podcast.php create mode 100644 base/podcast.php create mode 100644 fabrique_diff.diff create mode 100644 fabrique_podcast.php create mode 100644 formulaires/configurer_podcast.html create mode 100644 formulaires/editer_podcast.html create mode 100644 formulaires/editer_podcast.php create mode 100644 lang/paquet-podcast_fr.php create mode 100644 lang/podcast_fr.php create mode 100644 paquet.xml create mode 100644 podcast_administrations.php create mode 100644 podcast_autorisations.php create mode 100644 podcast_fonctions.php create mode 100644 podcast_options.php create mode 100644 podcast_pipelines.php create mode 100644 prive/objets/contenu/podcast.html create mode 100644 prive/objets/infos/podcast.html create mode 100644 prive/objets/liste/podcasts.html create mode 100644 prive/squelettes/contenu/configurer_podcast.html create mode 100644 prive/squelettes/contenu/podcast_edit.html create mode 100644 prive/squelettes/hierarchie/podcast.html create mode 100644 prive/squelettes/hierarchie/podcast_edit.html create mode 100644 saisies-vues/podcasts.html create mode 100644 saisies/podcasts.html diff --git a/action/supprimer_podcast.php b/action/supprimer_podcast.php new file mode 100644 index 0000000..bacd7f6 --- /dev/null +++ b/action/supprimer_podcast.php @@ -0,0 +1,118 @@ +, + * #URL_ACTION_AUTEUR{supprimer_podcast, #ID_PODCAST, #URL_ECRIRE{podcasts}}, + * danger, <:podcast:confirmer_supprimer_podcast:/>})] + * ] + * ``` + * + * @example + * ``` + * [(#AUTORISER{supprimer, podcast, #ID_PODCAST}|oui) + * [(#BOUTON_ACTION{ + * [(#CHEMIN_IMAGE{podcast-del-24.png}|balise_img{<:podcast:supprimer_podcast:/>}|concat{' ',#VAL{<:podcast:supprimer_podcast:/>}|wrap{}}|trim)], + * #URL_ACTION_AUTEUR{supprimer_podcast, #ID_PODCAST, #URL_ECRIRE{podcasts}}, + * icone s24 horizontale danger podcast-del-24, <:podcast:confirmer_supprimer_podcast:/>})] + * ] + * ``` + * + * @example + * ``` + * if (autoriser('supprimer', 'podcast', $id_podcast)) { + * $supprimer_podcast = charger_fonction('supprimer_podcast', 'action'); + * $supprimer_podcast($id_podcast); + * } + * ``` + * + * @param null|int $arg + * Identifiant à supprimer. + * En absence de id utilise l'argument de l'action sécurisée. +**/ +function action_supprimer_podcast_dist($arg=null) { + $need_confirm = false; + if (is_null($arg)){ + $securiser_action = charger_fonction('securiser_action', 'inc'); + $arg = $securiser_action(); + $need_confirm = true; + } + $arg = intval($arg); + + if ($need_confirm){ + $ok = confirmer_supprimer_podcast_avant_action(_T('podcast:confirmer_supprimer_podcast'), _T('item_oui') . '! ' . _T('podcast:supprimer_podcast')); + } + + // cas suppression + if (autoriser('supprimer', 'podcast', $arg)) { + if ($arg) { + $objet = sql_fetsel('*', 'spip_podcasts', 'id_podcast=' . sql_quote($arg)); + $qui = (!empty($GLOBALS['visiteur_session']['id_auteur']) ? 'auteur #' . $GLOBALS['visiteur_session']['id_auteur'] : 'IP ' . $GLOBALS['ip']); + spip_log("SUPPRESSION podcast#$arg par $qui : " . json_encode($objet), "suppressions" . _LOG_INFO_IMPORTANTE); + + sql_delete('spip_podcasts', 'id_podcast=' . sql_quote($arg)); + + // invalider le cache + include_spip('inc/invalideur'); + suivre_invalideur("id='podcast/$arg'"); + + } + else { + spip_log("action_supprimer_podcast_dist $arg pas compris"); + } + } +} + +/** + * Confirmer avant suppression si on arrive par un bouton action + * @param string $titre + * @param string $titre_bouton + * @param string|null $url_action + * @return bool + */ +function confirmer_supprimer_podcast_avant_action($titre, $titre_bouton, $url_action=null) { + + if (!$url_action) { + $url_action = self(); + $action = _request('action'); + $url_action = parametre_url($url_action, 'action', $action, '&'); + } + else { + $action = parametre_url($url_action, 'action'); + } + $arg = parametre_url($url_action, 'arg'); + $confirm = md5("$action:$arg:".realpath(__FILE__)); + if (_request('confirm_action') === $confirm) { + return true; + } + + $url_confirm = parametre_url($url_action, "confirm_action", $confirm, '&'); + include_spip("inc/filtres"); + $bouton_action = bouton_action($titre_bouton, $url_confirm); + $corps = "
$bouton_action
"; + + include_spip("inc/minipres"); + echo minipres($titre,$corps); + exit; +} diff --git a/base/podcast.php b/base/podcast.php new file mode 100644 index 0000000..41a7df8 --- /dev/null +++ b/base/podcast.php @@ -0,0 +1,70 @@ + 'podcast', + 'principale' => 'oui', + '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 ""', + 'maj' => 'TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP' + ), + 'key' => array( + 'PRIMARY KEY' => 'id_podcast', + 'KEY id_article' => 'id_article', + ), + 'titre' => 'code AS titre, "" AS lang', + #'date' => '', + 'champs_editables' => array('code', 'duree', 'id_article'), + 'champs_versionnes' => array('code', 'duree', 'id_article'), + 'rechercher_champs' => array(), + 'tables_jointures' => array(), + + + ); + + return $tables; +} diff --git a/fabrique_diff.diff b/fabrique_diff.diff new file mode 100644 index 0000000..308b175 --- /dev/null +++ b/fabrique_diff.diff @@ -0,0 +1,272 @@ +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/: action +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/: base +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/formulaires: editer_podcast.html +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/formulaires: editer_podcast.php +diff -r -x . -x .. -x fabrique_diff.diff -x fabrique_podcast.php ../sites/fabrique.spip/tmp/cache/fabrique/.backup/podcast/lang/podcast_fr.php ../sites/fabrique.spip/tmp/cache/fabrique/podcast/lang/podcast_fr.php +7a8 +> +10,11c11,12 +< // P +< 'podcast_titre' => 'podcast', +--- +> // A +> 'ajouter_lien_podcast' => 'Ajouter ce podcast', +14,16c15,34 +< 'cfg_exemple' => 'Exemple', +< 'cfg_exemple_explication' => 'Explication de cet exemple', +< 'cfg_titre_parametrages' => 'Paramétrages', +--- +> 'champ_code_explication' => 'Code de l\'émission sous la forme « 20210119 »', +> 'champ_code_label' => 'code', +> 'champ_duree_explication' => 'La durée de l\'émission sous la forme « ?? »', +> 'champ_duree_label' => 'durée', +> 'confirmer_supprimer_podcast' => 'Confirmez-vous la suppression de ce podcast ?', +> +> // I +> 'icone_creer_podcast' => 'Créer un podcast', +> 'icone_modifier_podcast' => 'Modifier ce podcast', +> 'info_1_podcast' => 'Un podcast', +> 'info_aucun_podcast' => 'Aucun podcast', +> 'info_nb_podcasts' => '@nb@ podcasts', +> 'info_podcasts_auteur' => 'Les podcasts de cet auteur', +> +> // R +> 'retirer_lien_podcast' => 'Retirer ce podcast', +> 'retirer_tous_liens_podcasts' => 'Retirer tous les podcasts', +> +> // S +> 'supprimer_podcast' => 'Supprimer ce podcast', +19c37,47 +< 'titre_page_configurer_podcast' => 'podcast', +--- +> 'texte_ajouter_podcast' => 'Ajouter un podcast', +> 'texte_changer_statut_podcast' => 'Ce podcast est :', +> 'texte_creer_associer_podcast' => 'Créer et associer un podcast', +> 'texte_definir_comme_traduction_podcast' => 'Ce podcast est une traduction du podcast numéro :', +> 'titre_langue_podcast' => 'Langue de ce podcast', +> 'titre_logo_podcast' => 'Logo de ce podcast', +> 'titre_objets_lies_podcast' => 'Liés à ce podcast', +> 'titre_page_podcasts' => 'Les podcasts', +> 'titre_podcast' => 'Podcast', +> 'titre_podcasts' => 'Podcasts', +> 'titre_podcasts_rubrique' => 'Podcasts de la rubrique', +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 +12c12 +< Paquet généré le 2021-02-10 06:55:22 +--- +> Paquet généré le 2021-02-10 07:11:23 +44a45,46 +> +> +47a50,54 +> +> +> +> +> +48a56 +> +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 +53a54,55 +> $maj['create'] = array(array('maj_tables', array('spip_podcasts'))); +> +76a79,88 +> sql_drop_table('spip_podcasts'); +> +> # Nettoyer les liens courants (le génie optimiser_base_disparus se chargera de nettoyer toutes les tables de liens) +> 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'))); +> # Nettoyer les versionnages et forums +> 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'))); +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 +39a40,143 +> +> // ----------------- +> // Objet podcasts +> +> +> /** +> * Autorisation de voir un élément de menu (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_podcasts_menu_dist($faire, $type, $id, $qui, $opt) { +> return true; +> } +> +> +> /** +> * Autorisation de voir (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_podcasts_voir_dist($faire, $type, $id, $qui, $opt) { +> return true; +> } +> +> /** +> * Autorisation de voir (podcast) +> * +> * @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_voir_dist($faire, $type, $id, $qui, $opt) { +> return true; +> } +> +> /** +> * Autorisation de créer (podcast) +> * +> * @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_creer_dist($faire, $type, $id, $qui, $opt) { +> return in_array($qui['statut'], array('0minirezo', '1comite')); +> } +> +> /** +> * Autorisation de modifier (podcast) +> * +> * @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_modifier_dist($faire, $type, $id, $qui, $opt) { +> return in_array($qui['statut'], array('0minirezo', '1comite')); +> } +> +> /** +> * Autorisation de supprimer (podcast) +> * +> * @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_supprimer_dist($faire, $type, $id, $qui, $opt) { +> return in_array($qui['statut'], array('0minirezo', '1comite')); +> } +> +> +> /** +> * Autorisation de créer l'élément (podcast) dans un articles +> * +> * @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_article_creerpodcastdans_dist($faire, $type, $id, $qui, $opt) { +> return ($id and autoriser('voir', 'articles', $id) and autoriser('creer', 'podcast')); +> } +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 +21a22,96 +> +> +> /** +> * Ajouter les objets sur les vues des parents directs +> * +> * @pipeline affiche_enfants +> * @param array $flux Données du pipeline +> * @return array Données du pipeline +> **/ +> function podcast_affiche_enfants($flux) { +> if ( +> $e = trouver_objet_exec($flux['args']['exec']) +> and $e['edition'] === false +> ) { +> $id_objet = $flux['args']['id_objet']; +> +> if ($e['type'] === 'article') { +> $flux['data'] .= recuperer_fond( +> 'prive/objets/liste/podcasts', +> array( +> 'titre' => _T('podcast:titre_podcasts'), +> 'id_article' => $id_objet +> ) +> ); +> +> if (autoriser('creerpodcastdans', 'articles', $id_objet)) { +> include_spip('inc/presentation'); +> $flux['data'] .= icone_verticale( +> _T('podcast:icone_creer_podcast'), +> generer_url_ecrire('podcast_edit', "id_article=$id_objet"), +> 'podcast-24.png', +> 'new', +> 'right' +> ) . "
"; +> } +> } +> } +> return $flux; +> } +> +> /** +> * Afficher le nombre d'éléments dans les parents +> * +> * @pipeline boite_infos +> * @param array $flux Données du pipeline +> * @return array Données du pipeline +> **/ +> function podcast_boite_infos($flux) { +> if (isset($flux['args']['type']) and isset($flux['args']['id']) and $id = intval($flux['args']['id'])) { +> $texte = ''; +> if ($flux['args']['type'] == 'article' and $nb = sql_countsel('spip_podcasts', array('id_article=' . $id))) { +> $texte .= '
' . singulier_ou_pluriel($nb, 'podcast:info_1_podcast', 'podcast:info_nb_podcasts') . "
\n"; +> } +> if ($texte and $p = strpos($flux['data'], '')) { +> $flux['data'] = substr_replace($flux['data'], $texte, $p, 0); +> } +> } +> return $flux; +> } +> +> +> /** +> * Compter les enfants d'un objet +> * +> * @pipeline objets_compte_enfants +> * @param array $flux Données du pipeline +> * @return array Données du pipeline +> **/ +> function podcast_objet_compte_enfants($flux) { +> if ($flux['args']['objet'] == 'article' and $id_article = intval($flux['args']['id_objet'])) { +> $flux['data']['podcasts'] = sql_countsel('spip_podcasts', 'id_article= ' . intval($id_article)); +> } +> +> return $flux; +> } +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive: objets +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/squelettes/contenu: podcast_edit.html +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive/squelettes: hierarchie +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/prive: themes +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/: saisies +Only in ../sites/fabrique.spip/tmp/cache/fabrique/podcast/: saisies-vues \ No newline at end of file diff --git a/fabrique_podcast.php b/fabrique_podcast.php new file mode 100644 index 0000000..4abe161 --- /dev/null +++ b/fabrique_podcast.php @@ -0,0 +1,217 @@ + + array ( + 'version' => 7, + ), + 'paquet' => + array ( + 'prefixe' => 'podcast', + 'nom' => 'podcast', + 'slogan' => 'Des podcasts et de la tendresse !', + 'description' => '', + 'logo' => + array ( + 0 => '', + ), + 'credits' => + array ( + 'logo' => + array ( + 'texte' => '', + 'url' => '', + ), + ), + 'version' => '1.0.0', + 'auteur' => 'chankalan,vcalame', + 'auteur_lien' => '', + 'licence' => 'GNU/GPL', + 'categorie' => 'multimedia', + 'etat' => 'dev', + 'compatibilite' => '[3.2.8;3.3.*]', + 'documentation' => '', + 'administrations' => 'on', + 'schema' => '1.0.0', + 'formulaire_config' => 'on', + 'formulaire_config_titre' => '', + 'fichiers' => + array ( + 0 => 'autorisations', + 1 => 'fonctions', + 2 => 'options', + 3 => 'pipelines', + ), + 'inserer' => + array ( + 'paquet' => '', + 'administrations' => + array ( + 'maj' => '', + 'desinstallation' => '', + 'fin' => '', + ), + 'base' => + array ( + 'tables' => + array ( + 'fin' => '', + ), + ), + ), + 'scripts' => + array ( + 'pre_copie' => '', + 'post_creation' => '', + ), + 'exemples' => 'on', + ), + 'objets' => + array ( + 0 => + array ( + 'nom' => 'podcasts', + 'nom_singulier' => 'podcast', + 'genre' => 'masculin', + 'logo' => + array ( + 0 => '', + 32 => '', + 24 => '', + 16 => '', + 12 => '', + ), + 'table' => 'spip_podcasts', + 'cle_primaire' => 'id_podcast', + 'cle_primaire_sql' => 'bigint(21) NOT NULL', + 'table_type' => 'podcast', + 'champs' => + array ( + 0 => + array ( + 'nom' => 'code', + 'champ' => 'code', + 'sql' => 'tinytext NOT NULL DEFAULT \'\'', + 'caracteristiques' => + array ( + 0 => 'editable', + 1 => 'versionne', + 2 => 'obligatoire', + ), + 'recherche' => '', + 'saisie' => 'input', + 'explication' => 'Code de l\'émission sous la forme « 20210119 »', + 'saisie_options' => '', + ), + 1 => + array ( + 'nom' => 'durée', + 'champ' => 'duree', + 'sql' => 'tinytext NOT NULL DEFAULT \'\'', + 'caracteristiques' => + array ( + 0 => 'editable', + 1 => 'versionne', + ), + 'recherche' => '', + 'saisie' => 'input', + 'explication' => 'La durée de l\'émission sous la forme « ?? »', + 'saisie_options' => '', + ), + ), + 'champ_titre' => 'code', + 'champ_date' => '', + 'champ_date_ignore' => 'on', + 'statut' => '', + 'chaines' => + array ( + 'titre_objets' => 'Podcasts', + 'titre_page_objets' => 'Les podcasts', + 'titre_objet' => 'Podcast', + 'info_aucun_objet' => 'Aucun podcast', + 'info_1_objet' => 'Un podcast', + 'info_nb_objets' => '@nb@ podcasts', + 'icone_creer_objet' => 'Créer un podcast', + 'icone_modifier_objet' => 'Modifier ce podcast', + 'titre_logo_objet' => 'Logo de ce podcast', + 'titre_langue_objet' => 'Langue de ce podcast', + 'texte_definir_comme_traduction_objet' => 'Ce podcast est une traduction du podcast numéro :', + 'titre_\\objets_lies_objet' => 'Liés à ce podcast', + 'titre_objets_rubrique' => 'Podcasts de la rubrique', + 'info_objets_auteur' => 'Les podcasts de cet auteur', + 'retirer_lien_objet' => 'Retirer ce podcast', + 'retirer_tous_liens_objets' => 'Retirer tous les podcasts', + 'ajouter_lien_objet' => 'Ajouter ce podcast', + 'texte_ajouter_objet' => 'Ajouter un podcast', + 'texte_creer_associer_objet' => 'Créer et associer un podcast', + 'texte_changer_statut_objet' => 'Ce podcast est :', + 'supprimer_objet' => 'Supprimer ce podcast', + 'confirmer_supprimer_objet' => 'Confirmez-vous la suppression de ce podcast ?', + ), + 'liaison_directe' => 'spip_articles', + 'table_liens' => '', + 'afficher_liens' => '', + 'roles' => '', + 'auteurs_liens' => '', + 'vue_auteurs_liens' => '', + 'saisies' => + array ( + 0 => 'objets', + ), + 'autorisations' => + array ( + 'objets_voir' => '', + 'objet_creer' => '', + 'objet_voir' => '', + 'objet_modifier' => '', + 'objet_supprimer' => 'redacteur', + 'associerobjet' => 'redacteur', + ), + 'boutons' => + array ( + 0 => 'menu_edition', + ), + ), + ), + 'images' => + array ( + 'paquet' => + array ( + 'logo' => + array ( + 0 => + array ( + 'extension' => '', + 'contenu' => '', + ), + ), + ), + 'objets' => + array ( + 0 => + array ( + ), + ), + ), +); diff --git a/formulaires/configurer_podcast.html b/formulaires/configurer_podcast.html new file mode 100644 index 0000000..af73878 --- /dev/null +++ b/formulaires/configurer_podcast.html @@ -0,0 +1,22 @@ +
+ +

<:podcast:cfg_titre_parametrages:/>

+ + [

(#ENV*{message_ok})

] + [

(#ENV*{message_erreur})

] + +
+
+ #ACTION_FORMULAIRE + +
+ [(#SAISIE{input, exemple, + label=<:podcast:cfg_exemple:/>, + explication=<:podcast:cfg_exemple_explication:/>})] +
+ + +

 

+
+
+
diff --git a/formulaires/editer_podcast.html b/formulaires/editer_podcast.html new file mode 100644 index 0000000..196258b --- /dev/null +++ b/formulaires/editer_podcast.html @@ -0,0 +1,28 @@ +
+ [

(#ENV**{message_ok})

] + [

(#ENV*{message_erreur})

] + + [(#ENV{editable}) +
+ #ACTION_FORMULAIRE + +
+ + [(#SAISIE{input, code, obligatoire=oui, + label=<:podcast:champ_code_label:/>, + explication=<:podcast:champ_code_explication:/> })] + + [(#SAISIE{selecteur_article, id_article, obligatoire=oui, + label=<:article:titre_article:/>})] + + [(#SAISIE{input, duree, + label=<:podcast:champ_duree_label:/>, + explication=<:podcast:champ_duree_explication:/> })] + +
+ [(#REM) ajouter les saisies supplementaires : extra et autre, a cet endroit ] + +

+
+ ] +
diff --git a/formulaires/editer_podcast.php b/formulaires/editer_podcast.php new file mode 100644 index 0000000..4e4e0ec --- /dev/null +++ b/formulaires/editer_podcast.php @@ -0,0 +1,135 @@ + '', + 'podcast_nom' => 'podcast', + 'podcast_slogan' => 'Des podcasts et de la tendresse !', +); diff --git a/lang/podcast_fr.php b/lang/podcast_fr.php new file mode 100644 index 0000000..2bd3574 --- /dev/null +++ b/lang/podcast_fr.php @@ -0,0 +1,48 @@ + 'Ajouter ce podcast', + + // C + 'champ_code_explication' => 'Code de l\'émission sous la forme « 20210119 »', + 'champ_code_label' => 'code', + 'champ_duree_explication' => 'La durée de l\'émission sous la forme « ?? »', + 'champ_duree_label' => 'durée', + 'confirmer_supprimer_podcast' => 'Confirmez-vous la suppression de ce podcast ?', + + // I + 'icone_creer_podcast' => 'Créer un podcast', + 'icone_modifier_podcast' => 'Modifier ce podcast', + 'info_1_podcast' => 'Un podcast', + 'info_aucun_podcast' => 'Aucun podcast', + 'info_nb_podcasts' => '@nb@ podcasts', + 'info_podcasts_auteur' => 'Les podcasts de cet auteur', + + // R + 'retirer_lien_podcast' => 'Retirer ce podcast', + 'retirer_tous_liens_podcasts' => 'Retirer tous les podcasts', + + // S + 'supprimer_podcast' => 'Supprimer ce podcast', + + // T + 'texte_ajouter_podcast' => 'Ajouter un podcast', + 'texte_changer_statut_podcast' => 'Ce podcast est :', + 'texte_creer_associer_podcast' => 'Créer et associer un podcast', + 'texte_definir_comme_traduction_podcast' => 'Ce podcast est une traduction du podcast numéro :', + 'titre_langue_podcast' => 'Langue de ce podcast', + 'titre_logo_podcast' => 'Logo de ce podcast', + 'titre_objets_lies_podcast' => 'Liés à ce podcast', + 'titre_page_podcasts' => 'Les podcasts', + 'titre_podcast' => 'Podcast', + 'titre_podcasts' => 'Podcasts', + 'titre_podcasts_rubrique' => 'Podcasts de la rubrique', +); diff --git a/paquet.xml b/paquet.xml new file mode 100644 index 0000000..dd0fa97 --- /dev/null +++ b/paquet.xml @@ -0,0 +1,57 @@ + + + + podcast + + + + chankalan,vcalame + + + + GNU/GPL + + + + + + + + + + + + + + + + diff --git a/podcast_administrations.php b/podcast_administrations.php new file mode 100644 index 0000000..f9cdacb --- /dev/null +++ b/podcast_administrations.php @@ -0,0 +1,91 @@ + "Texte de l'exemple")) + #); + # + # $maj['1.1.0'] = array(array('sql_alter','TABLE spip_xx RENAME TO spip_yy')); + # $maj['1.2.0'] = array(array('sql_alter','TABLE spip_xx DROP COLUMN id_auteur')); + # $maj['1.3.0'] = array( + # array('sql_alter','TABLE spip_xx CHANGE numero numero int(11) default 0 NOT NULL'), + # array('sql_alter','TABLE spip_xx CHANGE texte petit_texte mediumtext NOT NULL default \'\''), + # ); + # ... + + $maj['create'] = array(array('maj_tables', array('spip_podcasts'))); + + include_spip('base/upgrade'); + maj_plugin($nom_meta_base_version, $version_cible, $maj); +} + + +/** + * Fonction de désinstallation du plugin podcast. + * + * Vous devez : + * + * - nettoyer toutes les données ajoutées par le plugin et son utilisation + * - supprimer les tables et les champs créés par le plugin. + * + * @param string $nom_meta_base_version + * Nom de la meta informant de la version du schéma de données du plugin installé dans SPIP + * @return void +**/ +function podcast_vider_tables($nom_meta_base_version) { + # quelques exemples + # (que vous pouvez supprimer !) + # sql_drop_table('spip_xx'); + # sql_drop_table('spip_xx_liens'); + + sql_drop_table('spip_podcasts'); + + # Nettoyer les liens courants (le génie optimiser_base_disparus se chargera de nettoyer toutes les tables de liens) + 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'))); + # Nettoyer les versionnages et forums + 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'))); + + effacer_meta($nom_meta_base_version); +} diff --git a/podcast_autorisations.php b/podcast_autorisations.php new file mode 100644 index 0000000..0559148 --- /dev/null +++ b/podcast_autorisations.php @@ -0,0 +1,143 @@ + $type = 'podcast' + // au choix : + return autoriser('webmestre', $type, $id, $qui, $opt); // seulement les webmestres + return autoriser('configurer', '', $id, $qui, $opt); // seulement les administrateurs complets + return $qui['statut'] == '0minirezo'; // seulement les administrateurs (même les restreints) + // ... +} +*/ + +// ----------------- +// Objet podcasts + + +/** + * Autorisation de voir un élément de menu (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_podcasts_menu_dist($faire, $type, $id, $qui, $opt) { + return true; +} + + +/** +* Autorisation de voir (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_podcasts_voir_dist($faire, $type, $id, $qui, $opt) { + return true; +} + +/** +* Autorisation de voir (podcast) +* +* @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_voir_dist($faire, $type, $id, $qui, $opt) { + return true; +} + +/** + * Autorisation de créer (podcast) + * + * @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_creer_dist($faire, $type, $id, $qui, $opt) { + return in_array($qui['statut'], array('0minirezo', '1comite')); +} + +/** + * Autorisation de modifier (podcast) + * + * @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_modifier_dist($faire, $type, $id, $qui, $opt) { + return in_array($qui['statut'], array('0minirezo', '1comite')); +} + +/** + * Autorisation de supprimer (podcast) + * + * @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_supprimer_dist($faire, $type, $id, $qui, $opt) { + return in_array($qui['statut'], array('0minirezo', '1comite')); +} + + +/** + * Autorisation de créer l'élément (podcast) dans un articles + * + * @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_article_creerpodcastdans_dist($faire, $type, $id, $qui, $opt) { + return ($id and autoriser('voir', 'articles', $id) and autoriser('creer', 'podcast')); +} diff --git a/podcast_fonctions.php b/podcast_fonctions.php new file mode 100644 index 0000000..da037fc --- /dev/null +++ b/podcast_fonctions.php @@ -0,0 +1,23 @@ + _T('podcast:titre_podcasts'), + 'id_article' => $id_objet + ) + ); + + if (autoriser('creerpodcastdans', 'articles', $id_objet)) { + include_spip('inc/presentation'); + $flux['data'] .= icone_verticale( + _T('podcast:icone_creer_podcast'), + generer_url_ecrire('podcast_edit', "id_article=$id_objet"), + 'podcast-24.png', + 'new', + 'right' + ) . "
"; + } + } + } + return $flux; +} + +/** + * Afficher le nombre d'éléments dans les parents + * + * @pipeline boite_infos + * @param array $flux Données du pipeline + * @return array Données du pipeline +**/ +function podcast_boite_infos($flux) { + if (isset($flux['args']['type']) and isset($flux['args']['id']) and $id = intval($flux['args']['id'])) { + $texte = ''; + if ($flux['args']['type'] == 'article' and $nb = sql_countsel('spip_podcasts', array('id_article=' . $id))) { + $texte .= '
' . singulier_ou_pluriel($nb, 'podcast:info_1_podcast', 'podcast:info_nb_podcasts') . "
\n"; + } + if ($texte and $p = strpos($flux['data'], '')) { + $flux['data'] = substr_replace($flux['data'], $texte, $p, 0); + } + } + return $flux; +} + + +/** + * Compter les enfants d'un objet + * + * @pipeline objets_compte_enfants + * @param array $flux Données du pipeline + * @return array Données du pipeline +**/ +function podcast_objet_compte_enfants($flux) { + if ($flux['args']['objet'] == 'article' and $id_article = intval($flux['args']['id_objet'])) { + $flux['data']['podcasts'] = sql_countsel('spip_podcasts', 'id_article= ' . intval($id_article)); + } + + return $flux; +} diff --git a/prive/objets/contenu/podcast.html b/prive/objets/contenu/podcast.html new file mode 100644 index 0000000..ebdfa43 --- /dev/null +++ b/prive/objets/contenu/podcast.html @@ -0,0 +1,12 @@ + +[
+
<:podcast:champ_code_label:/> :
+ (#CODE) +
] + +[
+
<:podcast:champ_duree_label:/> :
+ (#DUREE) +
] + + diff --git a/prive/objets/infos/podcast.html b/prive/objets/infos/podcast.html new file mode 100644 index 0000000..9a9d5a9 --- /dev/null +++ b/prive/objets/infos/podcast.html @@ -0,0 +1,22 @@ + +
+[(#SET{texte_objet,<:podcast:titre_podcast:/>})] +
<:titre_cadre_numero_objet{objet=#GET{texte_objet}}:/>

#ID_PODCAST

+ +
+ + [(#VAL{redirect} + |generer_url_action{type=podcast&id=#ID_PODCAST} + |parametre_url{var_mode,calcul} + |icone_horizontale{<:icone_voir_en_ligne:>,racine})] + + [(#AUTORISER{supprimer, podcast, #ID_PODCAST}|oui) +
+ [(#BOUTON_ACTION{ + [(#CHEMIN_IMAGE{podcast-del-24.png}|balise_img{<:podcast:supprimer_podcast:/>}|concat{' ',#VAL{<:podcast:supprimer_podcast:/>}|wrap{}}|trim)], + #URL_ACTION_AUTEUR{supprimer_podcast, #ID_PODCAST, #URL_ECRIRE{podcasts}}, + icone s24 horizontale danger podcast-del-24, <:podcast:confirmer_supprimer_podcast:/>})] + ] + +
+ diff --git a/prive/objets/liste/podcasts.html b/prive/objets/liste/podcasts.html new file mode 100644 index 0000000..4e5c13a --- /dev/null +++ b/prive/objets/liste/podcasts.html @@ -0,0 +1,34 @@ +[(#SET{defaut_tri,#ARRAY{ + code,1, + id_podcast,1, + points,-1 +}})] +#ANCRE_PAGINATION +
+ + [] + + + + + + + + + + + + + + + + +
(#ENV*{titre,#GRAND_TOTAL|singulier_ou_pluriel{podcast:info_1_podcast,podcast:info_nb_podcasts}})
[(#TRI{code,<:podcast:champ_code_label:/>,ajax})][(#TRI{id_podcast,<:info_numero_abbreviation:/>,ajax})]
[(#CHEMIN_IMAGE{podcast-16.png}|balise_img)][(#LOGO_PODCAST|image_reduire{20,26})][(#RANG). ]#CODE[(#AUTORISER{modifier,podcast,#ID_PODCAST}|?{ + #ID_PODCAST, + #ID_PODCAST + })]
+[

(#PAGINATION{prive})

] +
+
[ +
(#ENV*{sinon,''})
+] diff --git a/prive/squelettes/contenu/configurer_podcast.html b/prive/squelettes/contenu/configurer_podcast.html new file mode 100644 index 0000000..09282c2 --- /dev/null +++ b/prive/squelettes/contenu/configurer_podcast.html @@ -0,0 +1,7 @@ +[(#AUTORISER{configurer,_podcast}|sinon_interdire_acces)] + +

<:podcast:titre_page_configurer_podcast:/>

+ +
+ #FORMULAIRE_CONFIGURER_PODCAST +
diff --git a/prive/squelettes/contenu/podcast_edit.html b/prive/squelettes/contenu/podcast_edit.html new file mode 100644 index 0000000..0e4bfd7 --- /dev/null +++ b/prive/squelettes/contenu/podcast_edit.html @@ -0,0 +1,36 @@ +[(#ID_PODCAST|oui) + [(#AUTORISER{modifier,podcast,#ID_PODCAST}|sinon_interdire_acces)] + [(#SET{id_parent,#INFO_ID_ARTICLE{podcast,#ID_PODCAST}})] +] + +[(#ID_PODCAST|non) + #SET{id_parent,#ENV{id_article,#ENV{id_parent}}} + [(#GET{id_parent}|non|ou{[(#AUTORISER{creerpodcastdans, article, #GET{id_parent}})]}|sinon_interdire_acces)] +] + +#SET{redirect,#ENV{redirect}|sinon{#ID_PODCAST|?{#ID_PODCAST|generer_url_entite{podcast},#GET{id_parent}|?{#GET{id_parent}|generer_url_entite{article},#URL_ECRIRE{articles}}}}} + + + +
+
+ [(#ID_PODCAST|oui) + [(#GET{redirect}|icone_verticale{<:icone_retour:/>,podcast,'',left retour[(#ENV{retourajax,''}|oui)ajax preload]})] + ] + [ + [(#ID_PODCAST|?{<:podcast:icone_modifier_podcast:/>,<:podcast:icone_creer_podcast:/>})] +

(#ENV{titre,#INFO_CODE{podcast,#ID_PODCAST}|sinon{<:info_sans_titre:/>}})

+ ] +
+ +#SET{redirect,#ENV{redirect,#ID_PODCAST|generer_url_entite{podcast}}} +[(#ENV{retourajax,''}|oui) + #SET{redirect,'javascript:if (window.jQuery) jQuery(".entete-formulaire .retour a").followLink();'} +
+] + [(#FORMULAIRE_EDITER_PODCAST{#ENV{id_podcast,oui}, #GET{id_parent}, #GET{redirect}})] +[(#ENV{retourajax,''}|oui) +
+ +] +
diff --git a/prive/squelettes/hierarchie/podcast.html b/prive/squelettes/hierarchie/podcast.html new file mode 100644 index 0000000..0507e9a --- /dev/null +++ b/prive/squelettes/hierarchie/podcast.html @@ -0,0 +1,10 @@ + +<:podcast:titre_podcasts:/> + +> [(#URL_ECRIRE{article,id_article=#ID_ARTICLE}|lien_ou_expose{#INFO_TITRE{articles,#ID_ARTICLE},''})] +> #CODE + +[(#ENV{id_article}|oui) + > [(#URL_ECRIRE{article,id_article=#ID_ARTICLE}|lien_ou_expose{#INFO_TITRE{articles,#ID_ARTICLE},''})] +]> <:ecrire:info_sans_titre:/> + diff --git a/prive/squelettes/hierarchie/podcast_edit.html b/prive/squelettes/hierarchie/podcast_edit.html new file mode 100644 index 0000000..46c219d --- /dev/null +++ b/prive/squelettes/hierarchie/podcast_edit.html @@ -0,0 +1 @@ + diff --git a/saisies-vues/podcasts.html b/saisies-vues/podcasts.html new file mode 100644 index 0000000..7a72929 --- /dev/null +++ b/saisies-vues/podcasts.html @@ -0,0 +1,20 @@ + + [(#SET{valeur,[(#ENV*{valeur}|is_array|?{[(#ENV*{valeur})],[(#ENV*{valeur}|explode{','})]})]})] + +
    + +
  • #CODE (#ID_PODCAST)
  • + +
+
+ [(#ENV*{sans_reponse}|propre)] + + + +

#CODE (#ID_PODCAST)

+ + [(#ENV*{sans_reponse}|propre)] + + diff --git a/saisies/podcasts.html b/saisies/podcasts.html new file mode 100644 index 0000000..fb09d5c --- /dev/null +++ b/saisies/podcasts.html @@ -0,0 +1,13 @@ +[(#ENV{multiple}|oui) + [(#SET{valeur,[(#ENV*{valeur}|is_array|?{[(#ENV*{valeur})],[(#ENV*{valeur}|explode{','})]})]})] +] +