-

api->createLib : $lang->api->createDemo;?>

+

api->createLib;?>

+ + + + + + + + + + + + - + - + - + - - @@ -66,5 +83,6 @@ -api->noticeAcl);?> +productCommon);?> +projectCommon);?> diff --git a/module/api/view/editlib.html.php b/module/api/view/editlib.html.php index 8cdcf93401..759ef30378 100644 --- a/module/api/view/editlib.html.php +++ b/module/api/view/editlib.html.php @@ -22,38 +22,56 @@
api->libType;?> + api->libTypeList, $type, "onchange='toggleLibType(this.value)'")?> +
api->product;?> + +
api->name?>api->zentaoAPI : '', "class='form-control'")?>
api->baseUrl?>app->config->webRoot . 'api.php/v1') : '', "class='form-control' placeholder='" . $lang->api->baseUrlDesc . "'");?>api->baseUrlDesc . "'");?>
api->control;?> - - api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")' $isDisabled")?> - api->noticeAcl['open'];?> + + api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'", 'block');?>
api->desc;?> - +
+ + + + + '> + + + + '> + + + - + - + - + - '> + '> - @@ -65,22 +83,6 @@ -
api->libType;?> + api->libTypeList, $type, "onchange='toggleLibType(this.value)'")?> +
api->product;?> + product, "class='form-control chosen'")?> +
api->project;?> + project, "class='form-control chosen'")?> +
api->name?>name, "class='form-control'");?>name, "class='form-control'");?>
api->baseUrl?>baseUrl, "class='form-control'");?>baseUrl, "class='form-control'");?>
api->control;?> - api->aclList, $doc->acl, "onchange='toggleAcl(this.value, \"lib\")'")?> - api->noticeAcl['open'];?> + api->aclList, $lib->acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
api->whiteList;?> +
api->group?> - groups, "class='form-control chosen' multiple");?> + groups, "class='form-control chosen' multiple");?>
api->user?> - users, "class='form-control chosen' multiple");?> + users, "class='form-control chosen' multiple");?> + fetch('my', 'buildContactLists', "dropdownName=users&attr=data-drop_direction='up'");?>
api->desc;?> - desc, "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?> + desc, "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?>
- - - - - - - - -
api->control;?> - api->aclListA, 'default', "onchange='toggleAcl(this.value, \"lib\")'");?> -
api->control;?>api->aclListB, 'open', "onchange='toggleAcl(this.value, \"lib\")'");?>
-
-api->noticeAcl);?> - +productCommon);?> +projectCommon);?> diff --git a/module/doc/model.php b/module/doc/model.php index 024e56eca1..58e1316589 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -191,7 +191,6 @@ class docModel extends model */ public function createLib() { - $now = helper::now(); $lib = fixer::input('post') ->setForce('product', $this->post->type == 'product' ? $this->post->product : 0) ->setForce('project', $this->post->type == 'project' ? $this->post->project : 0) @@ -199,7 +198,7 @@ class docModel extends model ->join('groups', ',') ->join('users', ',') ->add('addedBy', $this->app->user->account) - ->add('addedDate', $now) + ->add('addedDate', helper::now()) ->remove('uid,contactListMenu,libType') ->get(); @@ -231,17 +230,26 @@ class docModel extends model */ public function createApiLib() { - /* Replace doc library name. */ - $this->lang->doclib->name = $this->lang->doclib->apiLibName; - $data = fixer::input('post') ->trim('name') ->join('groups', ',') ->join('users', ',') + ->setForce('product', $this->post->libType == 'product' ? $this->post->product : 0) + ->setForce('project', $this->post->libType == 'project' ? $this->post->project : 0) + ->add('addedBy', $this->app->user->account) + ->add('addedDate', helper::now()) + ->remove('uid,contactListMenu,libType') ->get(); - if($data->acl == 'private') $data->users = $this->app->user->account; - if($data->acl == 'custom' && strpos($data->users, $this->app->user->account) === false) $data->users .= ',' . $this->app->user->account; + $this->app->loadLang('api'); + + /* Replace doc library name. */ + $this->lang->doclib->name = $this->lang->doclib->apiLibName; + $this->lang->doclib->baseUrl = $this->lang->api->baseUrl; + $this->lang->doclib->project = $this->lang->api->project; + $this->lang->doclib->product = $this->lang->api->product; + + $this->config->api->createlib->requiredFields .= $this->post->libType == 'product' ? ',product' : ',project'; $data->type = static::DOC_TYPE_API; $this->dao->insert(TABLE_DOCLIB)->data($data)->autoCheck() @@ -255,16 +263,33 @@ class docModel extends model /** * Update api lib. * - * @param int $id - * @param stdClass $oldDoc - * @param array $data + * @param int $id * @access public * @return array|int */ - public function updateApiLib($id, $oldDoc, $data) + public function updateApiLib($id) { + $oldLib = $this->getLibById($id); + + $data = fixer::input('post') + ->trim('name') + ->join('groups', ',') + ->join('users', ',') + ->setForce('product', $this->post->libType == 'product' ? $this->post->product : 0) + ->setForce('project', $this->post->libType == 'project' ? $this->post->project : 0) + ->remove('uid,contactListMenu,libType') + ->get(); + + $this->app->loadLang('api'); + /* Replace doc library name. */ - $this->lang->doclib->name = $this->lang->doclib->apiLibName; + $this->lang->doclib->name = $this->lang->doclib->apiLibName; + $this->lang->doclib->baseUrl = $this->lang->api->baseUrl; + $this->lang->doclib->project = $this->lang->api->project; + $this->lang->doclib->product = $this->lang->api->product; + + + $this->config->api->editlib->requiredFields .= $this->post->libType == 'product' ? ',product' : ',project'; $data->type = static::DOC_TYPE_API; $this->dao->update(TABLE_DOCLIB)->data($data)->autoCheck() @@ -807,7 +832,6 @@ class docModel extends model return false; } - $now = helper::now(); $doc = fixer::input('post')->setDefault('module', 0) ->callFunc('title', 'trim') ->stripTags($this->config->doc->editor->edit['id'], $this->config->allowedTags) @@ -817,7 +841,7 @@ class docModel extends model ->setDefault('execution', 0) ->setDefault('mailto', '') ->add('editedBy', $this->app->user->account) - ->add('editedDate', $now) + ->add('editedDate', helper::now()) ->cleanInt('module') ->join('groups', ',') ->join('users', ',')