
commit
e0fe7e837f
24 changed files with 1513 additions and 0 deletions
@ -0,0 +1,118 @@
|
||||
<?php |
||||
/** |
||||
* Utilisation de l'action supprimer pour l'objet podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Action |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* Action pour supprimer un·e podcast |
||||
* |
||||
* Vérifier l'autorisation avant d'appeler l'action. |
||||
* |
||||
* @example |
||||
* ``` |
||||
* [(#AUTORISER{supprimer, podcast, #ID_PODCAST}|oui) |
||||
* [(#BOUTON_ACTION{<:podcast:supprimer_podcast:/>, |
||||
* #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{<b>}}|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 = "<div style='text-align:center;'>$bouton_action</div>"; |
||||
|
||||
include_spip("inc/minipres"); |
||||
echo minipres($titre,$corps); |
||||
exit; |
||||
} |
@ -0,0 +1,70 @@
|
||||
<?php |
||||
/** |
||||
* Déclarations relatives à la base de données |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Pipelines |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Déclaration des alias de tables et filtres automatiques de champs |
||||
* |
||||
* @pipeline declarer_tables_interfaces |
||||
* @param array $interfaces |
||||
* Déclarations d'interface pour le compilateur |
||||
* @return array |
||||
* Déclarations d'interface pour le compilateur |
||||
*/ |
||||
function podcast_declarer_tables_interfaces($interfaces) { |
||||
|
||||
$interfaces['table_des_tables']['podcasts'] = 'podcasts'; |
||||
|
||||
return $interfaces; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Déclaration des objets éditoriaux |
||||
* |
||||
* @pipeline declarer_tables_objets_sql |
||||
* @param array $tables |
||||
* Description des tables |
||||
* @return array |
||||
* Description complétée des tables |
||||
*/ |
||||
function podcast_declarer_tables_objets_sql($tables) { |
||||
|
||||
$tables['spip_podcasts'] = array( |
||||
'type' => '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; |
||||
} |
@ -0,0 +1,22 @@
|
||||
<div class="formulaire_spip formulaire_configurer formulaire_#FORM"> |
||||
|
||||
<h3 class="titrem"><:podcast:cfg_titre_parametrages:/></h3> |
||||
|
||||
[<p class="reponse_formulaire reponse_formulaire_ok">(#ENV*{message_ok})</p>] |
||||
[<p class="reponse_formulaire reponse_formulaire_erreur">(#ENV*{message_erreur})</p>] |
||||
|
||||
<form method="post" action="#ENV{action}"> |
||||
<div> |
||||
#ACTION_FORMULAIRE |
||||
|
||||
<div class="editer-groupe"> |
||||
[(#SAISIE{input, exemple, |
||||
label=<:podcast:cfg_exemple:/>, |
||||
explication=<:podcast:cfg_exemple_explication:/>})] |
||||
</div> |
||||
|
||||
<input type="hidden" name="_meta_casier" value="podcast" /> |
||||
<p class="boutons"><span class="image_loading"> </span><input type="submit" class="submit" value="<:bouton_enregistrer|attribut_html:/>" /></p> |
||||
</div> |
||||
</form> |
||||
</div> |
@ -0,0 +1,28 @@
|
||||
<div class='formulaire_spip formulaire_editer formulaire_#FORM formulaire_#FORM-#ENV{id_podcast,nouveau}'> |
||||
[<p class="reponse_formulaire reponse_formulaire_ok">(#ENV**{message_ok})</p>] |
||||
[<p class="reponse_formulaire reponse_formulaire_erreur">(#ENV*{message_erreur})</p>] |
||||
|
||||
[(#ENV{editable}) |
||||
<form method="post" action="#ENV{action}"><div> |
||||
#ACTION_FORMULAIRE |
||||
<input type="hidden" name="id_podcast" value="#ENV{id_podcast}" /> |
||||
<div class="editer-groupe"> |
||||
|
||||
[(#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:/> })] |
||||
|
||||
</div> |
||||
[(#REM) ajouter les saisies supplementaires : extra et autre, a cet endroit ] |
||||
<!--extra--> |
||||
<p class="boutons"><input type="submit" class="submit" value="<:bouton_enregistrer|attribut_html:/>" /></p> |
||||
</div></form> |
||||
] |
||||
</div> |
@ -0,0 +1,135 @@
|
||||
<?php |
||||
/** |
||||
* Gestion du formulaire de d'édition de podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Formulaires |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
include_spip('inc/actions'); |
||||
include_spip('inc/editer'); |
||||
|
||||
|
||||
/** |
||||
* Identifier le formulaire en faisant abstraction des paramètres qui ne représentent pas l'objet edité |
||||
* |
||||
* @param int|string $id_podcast |
||||
* Identifiant du podcast. 'new' pour un nouveau podcast. |
||||
* @param int $id_article |
||||
* Identifiant de l'objet parent (si connu) |
||||
* @param string $retour |
||||
* URL de redirection après le traitement |
||||
* @param int $lier_trad |
||||
* Identifiant éventuel d'un podcast source d'une traduction |
||||
* @param string $config_fonc |
||||
* Nom de la fonction ajoutant des configurations particulières au formulaire |
||||
* @param array $row |
||||
* Valeurs de la ligne SQL du podcast, si connu |
||||
* @param string $hidden |
||||
* Contenu HTML ajouté en même temps que les champs cachés du formulaire. |
||||
* @return string |
||||
* Hash du formulaire |
||||
*/ |
||||
function formulaires_editer_podcast_identifier_dist($id_podcast = 'new', $id_article = 0, $retour = '', $lier_trad = 0, $config_fonc = '', $row = array(), $hidden = '') { |
||||
return serialize(array(intval($id_podcast))); |
||||
} |
||||
|
||||
/** |
||||
* Chargement du formulaire d'édition de podcast |
||||
* |
||||
* Déclarer les champs postés et y intégrer les valeurs par défaut |
||||
* |
||||
* @uses formulaires_editer_objet_charger() |
||||
* |
||||
* @param int|string $id_podcast |
||||
* Identifiant du podcast. 'new' pour un nouveau podcast. |
||||
* @param int $id_article |
||||
* Identifiant de l'objet parent (si connu) |
||||
* @param string $retour |
||||
* URL de redirection après le traitement |
||||
* @param int $lier_trad |
||||
* Identifiant éventuel d'un podcast source d'une traduction |
||||
* @param string $config_fonc |
||||
* Nom de la fonction ajoutant des configurations particulières au formulaire |
||||
* @param array $row |
||||
* Valeurs de la ligne SQL du podcast, si connu |
||||
* @param string $hidden |
||||
* Contenu HTML ajouté en même temps que les champs cachés du formulaire. |
||||
* @return array |
||||
* Environnement du formulaire |
||||
*/ |
||||
function formulaires_editer_podcast_charger_dist($id_podcast = 'new', $id_article = 0, $retour = '', $lier_trad = 0, $config_fonc = '', $row = array(), $hidden = '') { |
||||
$valeurs = formulaires_editer_objet_charger('podcast', $id_podcast, $id_article, $lier_trad, $retour, $config_fonc, $row, $hidden); |
||||
if (!$valeurs['id_article']) { |
||||
$valeurs['id_article'] = $id_article; |
||||
} |
||||
return $valeurs; |
||||
} |
||||
|
||||
/** |
||||
* Vérifications du formulaire d'édition de podcast |
||||
* |
||||
* Vérifier les champs postés et signaler d'éventuelles erreurs |
||||
* |
||||
* @uses formulaires_editer_objet_verifier() |
||||
* |
||||
* @param int|string $id_podcast |
||||
* Identifiant du podcast. 'new' pour un nouveau podcast. |
||||
* @param int $id_article |
||||
* Identifiant de l'objet parent (si connu) |
||||
* @param string $retour |
||||
* URL de redirection après le traitement |
||||
* @param int $lier_trad |
||||
* Identifiant éventuel d'un podcast source d'une traduction |
||||
* @param string $config_fonc |
||||
* Nom de la fonction ajoutant des configurations particulières au formulaire |
||||
* @param array $row |
||||
* Valeurs de la ligne SQL du podcast, si connu |
||||
* @param string $hidden |
||||
* Contenu HTML ajouté en même temps que les champs cachés du formulaire. |
||||
* @return array |
||||
* Tableau des erreurs |
||||
*/ |
||||
function formulaires_editer_podcast_verifier_dist($id_podcast = 'new', $id_article = 0, $retour = '', $lier_trad = 0, $config_fonc = '', $row = array(), $hidden = '') { |
||||
$erreurs = array(); |
||||
|
||||
$erreurs = formulaires_editer_objet_verifier('podcast', $id_podcast, array('code', 'id_article')); |
||||
|
||||
return $erreurs; |
||||
} |
||||
|
||||
/** |
||||
* Traitement du formulaire d'édition de podcast |
||||
* |
||||
* Traiter les champs postés |
||||
* |
||||
* @uses formulaires_editer_objet_traiter() |
||||
* |
||||
* @param int|string $id_podcast |
||||
* Identifiant du podcast. 'new' pour un nouveau podcast. |
||||
* @param int $id_article |
||||
* Identifiant de l'objet parent (si connu) |
||||
* @param string $retour |
||||
* URL de redirection après le traitement |
||||
* @param int $lier_trad |
||||
* Identifiant éventuel d'un podcast source d'une traduction |
||||
* @param string $config_fonc |
||||
* Nom de la fonction ajoutant des configurations particulières au formulaire |
||||
* @param array $row |
||||
* Valeurs de la ligne SQL du podcast, si connu |
||||
* @param string $hidden |
||||
* Contenu HTML ajouté en même temps que les champs cachés du formulaire. |
||||
* @return array |
||||
* Retours des traitements |
||||
*/ |
||||
function formulaires_editer_podcast_traiter_dist($id_podcast = 'new', $id_article = 0, $retour = '', $lier_trad = 0, $config_fonc = '', $row = array(), $hidden = '') { |
||||
$retours = formulaires_editer_objet_traiter('podcast', $id_podcast, $id_article, $lier_trad, $retour, $config_fonc, $row, $hidden); |
||||
return $retours; |
||||
} |
@ -0,0 +1,14 @@
|
||||
<?php |
||||
// This is a SPIP language file -- Ceci est un fichier langue de SPIP |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
$GLOBALS[$GLOBALS['idx_lang']] = array( |
||||
|
||||
// P |
||||
'podcast_description' => '', |
||||
'podcast_nom' => 'podcast', |
||||
'podcast_slogan' => 'Des podcasts et de la tendresse !', |
||||
); |
@ -0,0 +1,57 @@
|
||||
<paquet |
||||
prefix="podcast" |
||||
categorie="multimedia" |
||||
version="1.0.0" |
||||
etat="dev" |
||||
compatibilite="[3.2.8;3.3.*]" |
||||
logo="" |
||||
documentation="" |
||||
schema="1.0.0" |
||||
> |
||||
<!-- |
||||
Paquet généré le 2021-02-10 07:11:23 |
||||
(Vous pouvez bien entendu supprimer ces commentaires) |
||||
--> |
||||
|
||||
<nom>podcast</nom> |
||||
<!-- Des podcasts et de la tendresse ! --> |
||||
|
||||
<!-- cette balise peut être présente plusieurs fois s'il y a plusieurs auteurs --> |
||||
<auteur>chankalan,vcalame</auteur> |
||||
<!-- cette balise peut être présente pour indiquer d’autres crédits --> |
||||
<!-- <credit lien="https://example.com/icon">Logo by @example</credit> --> |
||||
|
||||
<licence>GNU/GPL</licence> |
||||
|
||||
<!-- |
||||
Exemple de commandes |
||||
* dependances |
||||
<necessite nom="saisies" compatibilite="[3.23.2;]" /> |
||||
<utilise nom="saisies" compatibilite="[3.23.2;]" /> |
||||
<lib nom="simplehtmldom" lien="http://chemin_vers_archive.zip" /> |
||||
* pipelines |
||||
<pipeline nom="autoriser" inclure="podcast_autorisations.php" /> |
||||
<pipeline nom="insert_head" inclure="podcast_pipelines.php" /> |
||||
* declarer un pipeline |
||||
<pipeline nom="mon_pipeline" action="" /> |
||||
* parents de menus de SPIP : |
||||
menu_accueil (à éviter), menu_edition, menu_publication, |
||||
menu_activite, menu_squelette, menu_administration, menu_configuration |
||||
<menu nom="podcast" titre="podcast:podcast_titre" parent="menu_edition" icone="images/podcast-16.png" /> |
||||
* parents d'onglets... configuration, plugins, statistiques, ... |
||||
<onglet nom="podcast" titre="podcast:podcast_titre" parent="configuration" icone="images/podcast-24.png" /> |
||||
--> |
||||
|
||||
<necessite nom="saisies" compatibilite="[3.23.2;]" /> |
||||
|
||||
|
||||
<pipeline nom="autoriser" inclure="podcast_autorisations.php" /> |
||||
|
||||
<pipeline nom="declarer_tables_objets_sql" inclure="base/podcast.php" /> |
||||
<pipeline nom="declarer_tables_interfaces" inclure="base/podcast.php" /> |
||||
<pipeline nom="affiche_enfants" inclure="podcast_pipelines.php" /> |
||||
<pipeline nom="boite_infos" inclure="podcast_pipelines.php" /> |
||||
<pipeline nom="objet_compte_enfants" inclure="podcast_pipelines.php" /> |
||||
|
||||
<menu nom="podcasts" titre="podcast:titre_podcasts" parent="menu_edition" icone="images/podcast-16.png" action="podcasts" /> |
||||
</paquet> |
@ -0,0 +1,91 @@
|
||||
<?php |
||||
/** |
||||
* Fichier gérant l'installation et désinstallation du plugin podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Installation |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Fonction d'installation et de mise à jour du plugin podcast. |
||||
* |
||||
* Vous pouvez : |
||||
* |
||||
* - créer la structure SQL, |
||||
* - insérer du pre-contenu, |
||||
* - installer des valeurs de configuration, |
||||
* - mettre à jour la structure SQL |
||||
* |
||||
* @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 |
||||
* @param string $version_cible |
||||
* Version du schéma de données dans ce plugin (déclaré dans paquet.xml) |
||||
* @return void |
||||
**/ |
||||
function podcast_upgrade($nom_meta_base_version, $version_cible) { |
||||
$maj = array(); |
||||
# quelques exemples |
||||
# (que vous pouvez supprimer !) |
||||
# |
||||
# $maj['create'] = array(array('creer_base')); |
||||
# |
||||
# include_spip('inc/config') |
||||
# $maj['create'] = array( |
||||
# array('maj_tables', array('spip_xx', 'spip_xx_liens')), |
||||
# array('ecrire_config', 'podcast', array('exemple' => "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); |
||||
} |
@ -0,0 +1,143 @@
|
||||
<?php |
||||
/** |
||||
* Définit les autorisations du plugin podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Autorisations |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/* |
||||
* Un fichier d'autorisations permet de regrouper |
||||
* les fonctions d'autorisations de votre plugin |
||||
*/ |
||||
|
||||
/** |
||||
* Fonction d'appel pour le pipeline |
||||
* @pipeline autoriser */ |
||||
function podcast_autoriser() { |
||||
} |
||||
|
||||
|
||||
/* Exemple |
||||
function autoriser_podcast_configurer_dist($faire, $type, $id, $qui, $opt) { |
||||
// type est un objet (la plupart du temps) ou une chose. |
||||
// autoriser('configurer', '_podcast') => $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')); |
||||
} |
@ -0,0 +1,23 @@
|
||||
<?php |
||||
/** |
||||
* Fonctions utiles au plugin podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Fonctions |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/* |
||||
* Un fichier de fonctions permet de définir des éléments |
||||
* systématiquement chargés lors du calcul des squelettes. |
||||
* |
||||
* Il peut par exemple définir des filtres, critères, balises, … |
||||
* |
||||
*/ |
@ -0,0 +1,24 @@
|
||||
<?php |
||||
/** |
||||
* Options au chargement du plugin podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Options |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/* |
||||
* Un fichier d'options permet de définir des éléments |
||||
* systématiquement chargés à chaque hit sur SPIP. |
||||
* |
||||
* Il vaut donc mieux limiter au maximum son usage |
||||
* tout comme son volume ! |
||||
* |
||||
*/ |
@ -0,0 +1,96 @@
|
||||
<?php |
||||
/** |
||||
* Utilisations de pipelines par podcast |
||||
* |
||||
* @plugin podcast |
||||
* @copyright 2021 |
||||
* @author chankalan,vcalame |
||||
* @licence GNU/GPL |
||||
* @package SPIP\Podcast\Pipelines |
||||
*/ |
||||
|
||||
if (!defined('_ECRIRE_INC_VERSION')) { |
||||
return; |
||||
} |
||||
|
||||
|
||||
/* |
||||
* Un fichier de pipelines permet de regrouper |
||||
* les fonctions de branchement de votre plugin |
||||
* sur des pipelines existants. |
||||
*/ |
||||
|
||||
|
||||
/** |
||||
* 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' |
||||
) . "<br class='nettoyeur' />"; |
||||
} |
||||
} |
||||
} |
||||
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 .= '<div>' . singulier_ou_pluriel($nb, 'podcast:info_1_podcast', 'podcast:info_nb_podcasts') . "</div>\n"; |
||||
} |
||||
if ($texte and $p = strpos($flux['data'], '<!--nb_elements-->')) { |
||||
$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; |
||||
} |
@ -0,0 +1,12 @@
|
||||
<BOUCLE_podcast(PODCASTS){id_podcast}> |
||||
[<div class="champ contenu_code[ (#CODE*|strlen|?{'',vide})]"> |
||||
<div class="label"><:podcast:champ_code_label:/> : </div> |
||||
<span dir="#LANG_DIR" class="#EDIT{code} code">(#CODE)</span> |
||||
</div>] |
||||
|
||||
[<div class="champ contenu_duree[ (#DUREE*|strlen|?{'',vide})]"> |
||||
<div class="label"><:podcast:champ_duree_label:/> : </div> |
||||
<span dir="#LANG_DIR" class="#EDIT{duree} duree">(#DUREE)</span> |
||||
</div>] |
||||
|
||||
</BOUCLE_podcast> |
@ -0,0 +1,22 @@
|
||||
<BOUCLE_podcast(PODCASTS){id_podcast=#ENV{id}}> |
||||
<div class="infos"> |
||||
[(#SET{texte_objet,<:podcast:titre_podcast:/>})] |
||||
<div class="numero"><:titre_cadre_numero_objet{objet=#GET{texte_objet}}:/><p>#ID_PODCAST</p></div> |
||||
|
||||
<div class='nb_elements'><!--nb_elements--></div> |
||||
|
||||
[(#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) |
||||
<hr /> |
||||
[(#BOUTON_ACTION{ |
||||
[(#CHEMIN_IMAGE{podcast-del-24.png}|balise_img{<:podcast:supprimer_podcast:/>}|concat{' ',#VAL{<:podcast:supprimer_podcast:/>}|wrap{<b>}}|trim)], |
||||
#URL_ACTION_AUTEUR{supprimer_podcast, #ID_PODCAST, #URL_ECRIRE{podcasts}}, |
||||
icone s24 horizontale danger podcast-del-24, <:podcast:confirmer_supprimer_podcast:/>})] |
||||
] |
||||
|
||||
</div> |
||||
</BOUCLE_podcast> |
@ -0,0 +1,34 @@
|
||||
[(#SET{defaut_tri,#ARRAY{ |
||||
code,1, |
||||
id_podcast,1, |
||||
points,-1 |
||||
}})]<B_liste_podcasts> |
||||
#ANCRE_PAGINATION |
||||
<div class="liste-objets podcasts"> |
||||
<table class="spip liste"> |
||||
[<caption><strong class="caption">(#ENV*{titre,#GRAND_TOTAL|singulier_ou_pluriel{podcast:info_1_podcast,podcast:info_nb_podcasts}})</strong></caption>] |
||||
<thead> |
||||
<tr class="first_row"> |
||||
<th class="picto" scope="col"></th> |
||||
<th class="code" scope="col">[(#TRI{code,<:podcast:champ_code_label:/>,ajax})]</th> |
||||
<th class="id" scope="col">[(#TRI{id_podcast,<:info_numero_abbreviation:/>,ajax})]</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
<BOUCLE_liste_podcasts(PODCASTS){id_article?}{id_mot?}{id_auteur?}{where?}{recherche?}{tri #ENV{par,num code},#GET{defaut_tri}}{par code}{pagination #ENV{nb,10}}> |
||||
<tr class="[(#COMPTEUR_BOUCLE|alterner{row_odd,row_even})]"> |
||||
<td class="picto">[(#CHEMIN_IMAGE{podcast-16.png}|balise_img)]</td> |
||||
<td class="code principale">[(#LOGO_PODCAST|image_reduire{20,26})]<a href="[(#ID_PODCAST|generer_url_entite{podcast})]" title="<:info_numero_abbreviation|attribut_html:/> #ID_PODCAST">[(#RANG). ]#CODE</a></td> |
||||
<td class="id">[(#AUTORISER{modifier,podcast,#ID_PODCAST}|?{ |
||||
<a href="[(#URL_ECRIRE{podcast_edit,id_podcast=#ID_PODCAST})]">#ID_PODCAST</a>, |
||||
#ID_PODCAST |
||||
})]</td> |
||||
</tr> |
||||
</BOUCLE_liste_podcasts> |
||||
</tbody> |
||||
</table> |
||||
[<p class="pagination">(#PAGINATION{prive})</p>] |
||||
</div> |
||||
</B_liste_podcasts>[ |
||||
<div class="liste-objets podcasts caption-wrap"><strong class="caption">(#ENV*{sinon,''})</strong></div> |
||||
]<//B_liste_podcasts> |
@ -0,0 +1,7 @@
|
||||
[(#AUTORISER{configurer,_podcast}|sinon_interdire_acces)] |
||||
|
||||
<h1 class="grostitre"><:podcast:titre_page_configurer_podcast:/></h1> |
||||
|
||||
<div class="ajax"> |
||||
#FORMULAIRE_CONFIGURER_PODCAST |
||||
</div> |
@ -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}}}}} |
||||
|
||||
|
||||
|
||||
<div class="cadre-formulaire-editer"> |
||||
<div class="entete-formulaire"> |
||||
[(#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:/>})] |
||||
<h1>(#ENV{titre,#INFO_CODE{podcast,#ID_PODCAST}|sinon{<:info_sans_titre:/>}})</h1> |
||||
] |
||||
</div> |
||||
|
||||
#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();'} |
||||
<div class="ajax"> |
||||
] |
||||
[(#FORMULAIRE_EDITER_PODCAST{#ENV{id_podcast,oui}, #GET{id_parent}, #GET{redirect}})] |
||||
[(#ENV{retourajax,''}|oui) |
||||
</div> |
||||
<script type="text/javascript">/*<!\[CDATA\[*/reloadExecPage('#ENV{exec}');/*\]\]>*/</script> |
||||
] |
||||
</div> |
@ -0,0 +1,10 @@
|
||||
<!-- hierarchie --> |
||||
<a href="#URL_ECRIRE{podcasts}"><:podcast:titre_podcasts:/></a> |
||||
<BOUCLE_hierarchie(PODCASTS){id_podcast}> |
||||
> [(#URL_ECRIRE{article,id_article=#ID_ARTICLE}|lien_ou_expose{#INFO_TITRE{articles,#ID_ARTICLE},''})] |
||||
> <strong class="on">#CODE</strong> |
||||
</BOUCLE_hierarchie> |
||||
[(#ENV{id_article}|oui) |
||||
> [(#URL_ECRIRE{article,id_article=#ID_ARTICLE}|lien_ou_expose{#INFO_TITRE{articles,#ID_ARTICLE},''})] |
||||
]> <strong class="on"><:ecrire:info_sans_titre:/></strong> |
||||
<//B_hierarchie> |
@ -0,0 +1 @@
|
||||
<INCLURE{fond=prive/squelettes/hierarchie/podcast,env} /> |
@ -0,0 +1,20 @@
|
||||
<BOUCLE_test_multiple(CONDITION){si #ENV{multiple}|=={on}|oui}> |
||||
[(#SET{valeur,[(#ENV*{valeur}|is_array|?{[(#ENV*{valeur})],[(#ENV*{valeur}|explode{','})]})]})] |
||||
<B_podcasts_selectionnes> |
||||
<ul> |
||||
<BOUCLE_podcasts_selectionnes(PODCASTS){id_podcast IN #GET*{valeur}} |
||||
{par num code, code}{tout}> |
||||
<li class="choix">#CODE (#ID_PODCAST)</li> |
||||
</BOUCLE_podcasts_selectionnes> |
||||
</ul> |
||||
</B_podcasts_selectionnes> |
||||
[(#ENV*{sans_reponse}|propre)] |
||||
<//B_podcasts_selectionnes> |
||||
</BOUCLE_test_multiple> |
||||
<BOUCLE_podcast_selectionne(PODCASTS){id_podcast=#ENV{valeur}} |
||||
{par num code, code}{tout}> |
||||
<p>#CODE (#ID_PODCAST)</p> |
||||
</BOUCLE_podcast_selectionne> |
||||
[(#ENV*{sans_reponse}|propre)] |
||||
<//B_podcast_selectionne> |
||||
<//B_test_multiple> |
@ -0,0 +1,13 @@
|
||||
[(#ENV{multiple}|oui) |
||||
[(#SET{valeur,[(#ENV*{valeur}|is_array|?{[(#ENV*{valeur})],[(#ENV*{valeur}|explode{','})]})]})] |
||||
] |
||||
<select name="#ENV{nom}[(#ENV{multiple}|?{\[\]})]" id="champ_[(#ENV{nom}|saisie_nom2classe)]"[ class="(#ENV{class})"][(#ENV{multiple}|oui) multiple="multiple" size="#ENV{size,10}"][ disabled="(#ENV{disable})"]> |
||||
[(#ENV{cacher_option_intro}|ou{#ENV{multiple}}|non) |
||||
<option value="">[(#ENV{option_intro})]</option>] |
||||
<BOUCLE_podcasts(PODCASTS){id_podcast?}{id_article?}{recherche?}{tout}{par num code, code}> |
||||
[(#ENV{multiple}|oui) |
||||
<option value="#ID_PODCAST"[(#ID_PODCAST|in_array{#ENV{valeur_forcee,#GET{valeur,#ENV{defaut,#ARRAY}}}}|oui) selected="selected"]>#CODE</option>] |
||||
[(#ENV{multiple}|non) |
||||
<option value="#ID_PODCAST"[(#ID_PODCAST|=={#ENV{valeur_forcee,#ENV{valeur,#ENV{defaut}}}}|oui) selected="selected"]>#CODE</option>] |
||||
</BOUCLE_podcasts> |
||||
</select> |
Loading…
Reference in new issue