le bouton "importer l’émission" au pilieu de la page pour retour ajax

This commit is contained in:
chankalan 2021-10-25 15:51:52 +02:00
parent 22fffcbc89
commit 79445a64f9
4 changed files with 40 additions and 11 deletions

View File

@ -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) {

View File

@ -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;
}

View File

@ -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" /> -->

View File

@ -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 limport'})]
</div>