diff --git a/config/zentaopms.php b/config/zentaopms.php index b8c484b764..f94132f7a1 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('program', 'project', 'product', 'execution', 'qa'); +$config->hasDropmenuApps = array('program', 'project', 'product', 'execution', 'qa', 'admin'); $config->excludeDropmenuList = array('program-browse', 'product-all', 'product-index', 'execution-all', 'project-browse', 'product-batchedit'); diff --git a/lib/zin/wg/dropmenu/v1.php b/lib/zin/wg/dropmenu/v1.php index e57dbdaaae..28870082f4 100644 --- a/lib/zin/wg/dropmenu/v1.php +++ b/lib/zin/wg/dropmenu/v1.php @@ -51,6 +51,7 @@ class dropmenu extends wg list($url, $text, $objectID, $cache, $tab, $module, $method, $extra, $id, $data) = $this->prop(array('url', 'text', 'objectID', 'cache', 'tab', 'module', 'method', 'extra', 'id', 'data')); $app = data('app'); + $lang = data('lang'); if(empty($tab)) $tab = $app->tab; if(empty($module)) $module = $app->rawModule; @@ -63,6 +64,13 @@ class dropmenu extends wg if(isset($object->id)) $objectID = $object->id; } + if($tab == 'admin') + { + $currentMenuKey = $app->control->loadModel('admin')->getMenuKey(); + $text = $lang->admin->menuList->{$currentMenuKey}['name']; + $url = createLink('admin', 'ajaxGetDropMenu', "currentMenuKey={$currentMenuKey}"); + } + if(empty($url) && empty($data)) $url = createLink($tab, 'ajaxGetDropMenu', "objectID=$objectID&module=$module&method=$method&extra=$extra"); if(empty($text) && !empty($tab)) { diff --git a/module/admin/control.php b/module/admin/control.php index d299dc6338..0825010385 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -515,4 +515,35 @@ class admin extends control return print(json_encode($response)); } + + /** + * AJAX: Get drop menu. + * + * @param string $currentMenuKey + * @access public + * @return void + */ + public function ajaxGetDropMenu($currentMenuKey = '') + { + $this->admin->checkPrivMenu(); + $data = array(); + foreach($this->lang->admin->menuList as $menuKey => $menuGroup) + { + if($this->config->vision == 'lite' and !in_array($menuKey, $this->config->admin->liteMenuList)) continue; + $data[] = array( + 'id' => $menuKey, + 'name' => $menuKey, + 'text' => $menuGroup['name'], + 'content' => " " . $menuGroup['name'], + 'title' => $menuGroup['name'], + 'type' => 'item', + 'url' => $menuGroup['disabled'] ? '###' : $menuGroup['link'], + 'active' => $currentMenuKey == $menuKey, + 'rootClass' => 'admin-menu-item' + ); + } + + $this->view->data = $data; + $this->display(); + } } diff --git a/module/admin/ui/ajaxgetdropmenu.html.php b/module/admin/ui/ajaxgetdropmenu.html.php new file mode 100644 index 0000000000..a880d65302 --- /dev/null +++ b/module/admin/ui/ajaxgetdropmenu.html.php @@ -0,0 +1,25 @@ + + * @package admin + * @link https://www.zentao.net + */ +namespace zin; + +/** + * 定义最终的 JSON 数据。 + * Define the final json data. + */ +$json = array(); +$json['data'] = $data; +$json['search'] = false; + +/** + * 渲染 JSON 字符串并发送到客户端。 + * Render json data to string and send to client. + */ +renderJson($json); diff --git a/module/custom/control.php b/module/custom/control.php index bf5b1da51f..b125b6da0e 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -590,7 +590,7 @@ class custom extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); } - $this->view->title = $this->lang->custom->flow; + $this->view->title = $this->lang->custom->flow; $this->display(); }