diff --git a/module/api/control.php b/module/api/control.php index 623b3cdf1c..e1b15339a8 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -512,7 +512,7 @@ class api extends control if(dao::isError()) return $this->sendError(dao::getError()); - return $this->sendSuccess(array('message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "redirectParentWindow($id)")); + return $this->sendSuccess(array('message' => $this->lang->saveSuccess, 'closeModal' => true, 'load' => true)); } $lib = $this->doc->getLibById($id); diff --git a/module/api/ui/editlib.html.php b/module/api/ui/editlib.html.php new file mode 100644 index 0000000000..c47261fc13 --- /dev/null +++ b/module/api/ui/editlib.html.php @@ -0,0 +1,100 @@ + + * @package api + * @link https://www.zentao.net + */ +namespace zin; + +modalHeader +( + set::title($lang->api->editLib), + set::entityID($lib->id), + set::entityText($lib->name), +); + +formPanel +( + in_array($type, array('product', 'project')) ? formGroup + ( + set::label($lang->api->{$type}), + set::control('static'), + set::value($object->name) + ) : null, + formGroup + ( + set::label($lang->api->name), + set::name('name'), + set::value($lib->name), + ), + formGroup + ( + set::label($lang->api->baseUrl), + set::name('baseUrl'), + set::value($lib->baseUrl), + ), + formRow + ( + setID('aclBox'), + formGroup + ( + set::label($lang->api->control), + radioList + ( + set::name('acl'), + set::items($lang->api->aclList), + set::value($lib->acl), + on::change("toggleAcl('lib')"), + ), + ) + ), + formRow + ( + setID('whiteListBox'), + setClass($lib->acl == 'private' ? '' : 'hidden'), + formGroup + ( + set::label($lang->api->whiteList), + div + ( + setClass('w-full check-list'), + div + ( + inputGroup + ( + $lang->doclib->group, + picker + ( + set::name('groups[]'), + set::items($groups), + set::value($lib->groups), + set::multiple(true), + ) + ) + ), + div + ( + inputGroup + ( + $lang->doclib->user, + picker + ( + set::name('users[]'), + set::items($users), + set::value($lib->users), + set::multiple(true), + ) + ) + ) + ) + ) + ), + formHidden('type', $type), +); + +/* ====== Render page ====== */ +render(); diff --git a/module/doc/model.php b/module/doc/model.php index abfeb60335..c9f604a220 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -289,6 +289,8 @@ class docModel extends model $data = fixer::input('post') ->trim('name') + ->add('product', $oldLib->product) + ->add('project', $oldLib->project) ->join('groups', ',') ->join('users', ',') ->remove('uid,contactListMenu,type') @@ -316,7 +318,7 @@ class docModel extends model if(!dao::isError()) { $this->loadModel('action'); - $changes = common::createChanges($oldDoc, $data); + $changes = common::createChanges($oldLib, $data); $actionID = $this->action->create('docLib', $id, 'Edited'); $this->action->logHistory($actionID, $changes); }