* Finish task #89149, and fix bug of merge code.

This commit is contained in:
liumengyi
2023-03-29 08:55:25 +08:00
parent bb3c743d75
commit be75bd716f
8 changed files with 47 additions and 20 deletions
+2 -2
View File
@@ -2,10 +2,10 @@
$config->api = new stdClass();
$config->api->createlib = new stdclass();
$config->api->createlib->requiredFields = 'name,baseUrl';
$config->api->createlib->requiredFields = 'name';
$config->api->editlib = new stdclass();
$config->api->editlib->requiredFields = 'name,baseUrl';
$config->api->editlib->requiredFields = 'name';
$config->api->struct = new stdClass();
$config->api->struct->requiredFields = 'name,params';
+1 -1
View File
@@ -347,7 +347,7 @@ class api extends control
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('api', 'index', "libID=$libID")));
}
$this->lang->api->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
$this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common);
$this->view->type = $type;
$this->view->groups = $this->loadModel('group')->getPairs();
+12 -2
View File
@@ -199,6 +199,9 @@ class doc extends control
unset($this->lang->doclib->aclList['open']);
}
$this->app->loadLang('api');
$this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common);
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->users = $this->user->getPairs('nocode|noclosed');
$this->view->objects = $objects;
@@ -267,10 +270,17 @@ class doc extends control
}
if($lib->type == 'custom') unset($this->lang->doclib->aclList['default']);
if($lib->type == 'api')
{
$this->app->loadLang('api');
$type = !empty($lib->product) ? 'product' : 'project';
$this->lang->api->aclList['default'] = sprintf($this->lang->api->aclList['default'], $this->lang->{$type}->common);
}
if($lib->type != 'custom')
{
$this->lang->doclib->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$lib->type}->common);
$this->lang->doclib->aclList['private'] = sprintf($this->lang->doclib->privateACL, $this->lang->{$lib->type}->common);
$type = isset($type) ? $type : $lib->type;
$this->lang->doclib->aclList['default'] = sprintf($this->lang->doclib->aclList['default'], $this->lang->{$type}->common);
$this->lang->doclib->aclList['private'] = sprintf($this->lang->doclib->privateACL, $this->lang->{$type}->common);
unset($this->lang->doclib->aclList['open']);
}
+5 -4
View File
@@ -36,12 +36,12 @@ function loadExecutions(projectID)
function toggleAcl(acl, type)
{
var libID = $('#lib').val();
if($('#lib').length == 0)
if($('#lib').length == 0 && $('#module').length > 0)
{
var moduleID = $('#module').val();
if(moduleID.indexOf('_') >= 0) libID = moduleID.substr(0, moduleID.indexOf('_'));
}
if(acl == 'custom')
if(acl == 'default' && $('#libTypewiki').attr('checked') != 'checked')
{
$('#whiteListBox').removeClass('hidden');
$('#groupBox').removeClass('hidden');
@@ -49,16 +49,17 @@ function toggleAcl(acl, type)
else if(acl == 'private')
{
$('#whiteListBox').removeClass('hidden');
$('#groupBox').addClass('hidden');
$('#groupBox').removeClass('hidden');
}
else
{
$('#whiteListBox').addClass('hidden');
$('#groupBox').addClass('hidden');
}
if(type == 'lib')
{
if((libType == 'api' || libType == 'book') && acl == 'private') $('#whiteListBox').addClass('hidden');
if(libType == 'book' && acl == 'private') $('#whiteListBox').addClass('hidden');
if(libType == 'project' && typeof(doclibID) != 'undefined')
{
+16
View File
@@ -10,3 +10,19 @@ $('#project').change(function()
}
});
});
function changeDoclibAcl(libType)
{
if(libType == 'api')
{
$('.apilib').removeClass('hidden');
$('#mainContent table th').css('width', '100px');
$('#aclBox').find('td').html($('#aclAPIBox td').html());
}
else
{
$('.apilib').addClass('hidden');
$('#mainContent table th').css('width', '70px');
$('#aclBox').find('td').html($('#aclOtherBox td').html());
}
}
+1
View File
@@ -206,6 +206,7 @@ class docModel extends model
$execution = $this->loadModel('execution')->getByID($lib->execution);
$lib->project = $execution->project;
}
if($this->post->libType) $lib->type = 'api';
if($lib->acl == 'custom' or $lib->acl == 'private')
{
+8 -10
View File
@@ -39,7 +39,7 @@
<tr>
<th><?php echo $lang->doc->libType;?></th>
<td>
<span><?php echo html::radio('libType', $lang->doclib->type, 'wiki')?></span>
<span><?php echo html::radio('libType', $lang->doclib->type, 'wiki', "onchange='changeDoclibAcl(this.value)'")?></span>
</td>
</tr>
<?php endif;?>
@@ -71,12 +71,6 @@
</div>
</td>
</tr>
<tr class="apilib hidden">
<th><?php echo $lang->api->desc;?></th>
<td>
<?php echo html::textarea('desc', '', "rows='8' class='form-control kindeditor' hidefocus='true' tabindex=''");?>
</td>
</tr>
<tr>
<td class='text-center form-actions' colspan='2'>
<?php echo html::submitButton();?>
@@ -94,11 +88,15 @@
<tr id='aclAPIBox'>
<th><?php echo $lang->doclib->control;?></th>
<td>
<?php echo html::radio('acl', $lang->doclib->aclListA, 'default', "onchange='toggleAcl(this.value, \"lib\")'")?>
<?php echo html::radio('acl', $lang->api->aclList, 'open', "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
</td>
</tr>
<tr id='aclOtherBox'>
<th><?php echo $lang->doclib->control;?></th>
<td>
<?php echo html::radio('acl', $lang->doclib->aclList, 'default', "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
</td>
</tr>
</table>
</div>
<?php js::set('noticeAcl', $lang->doc->noticeAcl['lib']);?>
<?php js::set('libType', $type);?>
<?php include '../../common/view/footer.lite.html.php';?>
+2 -1
View File
@@ -50,7 +50,8 @@
<tr id="aclBox">
<th><?php echo $lang->doclib->control;?></th>
<td>
<?php echo html::radio('acl', $lang->doclib->aclList, $lib->acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
<?php if($lib->type != 'api') echo html::radio('acl', $lang->doclib->aclList, $lib->acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
<?php if($lib->type == 'api') echo html::radio('acl', $lang->api->aclList, $lib->acl, "onchange='toggleAcl(this.value, \"lib\")'", 'block')?>
</td>
</tr>
<tr id='whiteListBox' class='hidden'>