* Code for task #89135.
This commit is contained in:
@@ -2,6 +2,8 @@ UPDATE `zt_doc` SET `type` = 'text' WHERE `type` = 'url';
|
||||
|
||||
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'custom' and `acl` = 'custom';
|
||||
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'product' AND `acl` = 'custom';
|
||||
UPDATE `zt_doclib` SET `acl` = 'private' WHERE `type` = 'project' AND `acl` = 'custom';
|
||||
UPDATE `zt_doclib` SET `acl` = 'default' WHERE `type` = 'project' AND `acl` IN ('open', 'private');
|
||||
|
||||
ALTER TABLE `zt_doclib` ADD `addedBy` varchar(30) NOT NULL AFTER `order`;
|
||||
ALTER TABLE `zt_doclib` ADD `addedDate` datetime NOT NULL AFTER `addedBy`;
|
||||
|
||||
@@ -150,36 +150,38 @@ class doc extends control
|
||||
|
||||
if(in_array($type, array('product', 'project'))) $this->app->loadLang('api');
|
||||
|
||||
$objects = array();
|
||||
$objects = array();
|
||||
$executionPairs = array(0 => '');
|
||||
if($type == 'product') $objects = $this->product->getPairs();
|
||||
if($type == 'project') $objects = $this->project->getPairsByProgram();
|
||||
if($type == 'project')
|
||||
{
|
||||
$objects = $this->project->getPairsByProgram();
|
||||
$executions = $this->execution->getList($objectID);
|
||||
}
|
||||
if($type == 'execution')
|
||||
{
|
||||
$objects = $this->execution->getList();
|
||||
$projects = $this->project->getPairsByProgram('', 'all', true);
|
||||
$executions = $this->execution->getList();
|
||||
$projects = $this->project->getPairsByProgram('', 'all', true);
|
||||
}
|
||||
|
||||
/* Splice project name. */
|
||||
if($type == 'object')
|
||||
if(!empty($executions))
|
||||
{
|
||||
foreach($objects as $id => $object)
|
||||
foreach($executions as $id => $execution)
|
||||
{
|
||||
if($object->multiple)
|
||||
if($execution->multiple)
|
||||
{
|
||||
if($object->type == 'stage' and $object->grade > 1)
|
||||
if($execution->type == 'stage' and $execution->grade > 1)
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($object->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$object->name = implode('/', $parentExecutions);
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$execution->name = implode('/', $parentExecutions);
|
||||
}
|
||||
|
||||
$objectPrefix = isset($projects[$object->project]) ? $projects[$object->project] . '/' : '';
|
||||
$objects[$id] = $objectPrefix . $object->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
unset($objects[$id]);
|
||||
$executionPrefix = isset($projects[$execution->project]) ? $projects[$execution->project] . '/' : '';
|
||||
$executionPairs[$id] = $executionPrefix . $execution->name;
|
||||
}
|
||||
}
|
||||
if($type == 'executions') $objects = $executionPairs;
|
||||
}
|
||||
|
||||
if($type == 'execution')
|
||||
@@ -196,11 +198,12 @@ class doc extends control
|
||||
unset($this->lang->doclib->aclList['open']);
|
||||
}
|
||||
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('nocode|noclosed');
|
||||
$this->view->objects = $objects;
|
||||
$this->view->type = $type;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('nocode|noclosed');
|
||||
$this->view->objects = $objects;
|
||||
$this->view->executionPairs = $executionPairs;
|
||||
$this->view->type = $type;
|
||||
$this->view->objectID = $objectID;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -266,8 +269,10 @@ class doc extends control
|
||||
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);
|
||||
unset($this->lang->doclib->aclList['open']);
|
||||
}
|
||||
|
||||
$this->view->lib = $lib;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('noletter|noclosed', $lib->users);
|
||||
@@ -1414,4 +1419,34 @@ class doc extends control
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax Get the execution drop down by the projectID.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ajaxGetExecution($projectID)
|
||||
{
|
||||
$executions = $this->execution->getList($projectID);
|
||||
$executionPairs = array(0 => '');
|
||||
if(!empty($executions))
|
||||
{
|
||||
foreach($executions as $id => $execution)
|
||||
{
|
||||
if($execution->multiple)
|
||||
{
|
||||
if($execution->type == 'stage' and $execution->grade > 1)
|
||||
{
|
||||
$parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs();
|
||||
$execution->name = implode('/', $parentExecutions);
|
||||
}
|
||||
|
||||
$executionPairs[$id] = $execution->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return print(html::select('execution', $executionPairs, 0, "class='form-control' data-placeholder='{$this->lang->doclib->tip->selectExecution}'"));
|
||||
}
|
||||
}
|
||||
|
||||
12
module/doc/js/createlib.js
Normal file
12
module/doc/js/createlib.js
Normal file
@@ -0,0 +1,12 @@
|
||||
$('#project').change(function()
|
||||
{
|
||||
$.get(createLink('doc', 'ajaxGetExecution', 'projectID=' + $(this).val()), function(data)
|
||||
{
|
||||
if(data)
|
||||
{
|
||||
$('#execution').replaceWith(data);
|
||||
$('#execution_chosen').remove();
|
||||
$('#execution').chosen();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -22,6 +22,9 @@ $lang->doclib->product = $lang->productCommon . ' Bibliothek';
|
||||
$lang->doclib->apiLibName = 'Api Library Name';
|
||||
$lang->doclib->privateACL = "Private <span class='acl-tip'>(Only creators and whitelisted users with %s permissions can access it)</span>";
|
||||
|
||||
$lang->doclib->tip = new stdclass();
|
||||
$lang->doclib->tip->selectExecution = "When execution is empty, the library created is the {$lang->projectCommon} library";
|
||||
|
||||
$lang->doclib->type['wiki'] = 'WIKI';
|
||||
$lang->doclib->type['api'] = 'API';
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ $lang->doclib->product = $lang->productCommon . ' Library';
|
||||
$lang->doclib->apiLibName = 'Api Library Name';
|
||||
$lang->doclib->privateACL = "Private <span class='acl-tip'>(Only creators and whitelisted users with %s permissions can access it)</span>";
|
||||
|
||||
$lang->doclib->tip = new stdclass();
|
||||
$lang->doclib->tip->selectExecution = "When execution is empty, the library created is the {$lang->projectCommon} library";
|
||||
|
||||
$lang->doclib->type['wiki'] = 'WIKI';
|
||||
$lang->doclib->type['api'] = 'API';
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ $lang->doclib->product = $lang->productCommon . ' Library';
|
||||
$lang->doclib->apiLibName = 'Api Library Name';
|
||||
$lang->doclib->privateACL = "Private <span class='acl-tip'>(Only creators and whitelisted users with %s permissions can access it)</span>";
|
||||
|
||||
$lang->doclib->tip = new stdclass();
|
||||
$lang->doclib->tip->selectExecution = "When execution is empty, the library created is the {$lang->projectCommon} library";
|
||||
|
||||
$lang->doclib->type['wiki'] = 'WIKI';
|
||||
$lang->doclib->type['api'] = 'API';
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ $lang->doclib->product = $lang->productCommon . '库';
|
||||
$lang->doclib->apiLibName = '接口库名称';
|
||||
$lang->doclib->privateACL = "私有 <span class='acl-tip'>(仅创建者和有%s权限的白名单用户可访问)</span>";
|
||||
|
||||
$lang->doclib->tip = new stdclass();
|
||||
$lang->doclib->tip->selectExecution = "执行为空时,创建的库为{$lang->projectCommon}库";
|
||||
|
||||
$lang->doclib->type['wiki'] = 'WIKI文档库';
|
||||
$lang->doclib->type['api'] = '接口库';
|
||||
|
||||
|
||||
@@ -1118,7 +1118,7 @@ class docModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
if($object->project and $object->acl == 'private')
|
||||
if($object->type == 'project' and $object->acl == 'default')
|
||||
{
|
||||
$stakeHolders = array();
|
||||
$project = $this->loadModel('project')->getById($object->project);
|
||||
@@ -1137,7 +1137,7 @@ class docModel extends model
|
||||
if(isset($extraDocLibs[$object->id])) return true;
|
||||
}
|
||||
|
||||
if($object->acl == 'default' and (!empty($object->product) or !empty($object->execution)))
|
||||
if($object->acl == 'default' and (in_array($object->type, array('product', 'execution'))))
|
||||
{
|
||||
$acls = $this->app->user->rights['acls'];
|
||||
if(!empty($object->product) and !empty($acls['products']) and !in_array($object->product, $acls['products'])) return false;
|
||||
@@ -1464,7 +1464,7 @@ class docModel extends model
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->andWhere($type)->eq($objectID)
|
||||
->beginIF(!empty($executionIDList))->orWhere('execution')->in($executionIDList)->fi()
|
||||
->beginIF(!empty($executionIDList))->orWhere('execution')->in(array_keys($executionIDList))->fi()
|
||||
->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi()
|
||||
->orderBy('`order` asc, id_asc')
|
||||
->fetchAll('id');
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
<th><?php echo $lang->doc->{$type}?></th>
|
||||
<td class='required'><?php echo html::select($type, $objects, $objectID, "class='form-control chosen' data-drop_direction='down'")?></td>
|
||||
</tr>
|
||||
<?php if($type == 'project'):?>
|
||||
<tr class='executionBox'>
|
||||
<th><?php echo $lang->doc->execution?></th>
|
||||
<td><?php echo html::select('execution', $executionPairs, 0, "class='form-control chosen' data-drop_direction='down' data-placeholder='{$lang->doclib->tip->selectExecution}'")?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->doc->libType;?></th>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user