* Finish task #89144.

This commit is contained in:
liumengyi
2023-03-28 15:12:52 +08:00
parent 4d25201a75
commit 7101aa2c9c
12 changed files with 194 additions and 104 deletions
+38 -14
View File
@@ -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', ',')