fix: le rechargement du json via maj, est une nouvelle option, elle ne

remplace pas id
This commit is contained in:
Christophe 2023-01-12 15:14:56 +01:00
parent d76d336300
commit 30afd04c90
2 changed files with 23 additions and 22 deletions

View file

@ -15,31 +15,33 @@ if (!defined("_ECRIRE_INC_VERSION")) {
include_spip("inc/vite"); include_spip("inc/vite");
function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) { function gamutable_fermer_modalbox($id_objet = 9999999999, $num = null) {
if ($id_objet === 'maj') { if ($num) {
$id_objet = 1; $num = "_deux";
} }
$html = <<<EOJS $html = <<<EOJS
<script type="text/javascript"> <script type="text/javascript">
id = "$id_objet"; id = "$id_objet";
id = parseInt(id); if (id === 'maj') {
if (id > 0 && id < 9999999999) {
if (typeof app !== 'undefined') { if (typeof app !== 'undefined') {
app.rechargerJson('maj'); app.rechargerJson('maj');
} }
if (typeof app_deux !== 'undefined') { if (typeof app_deux !== 'undefined') {
app_deux.rechargerJson('maj'); app_deux.rechargerJson('maj');
} }
$.modalboxclose(); }
id = parseInt(id);
if (id > 0 && id < 9999999999) {
if (typeof app$num !== 'undefined') {
app$num.rechargerJson(id);
}
} }
if (id === 9999999999) { if (id === 9999999999) {
if (typeof app !== 'undefined') { if (typeof app$num !== 'undefined') {
app.rechargerJson(); app$num.rechargerJson();
} }
if (typeof app_deux !== 'undefined') {
app_deux.rechargerJson();
}
$.modalboxclose();
} }
$.modalboxclose();
delete id; delete id;
</script> </script>
EOJS; EOJS;
@ -47,14 +49,10 @@ EOJS;
} }
function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) { function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) {
if ($id_objet === 'maj') {
$id_objet = 1;
}
$html = <<<EOJS $html = <<<EOJS
<script type="text/javascript"> <script type="text/javascript">
id = "$id_objet"; id = "$id_objet";
id = parseInt(id); if (id === 'maj') {
if (id > 0 && id < 9999999999) {
if (typeof app !== 'undefined') { if (typeof app !== 'undefined') {
app.rechargerJson('maj'); app.rechargerJson('maj');
} }
@ -62,12 +60,15 @@ function gamutable_recharger_tableau($id_objet = 9999999999, $num = null) {
app_deux.rechargerJson('maj'); app_deux.rechargerJson('maj');
} }
} }
if (id === 9999999999) { id = parseInt(id);
if (typeof app !== 'undefined') { if (id > 0 && id < 9999999999) {
app.rechargerJson(); if (typeof app$num !== 'undefined') {
app$num.rechargerJson(id);
} }
if (typeof app_deux !== 'undefined') { }
app_deux.rechargerJson(); if (id === 9999999999) {
if (typeof app$num !== 'undefined') {
app$num.rechargerJson();
} }
} }
delete id; delete id;

View file

@ -54,7 +54,7 @@ function gamutable_crayons_vue_affichage_final($flux){
$id = intval($id) $id = intval($id)
and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all'] ?? []) and !in_array($objet, $GLOBALS['gamutable_rechargerJson_all'] ?? [])
) { ) {
$flux['data'] .= ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson("maj");}if ( typeof app === "object") { app.rechargerJson("maj");} </script>'; $flux['data'] .= ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson('.$id.');}if ( typeof app === "object") { app.rechargerJson('.$id.');} </script>';
} else { } else {
$flux['data'] .= $objet . ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson();}if ( typeof app === "object") { app.rechargerJson();} </script>'; $flux['data'] .= $objet . ' <script type="text/javascript">if ( typeof app_deux === "object") { app_deux.rechargerJson();}if ( typeof app === "object") { app.rechargerJson();} </script>';
} }