Merge branch 'master' of https://forge.april.org/siteweb/libreavous
This commit is contained in:
commit
6909f1f6bd
@ -7,8 +7,10 @@ return;
|
||||
* Importation du JSON des chapitres
|
||||
* et des autres informations (durée, taille, etc)
|
||||
***************************************/
|
||||
include_spip('inc/actions');
|
||||
|
||||
function action_importer_emission_dist($arg = null) {
|
||||
|
||||
if (!$arg) {
|
||||
$securiser_action = charger_fonction('securiser_action', 'inc');
|
||||
$arg = $securiser_action();
|
||||
@ -152,7 +154,8 @@ function action_importer_emission_dist($arg = null) {
|
||||
if (count($erreurs) > 0) {
|
||||
$texteReponse .= "<br><br>Erreurs : <br>".implode(" <br> ", $erreurs);
|
||||
}
|
||||
return $texteReponse;
|
||||
// return $texteReponse;
|
||||
ajax_retour($texteReponse, false);
|
||||
}
|
||||
|
||||
function libreavous_import_getDuration($code_emission, $code_sujet) {
|
||||
|
@ -102,7 +102,7 @@ function libreavous_import_run($id_article) {
|
||||
$jsonContents = file_get_contents("https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json");
|
||||
$json = json_decode($jsonContents, true);
|
||||
if (!$json) {
|
||||
$erreurs[] = "JSON incorrect";
|
||||
$erreurs[] = "JSON incorrect : https://forge.april.org/libreavous/lav-outils/raw/branch/master/podcasts/config/lav-".$code_emission.".json";
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$erreurs[] = $e->getMessage();
|
||||
|
@ -80,10 +80,34 @@ function libreavous_boite_infos($flux) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($flux['args']['type'] == 'article' and $id_article = $flux['args']['id'] and autoriser('instituer', 'article', $id_article)) {
|
||||
$flux['data'] .= recuperer_fond('prive/squelettes/inclure/importer_emission', array('id_article'=>$id_article));
|
||||
return $flux;
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher des choses au milieu de la page
|
||||
*
|
||||
* @pipeline affiche_milieu
|
||||
* @param array $flux Données du pipeline
|
||||
* @return array Données du pipeline
|
||||
**/
|
||||
function libreavous_affiche_milieu($flux) {
|
||||
$texte = '';
|
||||
$e = trouver_objet_exec($flux['args']['exec']);
|
||||
|
||||
if ($e and !$e['edition'] and in_array($e['type'], array('article')) ) {
|
||||
$texte .= recuperer_fond('prive/squelettes/inclure/importer_emission', array(
|
||||
'id_article' => $flux['args'][$e['id_table_objet']]
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
if ($texte) {
|
||||
if ($p = strpos($flux['data'], '<!--affiche_milieu-->')) {
|
||||
$flux['data'] = substr_replace($flux['data'], $texte, $p, 0);
|
||||
} else {
|
||||
$flux['data'] .= $texte;
|
||||
}
|
||||
}
|
||||
|
||||
return $flux;
|
||||
}
|
||||
|
||||
|
11
paquet.xml
11
paquet.xml
@ -23,11 +23,12 @@
|
||||
|
||||
<pipeline nom="autoriser" inclure="libreavous_autorisations.php"/>
|
||||
<pipeline nom="declarer_champs_extras" inclure="base/libreavous.php"/>
|
||||
<pipeline nom="declarer_tables_objets_sql" inclure="base/libreavous.php" />
|
||||
<pipeline nom="declarer_tables_interfaces" inclure="base/libreavous.php" />
|
||||
<pipeline nom="affiche_enfants" inclure="libreavous_pipelines.php" />
|
||||
<pipeline nom="boite_infos" inclure="libreavous_pipelines.php" />
|
||||
<pipeline nom="objet_compte_enfants" inclure="libreavous_pipelines.php" />
|
||||
<pipeline nom="declarer_tables_objets_sql" inclure="base/libreavous.php" />
|
||||
<pipeline nom="declarer_tables_interfaces" inclure="base/libreavous.php" />
|
||||
<pipeline nom="affiche_enfants" inclure="libreavous_pipelines.php" />
|
||||
<pipeline nom="boite_infos" inclure="libreavous_pipelines.php" />
|
||||
<pipeline nom="objet_compte_enfants" inclure="libreavous_pipelines.php" />
|
||||
<pipeline nom="affiche_milieu" inclure="libreavous_pipelines.php" />
|
||||
|
||||
<!-- <menu nom="configurer_librealire" titre="librealire:options_lal" parent="menu_squelette" icone="images/baz_april-16.png" /> -->
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
|
||||
[(#BOUTON_ACTION{<:libreavous:importer_l_emission:>,#URL_ACTION_AUTEUR{importer_emission,#ID_ARTICLE,#SELF}})]
|
||||
<div class="ajax">
|
||||
[(#BOUTON_ACTION{<:libreavous:importer_l_emission:>,#URL_ACTION_AUTEUR{importer_emission,#ID_ARTICLE}, 'ajax', 'Confirmer ou annuler l’import'})]
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user