diff --git a/config/zentaopms.php b/config/zentaopms.php index f034ff71e2..8508db61cd 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -251,6 +251,7 @@ $config->objectTables['testtask'] = TABLE_TESTTASK; $config->objectTables['testsuite'] = TABLE_TESTSUITE; $config->objectTables['testreport'] = TABLE_TESTREPORT; $config->objectTables['user'] = TABLE_USER; +$config->objectTables['api'] = TABLE_API; $config->objectTables['doc'] = TABLE_DOC; $config->objectTables['doclib'] = TABLE_DOCLIB; $config->objectTables['todo'] = TABLE_TODO; diff --git a/module/action/config.php b/module/action/config.php index 568e426ba1..58d0f4a69c 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -13,6 +13,7 @@ $config->action->objectNameFields['testcase'] = 'title'; $config->action->objectNameFields['case'] = 'title'; $config->action->objectNameFields['testtask'] = 'name'; $config->action->objectNameFields['user'] = 'account'; +$config->action->objectNameFields['api'] = 'title'; $config->action->objectNameFields['doc'] = 'title'; $config->action->objectNameFields['doclib'] = 'name'; $config->action->objectNameFields['todo'] = 'name'; diff --git a/module/action/lang/en.php b/module/action/lang/en.php index b4d7d6af8b..9891d2d2e8 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -97,6 +97,7 @@ $lang->action->objectTypes['testsuite'] = 'Suite'; $lang->action->objectTypes['testtask'] = 'Test Build'; $lang->action->objectTypes['testreport'] = 'Report'; $lang->action->objectTypes['doc'] = 'Document'; +$lang->action->objectTypes['api'] = 'Interface'; $lang->action->objectTypes['doclib'] = 'Document Library'; $lang->action->objectTypes['api'] = 'Interface Library'; $lang->action->objectTypes['apistruct'] = 'API struct'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index af76dd3b6b..18955bbe46 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -97,6 +97,7 @@ $lang->action->objectTypes['testsuite'] = '套件'; $lang->action->objectTypes['testtask'] = '测试单'; $lang->action->objectTypes['testreport'] = '报告'; $lang->action->objectTypes['doc'] = '文档'; +$lang->action->objectTypes['api'] = '接口'; $lang->action->objectTypes['doclib'] = '文档库'; $lang->action->objectTypes['api'] = '接口库'; $lang->action->objectTypes['apistruct'] = '数据结构'; diff --git a/module/action/view/trash.html.php b/module/action/view/trash.html.php index 4e8bdae124..a57f5be81f 100755 --- a/module/action/view/trash.html.php +++ b/module/action/view/trash.html.php @@ -57,6 +57,11 @@ $methodName = 'view'; $module = 'caselib'; } + if($action->objectType == 'api') + { + $params = "libID=0&moduelID=0&apiID={$action->objectID}"; + $methodName = 'index'; + } if(isset($config->action->customFlows[$action->objectType])) { $flow = $config->action->customFlows[$action->objectType]; diff --git a/module/api/control.php b/module/api/control.php index ee7ea7bb02..1a61841878 100755 --- a/module/api/control.php +++ b/module/api/control.php @@ -1,4 +1,5 @@ doc->getApiLibs(); - - /* Generate bread crumbs dropMenu. */ - if($libs) - { - if($libID == 0) $libID = key($libs); - $this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID, $release); - } - $this->setMenu($libID); /* Get an api doc. */ if($apiID > 0) @@ -67,9 +58,20 @@ class api extends control $this->view->apiList = $apiList; } + /* Get all api doc libraries. */ + $libs = $this->doc->getApiLibs(); + + /* Generate bread crumbs dropMenu. */ + if($libs) + { + if($libID == 0) $libID = key($libs); + $this->lang->modulePageNav = $this->generateLibsDropMenu($libs, $libID, $release); + } + $this->setMenu($libID); + $this->view->isRelease = $release > 0; $this->view->release = $release; - $this->view->title = $this->lang->api->title; + $this->view->title = $this->lang->api->pageTitle; $this->view->libID = $libID; $this->view->apiID = $apiID; $this->view->libs = $libs; @@ -210,6 +212,7 @@ class api extends control $userId = $this->app->user->account; $data = fixer::input('post') ->add('lib', $libID) + ->skipSpecial('attribute') ->add('addedBy', $userId) ->add('addedDate', $now) ->add('editedBy', $userId) @@ -231,6 +234,7 @@ class api extends control } $this->view->typeOptions = $options; $this->view->title = $this->lang->api->createStruct; + $this->view->gobackLink = $this->createLink('api', 'struct', "libID=$libID"); $this->display(); } @@ -253,6 +257,7 @@ class api extends control $now = helper::now(); $userId = $this->app->user->account; $data = fixer::input('post') + ->skipSpecial('attribute') ->add('lib', $struct->lib) ->add('editedBy', $userId) ->add('editedDate', $now) @@ -383,7 +388,7 @@ class api extends control { if($confirm == 'no') { - die(js::confirm($this->lang->doc->confirmDeleteLib, $this->createLink('api', 'deleteLib', "libID=$libID&confirm=yes"))); + die(js::confirm($this->lang->api->confirmDeleteLib, $this->createLink('api', 'deleteLib', "libID=$libID&confirm=yes"))); } else { @@ -415,6 +420,7 @@ class api extends control $userId = $this->app->user->account; $params = fixer::input('post') ->remove('type') + ->skipSpecial('params,response') ->add('addedBy', $userId) ->add('addedDate', $now) ->add('editedBy', $userId) @@ -449,6 +455,7 @@ class api extends control $options[] = array('label' => $item, 'value' => $key); } $this->view->typeOptions = $options; + $this->view->gobackLink = $this->createLink('api', 'index', "libID={$api->lib}&moduleID={$api->module}"); $this->view->user = $this->app->user->account; $this->view->allUsers = $this->loadModel('user')->getPairs('devfirst|noclosed');; $this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($api->lib, 'api', $startModuleID = 0); @@ -474,6 +481,7 @@ class api extends control $now = helper::now(); $params = fixer::input('post') ->remove('type') + ->skipSpecial('params,response') ->add('addedBy', $this->app->user->account) ->add('addedDate', $now) ->add('editedBy', $this->app->user->account) @@ -501,6 +509,7 @@ class api extends control $example = json_encode($example, JSON_PRETTY_PRINT); $this->getTypeOptions($libID); + $this->view->gobackLink = $this->createLink('api', 'index', "libID=$libID&moduleID=$moduleID"); $this->view->user = $this->app->user->account; $this->view->allUsers = $this->loadModel('user')->getPairs('devfirst|noclosed'); $this->view->libID = $libID; @@ -595,6 +604,21 @@ class api extends control $this->sendSuccess(array('info' => $info)); } + /** + * Ajax get all child module. + * + * @access public + * @return void + */ + public function ajaxGetChild($libID, $type = 'module') + { + $this->loadModel('tree'); + $childModules = $this->tree->getOptionMenu($libID, 'api'); + $select = ($type == 'module') ? html::select('module', $childModules, '', "class='form-control chosen'") : html::select('parent', $childModules, '', "class='form-control chosen'"); + die($select); + } + + /** * Set doc menu by method name. * @@ -665,7 +689,7 @@ class api extends control private function generateLibsDropMenu($libs, $libID, $version = 0) { if(empty($libs)) return ''; - if (!isset($libs[$libID])) return ''; + if(!isset($libs[$libID])) return ''; $libName = $libs[$libID]->name; $output = << $lib) { $selected = $key == $libID ? 'selected' : ''; - $output .= html::a(inlink('index', "libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->tab}'"); + $output .= html::a(inlink('index', "libID=$key"), $lib->name, '', "class='$selected' data-app='{$this->app->tab}'"); } $output .= ""; @@ -694,7 +718,7 @@ EOT; if(!empty($versions)) { $versionName = $version > 0 ? $versions[$version]->version : $this->lang->api->defaultVersion; - $output .= <<
diff --git a/module/api/view/create.html.php b/module/api/view/create.html.php index 0c1addaa48..b77ed21b35 100644 --- a/module/api/view/create.html.php +++ b/module/api/view/create.html.php @@ -69,8 +69,7 @@ js::set('struct_paramsType', $lang->struct->paramsType); api->module;?> - + @@ -177,8 +176,8 @@ js::set('struct_paramsType', $lang->struct->paramsType); - - + + diff --git a/module/api/view/index.html.php b/module/api/view/index.html.php index a63fce5607..0f31f9d273 100644 --- a/module/api/view/index.html.php +++ b/module/api/view/index.html.php @@ -58,7 +58,7 @@
-
  • 0 ? $lang->api->apiList : $lang->api->title;?>
  • +
  • 0 ? $lang->api->apiList : $lang->api->pageTitle;?>
  • diff --git a/module/api/view/struct.html.php b/module/api/view/struct.html.php index e90291d858..ddd4e6b55d 100644 --- a/module/api/view/struct.html.php +++ b/module/api/view/struct.html.php @@ -19,6 +19,13 @@ " . $lang->api->createStruct, '', "class='btn btn-primary create-user-btn'");?>
    + +
    +

    + api->noStruct;?> +

    +
    +
    @@ -38,7 +45,7 @@ - +
    id);?> type;?> name;?>addedBy;?>addedName;?> addedDate;?>
    +
    diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 1130de176d..50ed8f0b0c 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1390,7 +1390,7 @@ $lang->resource->api->createLib = 'createLib'; $lang->resource->api->editLib = 'editLib'; $lang->resource->api->deleteLib = 'deleteLib'; $lang->resource->api->publish = 'publish'; -$lang->resource->api->editPublic = 'editPublish'; +$lang->resource->api->editPublish = 'editPublish'; $lang->resource->api->struct = 'struct'; $lang->resource->api->createStruct = 'createStruct'; $lang->resource->api->editStruct = 'editStruct'; @@ -1408,6 +1408,7 @@ $lang->api->methodOrder[5] = 'createLib'; $lang->api->methodOrder[10] = 'editLib'; $lang->api->methodOrder[15] = 'deleteLib'; $lang->api->methodOrder[20] = 'publish'; +$lang->api->methodOrder[21] = 'editPublish'; $lang->api->methodOrder[25] = 'struct'; $lang->api->methodOrder[30] = 'createStruct'; $lang->api->methodOrder[35] = 'editStruct';