diff --git a/module/api/control.php b/module/api/control.php index 5045af04c3..0a60efb50a 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -365,16 +365,13 @@ class api extends control if(!empty($_POST)) { - $now = helper::now(); - $userId = $this->app->user->account; - $data = fixer::input('post') + $data = fixer::input('post') ->trim('name') ->add('lib', $libID) + ->add('addedBy', $this->app->user->account) + ->add('addedDate', helper::now()) ->skipSpecial('attribute') - ->add('addedBy', $userId) - ->add('addedDate', $now) - ->add('editedBy', $userId) - ->add('editedDate', $now) + ->remove('undefined') ->get(); diff --git a/module/api/ui/createstruct.html.php b/module/api/ui/createstruct.html.php new file mode 100644 index 0000000000..90a13c81fe --- /dev/null +++ b/module/api/ui/createstruct.html.php @@ -0,0 +1,146 @@ + + * @package api + * @link https://www.zentao.net + */ +namespace zin; + +formPanel +( + to::heading + ( + div + ( + setClass('panel-title text-lg'), + $lang->api->createStruct + ), + ), + formGroup + ( + set::width('1/2'), + set::label($lang->api->structName), + input + ( + set::name('name'), + set::required(true) + ) + ), + formGroup + ( + set::id('form-paramsType'), + setClass('params-group struct'), + set::label($lang->struct->type), + radioList + ( + set::name('type'), + set::inline(true), + set::value('formData'), + set::items($lang->struct->typeOptions), + ), + ), + formGroup + ( + set::id('form-params'), + setClass('params-group struct'), + set::label($lang->api->params), + h::table + ( + setClass('table condensed bordered'), + h::tr + ( + h::th + ( + width('300px'), + $lang->struct->field + ), + h::th + ( + width('100px'), + $lang->struct->paramsType + ), + h::th + ( + width('70px'), + $lang->struct->required + ), + h::th + ( + $lang->struct->desc + ), + h::th + ( + width('100px'), + ), + ), + h::tr + ( + setClass('input-row'), + set('data-level', 1), + set('data-key', 'origin'), + set('data-parent', '0'), + h::td + ( + input(), + ), + h::td + ( + select + ( + setClass('objectType'), + set::value('object'), + set::items($lang->api->paramsTypeOptions) + ) + ), + h::td + ( + html("") + ), + h::td + ( + textarea + ( + set::rows(1) + ), + ), + h::td + ( + div + ( + setClass('pl-2 flex self-center line-btn'), + btn + ( + setClass('btn ghost btn-split hidden'), + icon('split') + ), + btn + ( + setClass('btn ghost btn-add'), + icon('plus') + ), + btn + ( + setClass('btn ghost btn-delete'), + icon('trash'), + ), + ) + ) + ), + ), + ), + formHidden('attribute'), + formGroup + ( + set::label($lang->api->desc), + editor + ( + set::name('desc'), + ) + ) +); + +render();