diff --git a/config/zentaopms.php b/config/zentaopms.php index 10fba21592..90b6409457 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -486,5 +486,5 @@ $config->featureGroup->other = array('devops', 'kanban'); $config->bi = new stdclass(); $config->bi->pickerHeight = 150; -$config->hasDropmenuApps = array('project', 'product', 'execution', 'qa'); +$config->hasDropmenuApps = array('program', 'project', 'product', 'execution', 'qa'); $config->excludeDropmenuList = array('program-browse', 'product-all', 'execuiton-all', 'project-browse'); diff --git a/module/program/control.php b/module/program/control.php index fea25e1b72..d2d84d7aac 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -677,6 +677,7 @@ class program extends control $this->view->module = $module; $this->view->method = $method; $this->view->programs = $this->program->getList('all'); + $this->view->link = $this->program->getLink($module, $method, $programID, '', 'program'); $this->display(); } diff --git a/module/program/ui/ajaxgetdropmenu.html.php b/module/program/ui/ajaxgetdropmenu.html.php new file mode 100644 index 0000000000..904167e68b --- /dev/null +++ b/module/program/ui/ajaxgetdropmenu.html.php @@ -0,0 +1,56 @@ + + * @package project + * @version $Id + * @link https://www.zentao.net + */ +namespace zin; + +function buildTree($programs, $parentID = 0) +{ + $result = array(); + foreach($programs as $program) + { + if($program->type != 'program') continue; + + if($program->parent == $parentID) + { + $itemArray = array + ( + 'id' => $program->id, + 'text' => $program->name, + 'keys' => zget(common::convert2Pinyin(array($program->name)), $program->name, ''), + 'items' => buildTree($programs, $program->id) + ); + + if(empty($itemArray['items'])) unset($itemArray['items']); + $result[] = $itemArray; + } + } + return $result; +} + +$data[0]['items'] = buildTree($programs); + +/** + * 定义最终的 JSON 数据。 + * Define the final json data. + */ +$json = array(); +$json['data'] = $data; +$json['searchHint'] = $lang->searchAB; +$json['link'] = sprintf($link, '{id}'); +$json['labelMap'] = array('program' => $lang->program->common); +$json['expandName'] = 'closed'; +$json['itemType'] = 'program'; + +/** + * 渲染 JSON 字符串并发送到客户端。 + * Render json data to string and send to client. + */ +renderJson($json);