62 lines
1.8 KiB
PHP
62 lines
1.8 KiB
PHP
<?php
|
|
/**
|
|
* Utilisations de pipelines par GamuTable
|
|
*
|
|
* @plugin GamuTable
|
|
* @copyright 2020
|
|
* @author tofulm
|
|
* @licence GNU/GPL
|
|
* @package SPIP\Gamutable\Pipelines
|
|
*/
|
|
|
|
if (!defined('_ECRIRE_INC_VERSION')) {
|
|
return;
|
|
}
|
|
|
|
function gamutable_formulaire_admin($flux) {
|
|
include_spip('inc/autoriser');
|
|
if (autoriser("purger","gamutable")) {
|
|
$btn = recuperer_fond('inclure/calculer_gamutable');
|
|
$flux['data'] = preg_replace('%(<!--extra-->)%is', $btn.'$1', $flux['data']);
|
|
}
|
|
|
|
return $flux;
|
|
}
|
|
|
|
|
|
function gamutable_affichage_final($flux) {
|
|
include_spip('inc/autoriser');
|
|
if (autoriser("purger","gamutable") and test_plugin_actif('minibando')) {
|
|
$p = stripos($flux, '</body>');
|
|
if ($p) {
|
|
$url_relecture = parametre_url(self(), 'var_mode', 'gamutable', '&');
|
|
$label = "Mode gamuTable";
|
|
$js = "jQuery('#minibando_bouton_debug ul').append('<li><a class=\"spip-admin-boutons \" href=\"$url_relecture\">$label</a></li>');";
|
|
$js = "jQuery(function(){ $js });";
|
|
$js = "<script>$js</script>";
|
|
$flux = substr_replace($flux, $js, $p, 0);
|
|
}
|
|
}
|
|
return $flux;
|
|
}
|
|
|
|
|
|
/**
|
|
* injection du reload de vuejs pour les crayons de l'objet souscription
|
|
* on peut bloquer le rechargement selectif par id en ajoutant le nom de l'objet
|
|
* dans la global $GLOBALS['gamutable_rechargerJson_all']
|
|
*
|
|
*/
|
|
function gamutable_crayons_vue_affichage_final($flux){
|
|
$id = $flux['args']['id'];
|
|
$objet = $flux['args']['type'];
|
|
if (
|
|
$id = intval($id)
|
|
and (!empty($GLOBALS['gamutable_rechargerJson_all']) and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all']))
|
|
) {
|
|
$flux['data'] .= ' <script type="text/javascript"> app.rechargerJson('.$id.'); </script>';
|
|
} else {
|
|
$flux['data'] .= ' <script type="text/javascript"> app.rechargerJson(); </script>';
|
|
}
|
|
return $flux;
|
|
}
|