diff --git a/module/doc/control.php b/module/doc/control.php index 0873adb510..d95592c5b5 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -982,6 +982,26 @@ class doc extends control $this->display(); } + /** + * Ajax: 获取空间的下拉数据。 + * Ajax: Get the space drop down. + * + * @param int $libID + * @param string $module + * @param string $method + * @access public + * @return void + */ + public function ajaxGetSpaceMenu(int $libID, string $module, string $method) + { + $this->view->libID = $libID; + $this->view->module = $module; + $this->view->method = $method; + $this->view->spaces = $this->docZen->getAllSpaces('nomine'); + + $this->display(); + } + /** * Ajax: 获取执行下拉数据。 * Ajax: Get the execution drop down by the projectID. diff --git a/module/doc/model.php b/module/doc/model.php index c03205ff82..412b4afa4c 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2164,7 +2164,17 @@ class docModel extends model { $libs = $this->getLibsByObject($type, 0, $appendLib); if(($libID == 0 || !isset($libs[$libID])) && !empty($libs)) $libID = reset($libs)->id; - if(isset($libs[$libID])) $objectDropdown['text'] = zget($libs[$libID], 'name', ''); + if(isset($libs[$libID])) + { + $objectDropdown['text'] = zget($libs[$libID], 'name', ''); + if($type == 'custom') + { + $currentLib = $libs[$libID]; + $space = $currentLib->parent ? $libs[$currentLib->parent] : $currentLib; + $objectDropdown['text'] = $space->name; + $objectDropdown['link'] = helper::createLink('doc', 'ajaxGetSpaceMenu', "libID={$space->id}&module={$this->app->rawModule}&method={$this->app->rawMethod}"); + } + } $object = new stdclass(); $object->id = 0; @@ -2403,15 +2413,17 @@ class docModel extends model if($item->type == 'apiLib') $apiLibIDList[] = $lib->id; } - /* 将团队空间下的库分为空间和库的结构。 */ + /* 团队空间下,只展示当前空间下的库。 */ if($type == 'custom' && !empty($libTree['custom'])) { + $currentLib = $libs[$libID]; + $space = $currentLib->parent ? $libs[$currentLib->parent] : $currentLib; foreach($libTree['custom'] as $id => $lib) { - if($lib->parent > 0) + if($lib->parent != $space->id) { - if(isset($libTree['custom'][$lib->parent])) $libTree['custom'][$lib->parent]->children[] = $lib; unset($libTree['custom'][$id]); + continue; } } } diff --git a/module/doc/ui/ajaxgetspacemenu.html.php b/module/doc/ui/ajaxgetspacemenu.html.php new file mode 100644 index 0000000000..10ae984dba --- /dev/null +++ b/module/doc/ui/ajaxgetspacemenu.html.php @@ -0,0 +1,55 @@ + + * @package doc + * @link https://www.zentao.net + */ +namespace zin; + +/** + * 定义每个分组下的选项数据列表。 + * Define the grouped data list. + */ +$data = array('normal' => array()); + +/* 处理分组数据。Process grouped data. */ +foreach($spaces as $id => $name) +{ + $item = array(); + $item['id'] = $id; + $item['text'] = $name; + $item['selected'] = $id == $libID; + $item['keys'] = zget(common::convert2Pinyin(array($name)), $name, ''); + + $data['normal'][] = $item; +} + +/** + * 定义每个分组名称信息,包括可展开的已关闭分组。 + * Define every group name, include expanded group. + */ +$tabs = array(); +$tabs[] = array('name' => 'normal', 'text' => ''); + +/** + * 定义最终的 JSON 数据。 + * Define the final json data. + */ +$link = $this->createLink($module, $method, "type=custom&objectID=%s"); + +$json = array(); +$json['data'] = $data; +$json['tabs'] = $tabs; +$json['searchHint'] = $lang->searchAB; +$json['link'] = sprintf($link, '{id}'); +$json['itemType'] = 'doc'; + +/** + * 渲染 JSON 字符串并发送到客户端。 + * Render json data to string and send to client. + */ +renderJson($json); diff --git a/module/doc/ui/lefttree.html.php b/module/doc/ui/lefttree.html.php index 569c8b69c8..ab7ab0fe36 100644 --- a/module/doc/ui/lefttree.html.php +++ b/module/doc/ui/lefttree.html.php @@ -20,6 +20,23 @@ h::css ); $canSort = hasPriv('doc', 'sortCatalog'); + +if($app->rawModule == 'doc' && $app->rawMethod == 'view') +{ + $settingLink = hasPriv('doc', 'displaySetting') ? inlink('displaySetting') : ''; + $settingText = $lang->doc->displaySetting; +} +elseif(hasPriv('doc', 'editLib') && $lib->type == 'custom') +{ + $settingLink = inlink('editLib', "libID=$libID"); + $settingText = $lang->doclib->editSpace; +} +else +{ + $settingLink = ''; + $settingText = ''; +} + sidebar ( set::width(200), @@ -40,8 +57,8 @@ sidebar set::canSortTo(jsRaw('window.canSortTo')), set::title(!empty($objectDropdown['text']) ? $objectDropdown['text'] : $objectTitle), set::menuLink(isset($objectDropdown['link']) ? $objectDropdown['link'] : ''), - set::settingLink($app->rawModule == 'doc' && $app->rawMethod == 'view' && common::hasPriv('doc', 'displaySetting') ? inlink('displaySetting') : ''), - set::settingText($lang->doc->displaySetting), + set::settingLink($settingLink), + set::settingText($settingText), set::defaultNestedShow(true) ) ); diff --git a/module/execution/ui/story.html.php b/module/execution/ui/story.html.php index 2e4541a2c7..c1e28bfd4a 100644 --- a/module/execution/ui/story.html.php +++ b/module/execution/ui/story.html.php @@ -406,6 +406,7 @@ if($canBatchAction) $stageItems = array(); foreach($lang->story->stageList as $stageID => $stage) { + if($stageID == 'delivered' || $stageID == 'delivering') continue; $stageItems[] = array( 'text' => $stage, 'innerClass' => 'batch-btn ajax-btn',