diff --git a/module/api/control.php b/module/api/control.php index eb1236d3fb..e5716b220b 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -1030,4 +1030,22 @@ class api extends control } } + + /** + * Get api list. + * + * @param int $objectID + * @param string $objectType + * @access public + * @return void + */ + public function ajaxGetList(int $objectID, string $objectType) + { + helper::setcookie('objectType', $objectType); + helper::setcookie('objectID', $objectID); + + $this->objectType = $objectType; + $this->objectID = $objectID; + $this->locate(inlink('index')); + } } diff --git a/module/api/ui/ajaxgetdropmenu.html.php b/module/api/ui/ajaxgetdropmenu.html.php index 22454aecf0..06681e7ec2 100644 --- a/module/api/ui/ajaxgetdropmenu.html.php +++ b/module/api/ui/ajaxgetdropmenu.html.php @@ -11,7 +11,7 @@ declare(strict_types=1); namespace zin; $data = array('normal' => array(), 'closed' => array()); -$data['normal'][] = array('id' => 0, 'text' => $lang->api->noLinked, 'active' => $objectID == 0); +$data['normal'][] = array('id' => 0, 'text' => $lang->api->noLinked, 'active' => $objectID == 0, 'type' => 'unlink'); /* 处理分组数据。Process grouped data. */ foreach(array('product', 'project') as $moduleType) @@ -22,6 +22,7 @@ foreach(array('product', 'project') as $moduleType) $item['id'] = $normalObjectID; $item['text'] = $normalObjectName; $item['active'] = $normalObjectID == $objectID; + $item['type'] = $moduleType; $item['keys'] = zget(common::convert2Pinyin(array($normalObjectName)), $normalObjectName, ''); $data['normal'][] = $item; @@ -33,6 +34,7 @@ foreach(array('product', 'project') as $moduleType) $item['id'] = $closedObjectID; $item['text'] = $closedObjectName; $item['active'] = $closedObjectID == $objectID; + $item['type'] = $moduleType; $item['keys'] = zget(common::convert2Pinyin(array($closedObjectName)), $closedObjectName, ''); $data['closed'][] = $item; @@ -47,13 +49,13 @@ $tabs[] = array('name' => 'closed', 'text' => $lang->doc->closed); * 定义最终的 JSON 数据。 * Define the final json data. */ -$link = $this->createLink('api', 'index', "objectID=%s"); +$link = $this->createLink('api', 'ajaxGetList', "objectID={id}&objectType={type}"); $json = array(); $json['data'] = $data; $json['tabs'] = $tabs; $json['searchHint'] = $lang->searchAB; -$json['link'] = sprintf($link, '{id}'); +$json['link'] = $link; $json['itemType'] = 'api'; $json['expandName'] = 'closed';