From 08ed7119e02aa3d25f7f05b6e1bcc5fdc0cf652e Mon Sep 17 00:00:00 2001 From: tofulm Date: Thu, 31 Mar 2022 10:36:15 +0200 Subject: [PATCH] ajout de la suppression d'une ligne d'un objet --- action/supprimer_gamuform.php | 32 ++++++++++++++++++++++++++++++++ gamuform_autorisations.php | 8 ++++++++ json_gamuform.json.html | 24 +++++++++++++++++------- 3 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 action/supprimer_gamuform.php diff --git a/action/supprimer_gamuform.php b/action/supprimer_gamuform.php new file mode 100644 index 0000000..a6e5b50 --- /dev/null +++ b/action/supprimer_gamuform.php @@ -0,0 +1,32 @@ + $objet])) { + return false; + } + + $table = table_objet_sql($objet); + $id = id_table_objet($objet); + + sql_delete($table, "$id=" . $id_objet); + + include_spip('inc/invalideur'); + suivre_invalideur("id='"."$id_objet"."/1"); + } +} diff --git a/gamuform_autorisations.php b/gamuform_autorisations.php index 0b815a4..626ad8f 100644 --- a/gamuform_autorisations.php +++ b/gamuform_autorisations.php @@ -44,3 +44,11 @@ function autoriser_gamuform_creer_dist($faire, $type, $id, $qui, $opt) { return autoriser('webmestre'); } + +function autoriser_gamuform_supprimer_dist($faire, $type, $id, $qui, $opt) { + if (!empty($opt['objet'])) { + return autoriser('voir', $opt['objet'], $id, $qui, []); + } + + return autoriser('webmestre'); +} diff --git a/json_gamuform.json.html b/json_gamuform.json.html index c72bdbb..92632e0 100644 --- a/json_gamuform.json.html +++ b/json_gamuform.json.html @@ -5,9 +5,10 @@ "header":{ "id": "id", "edit": "", - -[(#CLE|json_encode)] : [(#VALEUR|json_encode)] + +[(#CLE|json_encode)] : [(#VALEUR|json_encode)], +"sup": "" }, "crayons":{ }, @@ -15,7 +16,8 @@ }, "classes" : { "id": "w80p", - "edit": "w80p" + "edit": "w50p", + "sup": "w50p" } } @@ -29,20 +31,28 @@ |parametre_url{redirect,gamutable})]"> })] + [(#SET{sup, + + + })] { "html": { "id": #GET{ligne/id}, "edit": [(#GET{edit}|json_encode)], - - [(#CLE|json_encode)] : [(#GET{ligne/#CLE}|json_encode)] + + [(#CLE|json_encode)] : [(#GET{ligne/#CLE}|json_encode)], + "sup": [(#GET{sup}|json_encode)] }, "search": { "id": #GET{ligne/id}, "edit": "", - - [(#CLE|json_encode)] : [(#GET{ligne/#CLE}|textebrut|json_encode)] + + [(#CLE|json_encode)] : [(#GET{ligne/#CLE}|textebrut|json_encode)], + "sup":"" } }