* [pref story #49398] Add space field for ui.

This commit is contained in:
wangyidong
2024-08-09 09:28:52 +08:00
committed by 孙广明
parent 7cd5824a0e
commit 2ff8be7c9d
2 changed files with 27 additions and 9 deletions
+11 -3
View File
@@ -9,8 +9,9 @@ declare(strict_types=1);
* @link https://www.zentao.net
*/
namespace zin;
jsVar('doclibID', $lib->id);
jsVar('libType', $lib->type);
jsVar('libType', $libType);
modalHeader
(
set::title($lib->type == 'custom' && $lib->parent == 0 ? $lang->doclib->editSpace : $lang->doc->editLib),
@@ -26,6 +27,13 @@ formPanel
set::control('static'),
set::value($object->name)
) : null,
isset($spaces) ? formGroup
(
set::name('space'),
set::label($lang->doc->space),
set::control(array('control' => 'picker', 'value' => $targetSpace, 'items' => $spaces, 'required' => true)),
on::change('changeSpace')
) : null,
formGroup
(
set::label($lib->type == 'custom' && $lib->parent == 0 ? $lang->doclib->spaceName : $lang->doc->libName),
@@ -36,7 +44,7 @@ formPanel
setClass('hidden'),
set::name('acl'),
set::items($lang->doc->libTypeList),
set::value($lib->type)
set::value($libType)
)
),
formRow
@@ -49,7 +57,7 @@ formPanel
(
set::name('acl'),
set::items($lib->type == 'api' ? $lang->api->aclList : $lang->doclib->aclList),
set::value(empty($lib->main) ? $lib->acl : 'default'),
set::value($defaultAcl),
on::change("toggleAcl('lib')")
)
)
+16 -6
View File
@@ -311,28 +311,33 @@ class docZen extends doc
* Handle the access control of editing document library.
*
* @param object $lib
* @param string $targetSpace
* @access protected
* @return void
*/
protected function setAclForEditLib(object $lib): void
protected function setAclForEditLib(object $lib, string $targetSpace = ''): void
{
if($lib->type == 'custom')
$libType = $lib->type;
if($targetSpace == 'mine') $libType = 'mine';
if(is_numeric($targetSpace)) $libType = 'custom';
if($libType == 'custom')
{
unset($this->lang->doclib->aclList['default']);
}
elseif($lib->type == 'api')
elseif($libType == 'api')
{
$this->app->loadLang('api');
$type = !empty($lib->product) ? 'product' : 'project';
$this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common);
}
elseif($lib->type == 'mine')
elseif($libType == 'mine')
{
$this->lang->doclib->aclList = $this->lang->doclib->mySpaceAclList;
}
elseif($lib->type != 'custom')
elseif($libType != 'custom')
{
$type = isset($type) ? $type : $lib->type;
$type = isset($type) ? $type : $libType;
$this->lang->doclib->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
$this->lang->doclib->aclList['private'] = sprintf($this->lang->doclib->privateACL, $this->lang->{$type}->common);
unset($this->lang->doclib->aclList['open']);
@@ -865,4 +870,9 @@ class docZen extends doc
$mineLib->addedDate = helper::now();
$this->dao->insert(TABLE_DOCLIB)->data($mineLib)->exec();
}
public function getAllSpaces(): array
{
return array('mine' => $this->lang->doc->spaceList['mine']) + $this->doc->getTeamSpaces();
}
}