From fa0130d34ebc5fdb4b8ed964936fb919cfd4ab5d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 2 Nov 2023 15:01:23 +0800 Subject: [PATCH] * Adjust for webhook in lite vision. --- extension/lite/webhook/ext/config/lite.php | 4 ++++ module/webhook/control.php | 2 +- module/webhook/ui/create.html.php | 10 +++++----- module/webhook/ui/edit.html.php | 9 ++++----- 4 files changed, 14 insertions(+), 11 deletions(-) create mode 100644 extension/lite/webhook/ext/config/lite.php diff --git a/extension/lite/webhook/ext/config/lite.php b/extension/lite/webhook/ext/config/lite.php new file mode 100644 index 0000000000..1ee5783de3 --- /dev/null +++ b/extension/lite/webhook/ext/config/lite.php @@ -0,0 +1,4 @@ +webhook->form->create['products']); +unset($lang->webhook->paramsList['product']); diff --git a/module/webhook/control.php b/module/webhook/control.php index 75d47fe947..964da1ce26 100644 --- a/module/webhook/control.php +++ b/module/webhook/control.php @@ -114,7 +114,7 @@ class webhook extends control $this->webhook->delete(TABLE_WEBHOOK, $id); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - return $this->sendSuccess(array('load' => $this->createLink('webhook', 'true'))); + return $this->sendSuccess(array('load' => true)); } /** diff --git a/module/webhook/ui/create.html.php b/module/webhook/ui/create.html.php index c6b071e580..fabec23bd1 100644 --- a/module/webhook/ui/create.html.php +++ b/module/webhook/ui/create.html.php @@ -10,11 +10,7 @@ declare(strict_types=1); */ namespace zin; -$fields = $config->webhook->form->create; -$fields['domain']['default'] = common::getSysURL(); -$fields['products']['options'] = $products; -$fields['executions']['options'] = $executions; - +$fields = $config->webhook->form->create; $defaultWidth = '1/2'; $formItems = array(); foreach($fields as $field => $attr) @@ -28,6 +24,10 @@ foreach($fields as $field => $attr) $title = $field; $control = array(); + if($field == 'domain') $attr['default'] = common::getSysURL(); + if($field == 'products') $attr['options'] = $products; + if($field == 'executions') $attr['options'] = $executions; + $control['type'] = $attr['control']; if(!empty($attr['options'])) $control['items'] = $attr['options']; if(!empty($attr['inline'])) $control['inline'] = $attr['inline']; diff --git a/module/webhook/ui/edit.html.php b/module/webhook/ui/edit.html.php index ed7a47b843..f62a76a413 100644 --- a/module/webhook/ui/edit.html.php +++ b/module/webhook/ui/edit.html.php @@ -10,11 +10,7 @@ declare(strict_types=1); */ namespace zin; -$fields = $config->webhook->form->create; -$fields['domain']['default'] = common::getSysURL(); -$fields['products']['options'] = $products; -$fields['executions']['options'] = $executions; - +$fields = $config->webhook->form->create; $defaultWidth = '1/2'; $formItems = array(); $secret = json_decode($webhook->secret); @@ -38,6 +34,9 @@ foreach($fields as $field => $attr) $default = zget($webhook, $field, ''); $control = array(); + if($field == 'products') $attr['options'] = $products; + if($field == 'executions') $attr['options'] = $executions; + $control['type'] = $attr['control']; if(!empty($attr['options'])) $control['items'] = $attr['options']; if(!empty($attr['inline'])) $control['inline'] = $attr['inline'];