* app_deux devient app2 pour simplifier son appel. j'ai essayé de garder la compat, tres rarement utilisé, donc j'ai prix le risque * refactorisation des fonctions php gamutable_fermer_modalbox => plus KISS * ces fonctions peuvent etre appeler avec un id < 0, dans ce cas on supprimera la ligne dans la gamutable
75 lines
2.3 KiB
PHP
75 lines
2.3 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_insert_head_css($flux){
|
|
|
|
$css = find_in_path('css/fontello.css');
|
|
$css = timestamp($css);
|
|
$flux .= "<link rel='stylesheet' type='text/css' media='all' href='$css' />"."\r\n";
|
|
|
|
$css = timestamp(find_in_path('font/css/gamutable-codes.css'));
|
|
$flux .= "<link rel='stylesheet' type='text/css' media='all' href='$css' />"."\r\n";
|
|
|
|
return $flux;
|
|
}
|
|
|
|
|
|
function gamutable_affichage_final($flux) {
|
|
include_spip('inc/autoriser');
|
|
if (autoriser("purger","gamutable") && test_plugin_actif('minibando') && strpos($flux, 'id="minibando"') !== false) {
|
|
$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 !in_array($objet, $GLOBALS['gamutable_rechargerJson_all'] ?? [])
|
|
) {
|
|
$flux['data'] .= ' <script type="text/javascript">if ( typeof app2 === "object") { app2.rechargerJson('.$id.');}if ( typeof app === "object") { app.rechargerJson('.$id.');} </script>';
|
|
} else {
|
|
$flux['data'] .= ' <script type="text/javascript">if ( typeof app2 === "object") { app2.rechargerJson();}if ( typeof app === "object") { app.rechargerJson();} </script>';
|
|
}
|
|
|
|
return $flux;
|
|
}
|