* Finish task #89144.
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
$config->api = new stdClass();
|
||||
|
||||
$config->api->createlib = new stdclass();
|
||||
$config->api->createlib->requiredFields = 'name';
|
||||
$config->api->createlib->requiredFields = 'name,baseUrl';
|
||||
|
||||
$config->api->editlib = new stdclass();
|
||||
$config->api->editlib->requiredFields = 'name';
|
||||
$config->api->editlib->requiredFields = 'name,baseUrl';
|
||||
|
||||
$config->api->struct = new stdClass();
|
||||
$config->api->struct->requiredFields = 'name,params';
|
||||
|
||||
@@ -333,26 +333,27 @@ class api extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function createLib($type = 'normal')
|
||||
public function createLib($type = 'product')
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$libID = $type == 'demo' ? $this->api->createDemoData($this->post->name, $this->post->baseUrl) : $this->doc->createApiLib();
|
||||
if(dao::isError()) return $this->sendError(dao::getError());
|
||||
|
||||
/* If the created api library of imported zentao api library, return directly. */
|
||||
if($type == 'demo') return $this->sendSuccess(array('locate' => $this->createLink('api', 'index', "libID=$libID")));
|
||||
$libID = $this->doc->createApiLib();
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
/* Record action for create api library. */
|
||||
$this->action->create('docLib', $libID, 'Created');
|
||||
$this->action->create('doclib', $libID, 'created');
|
||||
|
||||
if(!helper::isAjaxRequest()) return print(js::locate($this->createLink('api', 'index', "libID=$libID"), 'parent.parent'));
|
||||
return $this->sendSuccess(array('locate' => $this->createLink('api', 'index', "libID=$libID")));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('api', 'index', "libID=$libID")));
|
||||
}
|
||||
|
||||
$this->view->type = $type;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('nocode|noclosed');
|
||||
$this->lang->api->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
|
||||
|
||||
$this->view->type = $type;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('nocode|noclosed');
|
||||
$this->view->projects = $this->loadModel('project')->getPairsByModel();
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -366,28 +367,26 @@ class api extends control
|
||||
*/
|
||||
public function editLib($id)
|
||||
{
|
||||
$doc = $this->doc->getLibById($id);
|
||||
$lib = $this->doc->getLibById($id);
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$lib = fixer::input('post')->join('groups', ',')->join('users', ',')->get();
|
||||
|
||||
if($lib->acl == 'private') $lib->users = $this->app->user->account;
|
||||
$this->doc->updateApiLib($id, $doc, $lib);
|
||||
$this->doc->updateApiLib($id);
|
||||
|
||||
if(dao::isError()) return $this->sendError(dao::getError());
|
||||
|
||||
$res = array(
|
||||
'message' => $this->lang->saveSuccess,
|
||||
'closeModal' => true,
|
||||
'callback' => "redirectParentWindow($id)",
|
||||
);
|
||||
return $this->sendSuccess($res);
|
||||
return $this->sendSuccess(array('message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "redirectParentWindow($id)"));
|
||||
}
|
||||
|
||||
$this->view->doc = $doc;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('nocode|noclosed');
|
||||
$type = !empty($lib->product) ? 'product' : 'project';
|
||||
$this->lang->api->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
|
||||
|
||||
$this->view->lib = $lib;
|
||||
$this->view->type = $type;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('nocode|noclosed');
|
||||
$this->view->projects = $this->loadModel('project')->getPairsByModel();
|
||||
$this->view->products = $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -100,3 +100,5 @@ ol, ul {margin-bottom: 0}
|
||||
|
||||
form .table-data, #content .table-data {border: 1px solid #e2e2e3;}
|
||||
.table-data thead {background: #f9f9f9;}
|
||||
|
||||
#aclBox .acl-tip {color: #838a9d;}
|
||||
|
||||
@@ -19,23 +19,36 @@ function loadDocModule(libID)
|
||||
*/
|
||||
function toggleAcl(acl, type)
|
||||
{
|
||||
if(acl == 'custom')
|
||||
{
|
||||
$('#whiteListBox').removeClass('hidden');
|
||||
}
|
||||
else
|
||||
if(acl == 'open')
|
||||
{
|
||||
$('#whiteListBox').addClass('hidden');
|
||||
}
|
||||
if(type == 'lib')
|
||||
else
|
||||
{
|
||||
var notice = typeof(noticeAcl[acl]) != 'undefined' ? noticeAcl[acl] : '';
|
||||
$('#noticeAcl').html(notice);
|
||||
$('#whiteListBox').removeClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle lib type.
|
||||
*
|
||||
* @param string $libType
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function toggleLibType(libType)
|
||||
{
|
||||
if(libType == 'project')
|
||||
{
|
||||
$('#projectBox').removeClass('hidden');
|
||||
$('#productBox').addClass('hidden');
|
||||
$('#acldefault').next('.acl-tip').html($('#acldefault').next('.acl-tip').html().replace(productLang, projectLang));
|
||||
}
|
||||
else
|
||||
{
|
||||
var notice = typeof(noticeAcl[acl]) != 'undefined' ? noticeAcl[acl] : '';
|
||||
$('#noticeAcl').html(notice);
|
||||
$('#projectBox').addClass('hidden');
|
||||
$('#productBox').removeClass('hidden');
|
||||
$('#acldefault').next('.acl-tip').html($('#acldefault').next('.acl-tip').html().replace(projectLang, productLang));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,4 +10,4 @@ $(document).ready(function()
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
@@ -64,9 +64,9 @@ $lang->api->allLibs = "AllLibs";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'Whitelist';
|
||||
$lang->api->aclList['open'] = 'Open';
|
||||
$lang->api->aclList['private'] = 'Private';
|
||||
$lang->api->aclList['custom'] = 'Custom';
|
||||
$lang->api->aclList['open'] = "Public <span class='acl-tip'>(Users who can access doccan access it)</span>";
|
||||
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s or users in the whiltelist can access it)</span>";
|
||||
$lang->api->aclList['private'] = "Private <span class='acl-tip'> (Only the one who created it or users in the whiltelist can access it)</span>";
|
||||
$lang->api->group = 'Group';
|
||||
$lang->api->user = 'User';
|
||||
|
||||
@@ -148,6 +148,10 @@ $lang->api->default = 'Default';
|
||||
$lang->api->desc = 'Beschreibung';
|
||||
$lang->api->customType = 'Custom Structure';
|
||||
$lang->api->format = 'Format';
|
||||
$lang->api->libType = 'Api Library Type';
|
||||
$lang->api->product = $lang->productCommon;
|
||||
$lang->api->project = $lang->projectCommon;
|
||||
|
||||
$lang->api->methodOptions = array(
|
||||
'GET' => 'GET',
|
||||
'POST' => 'POST',
|
||||
@@ -169,6 +173,10 @@ $lang->api->requestTypeOptions['application/json'] = 'applicati
|
||||
$lang->api->requestTypeOptions['application/x-www-form-urlencoded'] = 'application/x-www-form-urlencoded';
|
||||
$lang->api->requestTypeOptions['multipart/form-data'] = 'multipart/form-data';
|
||||
|
||||
$lang->api->libTypeList = array();
|
||||
$lang->api->libTypeList['product'] = $lang->productCommon . ' Api Library';
|
||||
$lang->api->libTypeList['project'] = $lang->projectCommon . ' Api Library';
|
||||
|
||||
$lang->api->statusOptions = array(
|
||||
'done' => 'Done',
|
||||
'doing' => 'Doing',
|
||||
|
||||
@@ -64,9 +64,9 @@ $lang->api->allLibs = "AllLibs";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'Whitelist';
|
||||
$lang->api->aclList['open'] = 'Open';
|
||||
$lang->api->aclList['private'] = 'Private';
|
||||
$lang->api->aclList['custom'] = 'Custom';
|
||||
$lang->api->aclList['open'] = "Public <span class='acl-tip'>(Users who can access doccan access it)</span>";
|
||||
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s or users in the whiltelist can access it)</span>";
|
||||
$lang->api->aclList['private'] = "Private <span class='acl-tip'> (Only the one who created it or users in the whiltelist can access it)</span>";
|
||||
$lang->api->group = 'Group';
|
||||
$lang->api->user = 'User';
|
||||
|
||||
@@ -148,6 +148,10 @@ $lang->api->default = 'Default';
|
||||
$lang->api->desc = 'Description';
|
||||
$lang->api->customType = 'Custom Structure';
|
||||
$lang->api->format = 'Format';
|
||||
$lang->api->libType = 'Api Library Type';
|
||||
$lang->api->product = $lang->productCommon;
|
||||
$lang->api->project = $lang->projectCommon;
|
||||
|
||||
$lang->api->methodOptions = array(
|
||||
'GET' => 'GET',
|
||||
'POST' => 'POST',
|
||||
@@ -169,6 +173,10 @@ $lang->api->requestTypeOptions['application/json'] = 'applicati
|
||||
$lang->api->requestTypeOptions['application/x-www-form-urlencoded'] = 'application/x-www-form-urlencoded';
|
||||
$lang->api->requestTypeOptions['multipart/form-data'] = 'multipart/form-data';
|
||||
|
||||
$lang->api->libTypeList = array();
|
||||
$lang->api->libTypeList['product'] = $lang->productCommon . ' Api Library';
|
||||
$lang->api->libTypeList['project'] = $lang->projectCommon . ' Api Library';
|
||||
|
||||
$lang->api->statusOptions = array(
|
||||
'done' => 'Done',
|
||||
'doing' => 'Doing',
|
||||
|
||||
@@ -64,9 +64,9 @@ $lang->api->allLibs = "AllLibs";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = 'Whitelist';
|
||||
$lang->api->aclList['open'] = 'Open';
|
||||
$lang->api->aclList['private'] = 'Private';
|
||||
$lang->api->aclList['custom'] = 'Custom';
|
||||
$lang->api->aclList['open'] = "Public <span class='acl-tip'>(Users who can access doccan access it)</span>";
|
||||
$lang->api->aclList['default'] = "Default <span class='acl-tip'>(Users who can access the selected %s or users in the whiltelist can access it)</span>";
|
||||
$lang->api->aclList['private'] = "Private <span class='acl-tip'> (Only the one who created it or users in the whiltelist can access it)</span>";
|
||||
$lang->api->group = 'Group';
|
||||
$lang->api->user = 'User';
|
||||
|
||||
@@ -148,6 +148,10 @@ $lang->api->default = 'Default';
|
||||
$lang->api->desc = 'Description';
|
||||
$lang->api->customType = 'Custom Structure';
|
||||
$lang->api->format = 'Format';
|
||||
$lang->api->libType = 'Api Library Type';
|
||||
$lang->api->product = $lang->productCommon;
|
||||
$lang->api->project = $lang->projectCommon;
|
||||
|
||||
$lang->api->methodOptions = array(
|
||||
'GET' => 'GET',
|
||||
'POST' => 'POST',
|
||||
@@ -169,6 +173,10 @@ $lang->api->requestTypeOptions['application/json'] = 'applicati
|
||||
$lang->api->requestTypeOptions['application/x-www-form-urlencoded'] = 'application/x-www-form-urlencoded';
|
||||
$lang->api->requestTypeOptions['multipart/form-data'] = 'multipart/form-data';
|
||||
|
||||
$lang->api->libTypeList = array();
|
||||
$lang->api->libTypeList['product'] = $lang->productCommon . ' Api Library';
|
||||
$lang->api->libTypeList['project'] = $lang->projectCommon . ' Api Library';
|
||||
|
||||
$lang->api->statusOptions = array(
|
||||
'done' => 'Done',
|
||||
'doing' => 'Doing',
|
||||
|
||||
@@ -64,9 +64,9 @@ $lang->api->allLibs = "全部接口库";
|
||||
|
||||
/* Common access control lang. */
|
||||
$lang->api->whiteList = '白名单';
|
||||
$lang->api->aclList['open'] = '公开';
|
||||
$lang->api->aclList['private'] = '私有';
|
||||
$lang->api->aclList['custom'] = '自定义';
|
||||
$lang->api->aclList['open'] = "公开 <span class='acl-tip'>(有文档视图权限即可访问)</span>";
|
||||
$lang->api->aclList['default'] = "默认 <span class='acl-tip'>(有所选%s访问权限用户和白名单用户可以访问)</span>";
|
||||
$lang->api->aclList['private'] = "私有 <span class='acl-tip'>(仅创建者和白名单用户可访问)</span>";
|
||||
$lang->api->group = '分组';
|
||||
$lang->api->user = '用户';
|
||||
|
||||
@@ -102,7 +102,7 @@ $lang->api->structType = '类型';
|
||||
$lang->api->structAttr = '属性';
|
||||
$lang->api->structAddedBy = '创建人';
|
||||
$lang->api->structAddedDate = '创建时间';
|
||||
$lang->api->name = '接口库名称';
|
||||
$lang->api->name = '库名称';
|
||||
$lang->api->baseUrl = '请求基础路径';
|
||||
$lang->api->baseUrlDesc = '网址或者路径,比如 test.zentao.net 或者 /v1';
|
||||
$lang->api->desc = '描述';
|
||||
@@ -148,6 +148,10 @@ $lang->api->default = '默认值';
|
||||
$lang->api->desc = '描述';
|
||||
$lang->api->customType = '自定义结构';
|
||||
$lang->api->format = '格式化';
|
||||
$lang->api->libType = '接口库类型';
|
||||
$lang->api->product = '所属' . $lang->productCommon;
|
||||
$lang->api->project = '所属' . $lang->projectCommon;
|
||||
|
||||
$lang->api->methodOptions = array(
|
||||
'GET' => 'GET',
|
||||
'POST' => 'POST',
|
||||
@@ -169,6 +173,10 @@ $lang->api->requestTypeOptions['application/json'] = 'applicati
|
||||
$lang->api->requestTypeOptions['application/x-www-form-urlencoded'] = 'application/x-www-form-urlencoded';
|
||||
$lang->api->requestTypeOptions['multipart/form-data'] = 'multipart/form-data';
|
||||
|
||||
$lang->api->libTypeList = array();
|
||||
$lang->api->libTypeList['product'] = $lang->productCommon . '接口库';
|
||||
$lang->api->libTypeList['project'] = $lang->projectCommon . '接口库';
|
||||
|
||||
$lang->api->statusOptions = array(
|
||||
'done' => '开发完成',
|
||||
'doing' => '开发中',
|
||||
|
||||
@@ -18,29 +18,45 @@
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $type == 'normal' ? $lang->api->createLib : $lang->api->createDemo;?></h2>
|
||||
<h2><?php echo $lang->api->createLib;?></h2>
|
||||
</div>
|
||||
<form class='load-indicator main-form' id="apiForm" method='post' enctype='multipart/form-data'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->libType;?></th>
|
||||
<td>
|
||||
<span><?php echo html::radio('libType', $lang->api->libTypeList, $type, "onchange='toggleLibType(this.value)'")?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='productBox'>
|
||||
<th><?php echo $lang->api->product;?></th>
|
||||
<td class='required'>
|
||||
<span><?php echo html::select('product', $products, 0, "class='form-control chosen'")?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='projectBox' class='hidden'>
|
||||
<th><?php echo $lang->api->project;?></th>
|
||||
<td class='required'>
|
||||
<span><?php echo html::select('project', $projects, 0, "class='form-control chosen'")?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->name?></th>
|
||||
<td style="width: 80%"><?php echo html::input('name', $type == 'demo' ? $lang->api->zentaoAPI : '', "class='form-control'")?></td>
|
||||
<td style="width: 80%"><?php echo html::input('name', '', "class='form-control'")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->baseUrl?></th>
|
||||
<td style="width: 80%"><?php echo html::input('baseUrl', $type == 'demo' ? ('http://' . $_SERVER['HTTP_HOST'] . $this->app->config->webRoot . 'api.php/v1') : '', "class='form-control' placeholder='" . $lang->api->baseUrlDesc . "'");?></td>
|
||||
<td style="width: 80%"><?php echo html::input('baseUrl', '', "class='form-control' placeholder='" . $lang->api->baseUrlDesc . "'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id='aclBox'>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td>
|
||||
<?php $isDisabled = $type == 'demo' ? 'disabled' : '';?>
|
||||
<span><?php echo html::radio('acl', $lang->api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")' $isDisabled")?></span>
|
||||
<span class='text-info' id='noticeAcl'><?php echo $lang->api->noticeAcl['open'];?></span>
|
||||
<td colspan='2'>
|
||||
<span><?php echo html::radio('acl', $lang->api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'", 'block');?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='whiteListBox' class='hidden'>
|
||||
<th><?php echo $lang->api->whiteList;?></th>
|
||||
<td>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon groups-addon'><?php echo $lang->api->group?></span>
|
||||
<?php echo html::select('groups[]', $groups, '', "class='form-control chosen' multiple")?>
|
||||
@@ -48,13 +64,14 @@
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->api->user?></span>
|
||||
<?php echo html::select('users[]', $users, '', "class='form-control chosen' multiple")?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=users&attr=data-drop_direction='up'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->desc;?></th>
|
||||
<td colspan='2'>
|
||||
<?php echo html::textarea('desc', '', "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?>
|
||||
<?php echo html::textarea('desc', '', "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -66,5 +83,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php js::set('noticeAcl', $lang->api->noticeAcl);?>
|
||||
<?php js::set('productLang', $lang->productCommon);?>
|
||||
<?php js::set('projectLang', $lang->projectCommon);?>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
@@ -22,38 +22,56 @@
|
||||
</div>
|
||||
<form class='load-indicator main-form form-ajax' id="apiForm" method='post' enctype='multipart/form-data'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->libType;?></th>
|
||||
<td>
|
||||
<span><?php echo html::radio('libType', $lang->api->libTypeList, $type, "onchange='toggleLibType(this.value)'")?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='productBox' class='<?php echo $type != 'product' ? 'hidden' : '';?>'>
|
||||
<th><?php echo $lang->api->product;?></th>
|
||||
<td>
|
||||
<span><?php echo html::select('product', $products, $lib->product, "class='form-control chosen'")?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='projectBox' class='<?php echo $type != 'project' ? 'hidden' : '';?>'>
|
||||
<th><?php echo $lang->api->project;?></th>
|
||||
<td>
|
||||
<span><?php echo html::select('project', $projects, $lib->project, "class='form-control chosen'")?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->name?></th>
|
||||
<td style="width: 80%"><?php echo html::input('name', $doc->name, "class='form-control'");?></td>
|
||||
<td style="width: 80%"><?php echo html::input('name', $lib->name, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->baseUrl?></th>
|
||||
<td style="width: 80%"><?php echo html::input('baseUrl', $doc->baseUrl, "class='form-control'");?></td>
|
||||
<td style="width: 80%"><?php echo html::input('baseUrl', $lib->baseUrl, "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id='aclBox'>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td>
|
||||
<span><?php echo html::radio('acl', $lang->api->aclList, $doc->acl, "onchange='toggleAcl(this.value, \"lib\")'")?></span>
|
||||
<span class='text-info' id='noticeAcl'><?php echo $lang->api->noticeAcl['open'];?></span>
|
||||
<span><?php echo html::radio('acl', $lang->api->aclList, $lib->acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='whiteListBox' class='<?php echo $doc->acl == 'custom' ? '' : 'hidden';?>'>
|
||||
<tr id='whiteListBox' class='<?php echo $lib->acl != 'open' ? '' : 'hidden';?>'>
|
||||
<th><?php echo $lang->api->whiteList;?></th>
|
||||
<td>
|
||||
<td colspan='2'>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon groups-addon'><?php echo $lang->api->group?></span>
|
||||
<?php echo html::select('groups[]', $groups, $doc->groups, "class='form-control chosen' multiple");?>
|
||||
<?php echo html::select('groups[]', $groups, $lib->groups, "class='form-control chosen' multiple");?>
|
||||
</div>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->api->user?></span>
|
||||
<?php echo html::select('users[]', $users, $doc->users, "class='form-control chosen' multiple");?>
|
||||
<?php echo html::select('users[]', $users, $lib->users, "class='form-control chosen' multiple");?>
|
||||
<?php echo $this->fetch('my', 'buildContactLists', "dropdownName=users&attr=data-drop_direction='up'");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->api->desc;?></th>
|
||||
<td colspan='2'>
|
||||
<?php echo html::textarea('desc', $doc->desc, "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?>
|
||||
<?php echo html::textarea('desc', $lib->desc, "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -65,22 +83,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='hidden'>
|
||||
<table>
|
||||
<tr id='aclBoxA'>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td>
|
||||
<?php echo html::radio('acl', $lang->api->aclListA, 'default', "onchange='toggleAcl(this.value, \"lib\")'");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id='aclBoxB'>
|
||||
<th><?php echo $lang->api->control;?></th>
|
||||
<td><?php echo html::radio('acl', $lang->api->aclListB, 'open', "onchange='toggleAcl(this.value, \"lib\")'");?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<?php js::set('noticeAcl', $lang->api->noticeAcl);?>
|
||||
<script>
|
||||
$(function(){toggleAcl($('form input[name="acl"]:checked').val(), 'lib');})
|
||||
</script>
|
||||
<?php js::set('productLang', $lang->productCommon);?>
|
||||
<?php js::set('projectLang', $lang->projectCommon);?>
|
||||
<?php include '../../common/view/footer.lite.html.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', ',')
|
||||
|
||||
Reference in New Issue
Block a user