Merge branch 'sprint/168' into 'sprint/168_sunhao/kanban_demo'

# Conflicts:
#   module/execution/js/kanban.js
#   module/execution/view/kanban.html.php
This commit is contained in:
孙广明
2021-10-26 07:53:38 +00:00
11 changed files with 337 additions and 56 deletions
-1
View File
@@ -75,7 +75,6 @@ $lang->file = new stdclass();
$lang->misc = new stdclass();
$lang->acl = new stdclass();
$lang->curd = new stdclass();
$lang->kanban = new stdclass();
$lang->projectbuild = new stdclass();
$lang->projectrelease = new stdclass();
+5 -13
View File
@@ -1841,24 +1841,21 @@ class execution extends control
if(strpos($this->server->http_user_agent, 'MSIE 8.0') !== false) header("X-UA-Compatible: IE=EmulateIE7");
$kanban = $this->loadModel('kanban')->getExecutionKanban($executionID);
if(empty($kanban)) $this->kanban->createLanes($executionID);
if(empty($kanban))
{
$this->kanban->createLanes($executionID);
$kanban = $this->kanban->getExecutionKanban($executionID);
}
$this->execution->setMenu($executionID);
$execution = $this->loadModel('execution')->getById($executionID);
$tasks = $this->execution->getKanbanTasks($executionID, "id");
$bugs = $this->loadModel('bug')->getExecutionBugs($executionID);
$stories = $this->loadModel('story')->getExecutionStories($executionID);
/* Determines whether an object is editable. */
$canBeChanged = common::canModify('execution', $execution);
$kanbanGroup = $this->execution->getKanbanGroupData($stories, $tasks, $bugs, $type);
$kanbanSetting = $this->execution->getKanbanSetting();
$this->view->title = $this->lang->execution->kanban;
$this->view->position[] = html::a($this->createLink('execution', 'browse', "executionID=$executionID"), $execution->name);
$this->view->position[] = $this->lang->execution->kanban;
$this->view->stories = $stories;
$this->view->realnames = $this->loadModel('user')->getPairs('noletter');
$this->view->storyOrder = $orderBy;
$this->view->orderBy = 'id_asc';
@@ -1866,11 +1863,6 @@ class execution extends control
$this->view->browseType = '';
$this->view->execution = $execution;
$this->view->type = $type;
$this->view->kanbanGroup = $kanbanGroup;
$this->view->kanbanColumns = $this->execution->getKanbanColumns($kanbanSetting);
$this->view->statusMap = $canBeChanged ? $this->execution->getKanbanStatusMap($kanbanSetting) : array();
$this->view->statusList = $this->execution->getKanbanStatusList($kanbanSetting);
$this->view->colorList = $this->execution->getKanbanColorList($kanbanSetting);
$this->view->canBeChanged = $canBeChanged;
$this->display();
+2 -15
View File
@@ -490,7 +490,7 @@ addColumnRenderer('task', renderTaskItem);
*/
function renderColumnCount($count, count, col)
{
var text = count + '/' + (col.maxCount || '<i class="icon icon-infinite"></i>');
var text = count + '/' + (!col.maxCount ? '<i class="icon icon-infinite"></i>' : '');
$count.html(text + '<i class="icon icon-arrow-up"></i>');
}
@@ -524,19 +524,6 @@ function createKanban(kanbanID, data, options)
$kanban.kanban($.extend({data: data}, options));
}
$.extend($.fn.kanban.Constructor.DEFAULTS,
{
onRender: function()
{
var maxWidth = 0;
$('#kanbans .kanban-board').each(function()
{
maxWidth = Math.max(maxWidth, $(this).outerWidth());
});
$('#kanbanContainer').css('min-width', maxWidth + 40);
}
});
/* Example code: */
$(function()
{
@@ -545,7 +532,7 @@ $(function()
{
maxColHeight: 'auto',
minColWidth: 240,
droppable: true,
dropable: true,
showCount: true,
showZeroCount: true,
countRender: renderColumnCount
+5 -3
View File
@@ -48,12 +48,14 @@
</div>
</div>
<div class='panel' id='kanbanContainer'>
<div class='panel'>
<div class='panel-heading'>
<strong>Section</strong>
</div>
<div id='kanbans' class='panel-body'></div>
<div class='panel-body'>
<div id='kanbans'></div>
</div>
</div>
<?php js::set('executionID', $executionID);?>
<?php js::set('statusMap', $statusMap);?>
<?php //js::set('statusMap', $statusMap);?>
<?php include '../../common/view/footer.html.php';?>
+47
View File
@@ -2,6 +2,9 @@
global $lang;
$config->kanban = new stdclass();
$config->kanban->setwip = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->default = new stdclass();
$config->kanban->default->story = new stdclass();
$config->kanban->default->story->name = $lang->SRCommon;
@@ -17,3 +20,47 @@ $config->kanban->default->task = new stdclass();
$config->kanban->default->task->name = $lang->task->common;
$config->kanban->default->task->color = '#4169e1';
$config->kanban->default->task->order = '15';
$config->kanban->parentColumn = array();
$config->kanban->parentColumn['story'] = array('develop', 'test');
$config->kanban->parentColumn['bug'] = array('resolving', 'test');
$config->kanban->parentColumn['task'] = array('develop');
$config->kanban->storyColumnStageList = array();
$config->kanban->storyColumnStageList['backlog'] = 'projected';
$config->kanban->storyColumnStageList['ready'] = 'projected';
$config->kanban->storyColumnStageList['developing'] = 'developing';
$config->kanban->storyColumnStageList['developed'] = 'developed';
$config->kanban->storyColumnStageList['testing'] = 'testing';
$config->kanban->storyColumnStageList['tested'] = 'tested';
$config->kanban->storyColumnStageList['verified'] = 'verified';
$config->kanban->storyColumnStageList['released'] = 'released';
$config->kanban->storyColumnStageList['closed'] = 'closed';
$config->kanban->storyColumnStatusList = array();
$config->kanban->storyColumnStatusList['backlog'] = 'active';
$config->kanban->storyColumnStatusList['ready'] = 'active';
$config->kanban->storyColumnStatusList['developing'] = 'active';
$config->kanban->storyColumnStatusList['developed'] = 'active';
$config->kanban->storyColumnStatusList['testing'] = 'active';
$config->kanban->storyColumnStatusList['tested'] = 'active';
$config->kanban->storyColumnStatusList['verified'] = 'active';
$config->kanban->storyColumnStatusList['released'] = 'active';
$config->kanban->storyColumnStatusList['closed'] = 'closed';
$config->kanban->bugColumnStatusList = array();
$config->kanban->bugColumnStatusList['unconfirmed'] = 'active';
$config->kanban->bugColumnStatusList['confirmed'] = 'active';
$config->kanban->bugColumnStatusList['fixing'] = 'active';
$config->kanban->bugColumnStatusList['fixed'] = 'resolved';
$config->kanban->bugColumnStatusList['testing'] = 'resolved';
$config->kanban->bugColumnStatusList['tested'] = 'resolved';
$config->kanban->bugColumnStatusList['closed'] = 'closed';
$config->kanban->taskColumnStatusList = array();
$config->kanban->taskColumnStatusList['wait'] = 'wait';
$config->kanban->taskColumnStatusList['developing'] = 'doing';
$config->kanban->taskColumnStatusList['developed'] = 'done';
$config->kanban->taskColumnStatusList['pause'] = 'pause';
$config->kanban->taskColumnStatusList['canceled'] = 'cancel';
$config->kanban->taskColumnStatusList['closed'] = 'closed';
+46
View File
@@ -0,0 +1,46 @@
<?php
/**
* The control file of kanban module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yuchun Li <liyuchun@easycorp.ltd>
* @package kanban
* @version $Id: control.php 4460 2021-10-26 11:03:02Z chencongzhi520@gmail.com $
* @link https://www.zentao.net
*/
class kanban extends control
{
/**
* Set WIP.
*
* @param int $columnID
* @param int $executionID
* @access public
* @return void
*/
public function setWIP($columnID, $executionID = 0)
{
if($_POST)
{
$this->kanban->setWIP($columnID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('wip', $columnID, 'Edited');
die(js::reload('parent.parent'));
}
$this->app->loadLang('story');
$column = $this->kanban->getColumnById($columnID);
if(!$column) die(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
$status = zget($this->config->kanban->{$column->laneType . 'ColumnStatusList'}, $column->type);
$title = isset($column->parentName) ? $column->parentName . '/' . $column->name : $column->name;
$this->view->title = $title . $this->lang->colon . $this->lang->kanban->setWIP . '(' . $this->lang->kanban->WIP . ')';
$this->view->column = $column;
$this->view->status = $status;
$this->display();
}
}
+28
View File
@@ -0,0 +1,28 @@
$(function()
{
$('#noLimit').click(function()
{
if($(this).attr('checked') == 'checked')
{
$('#WIPCount').attr('disabled', true);
}
else
{
$('#WIPCount').removeAttr('disabled');
}
})
})
/**
* Set WIP count.
*
* @access public
* @return void
*/
function setWIPLimit()
{
var count = $('#WIPCount').val();
if($('#noLimit').attr('checked') == 'checked') count = -1;;
$('#limit').val(count);
}
+35
View File
@@ -0,0 +1,35 @@
<?php
$lang->kanban = new stdClass();
$lang->kanban->storyColumn = array();
$lang->kanban->storyColumn['backlog'] = 'Backlog';
$lang->kanban->storyColumn['ready'] = 'Ready';
$lang->kanban->storyColumn['develop'] = 'Development';
$lang->kanban->storyColumn['developing'] = 'Doing';
$lang->kanban->storyColumn['developed'] = 'Done';
$lang->kanban->storyColumn['test'] = 'Testing';
$lang->kanban->storyColumn['testing'] = 'Doing';
$lang->kanban->storyColumn['tested'] = 'Done';
$lang->kanban->storyColumn['verified'] = 'Verified';
$lang->kanban->storyColumn['released'] = 'Released';
$lang->kanban->storyColumn['closed'] = 'Closed';
$lang->kanban->bugColumn = array();
$lang->kanban->bugColumn['unconfirmed'] = 'Unconfirmed';
$lang->kanban->bugColumn['confirmed'] = 'Confirmed';
$lang->kanban->bugColumn['resolving'] = 'Resolving';
$lang->kanban->bugColumn['fixing'] = 'Doing';
$lang->kanban->bugColumn['fixed'] = 'Done';
$lang->kanban->bugColumn['test'] = 'Test';
$lang->kanban->bugColumn['testing'] = 'Doing';
$lang->kanban->bugColumn['tested'] = 'Done';
$lang->kanban->bugColumn['closed'] = 'Closed';
$lang->kanban->taskColumn = array();
$lang->kanban->taskColumn['wait'] = 'Wait';
$lang->kanban->taskColumn['develop'] = 'Develop';
$lang->kanban->taskColumn['developing'] = 'Developing';
$lang->kanban->taskColumn['developed'] = 'Developed';
$lang->kanban->taskColumn['pause'] = 'Pause';
$lang->kanban->taskColumn['canceled'] = 'Canceled';
$lang->kanban->taskColumn['closed'] = 'Closed';
+7
View File
@@ -1,6 +1,13 @@
<?php
$lang->kanban = new stdClass();
$lang->kanban->WIP = 'WIP';
$lang->kanban->setWIP = '在制品设置';
$lang->kanban->WIPStatus = '在制品状态';
$lang->kanban->WIPStage = '在制品阶段';
$lang->kanban->WIPCount = '在制品数量';
$lang->kanban->noLimit = '不限制∞';
$lang->kanban->storyColumn = array();
$lang->kanban->storyColumn['backlog'] = 'Backlog';
$lang->kanban->storyColumn['ready'] = '准备好';
+93 -24
View File
@@ -35,10 +35,22 @@ class kanbanModel extends model
->andWhere('lane')->in(array_keys($lanes))
->fetchGroup('lane', 'id');
if($objectType == 'story' or $objectType == 'all') $stories = $this->loadModel('story')->getExecutionStories($executionID);
if($objectType == 'bug' or $objectType == 'all') $bugs = $this->loadModel('bug')->getExecutionBugs($executionID);
if($objectType == 'task' or $objectType == 'all') $tasks = $this->loadModel('execution')->getKanbanTasks($executionID, "id");
foreach($columns as $laneID => $cols)
{
$laneType = $lanes[$laneID]->type;
foreach($cols as $colID => $col)
{
$cardIdList = array_filter(explode(',', $col->cards));
$col->cards = array();
foreach($cardIdList as $objectID)
{
if($laneType == 'story') $col->cards[$objectID] = zget($stories, $objectID, '');
if($laneType == 'bug') $col->cards[$objectID] = zget($bugs, $objectID, '');
if($laneType == 'task') $col->cards[$objectID] = zget($tasks, $objectID, '');
}
if($col->parent > 0)
{
$cols[$col->parent]->childs[$colID] = $col;
@@ -47,8 +59,14 @@ class kanbanModel extends model
}
}
foreach($lanes as $laneID => $lane) $lane->columns = $columns[$laneID];
return $lanes;
$kanban = array();
foreach($lanes as $laneID => $lane)
{
$lane->columns = $columns[$laneID];
$kanban[$lane->type] = $lane;
}
return $kanban;
}
/**
@@ -97,17 +115,16 @@ class kanbanModel extends model
$data->name = $name;
$data->type = $colType;
$data->cards = '';
if(strpos(',developing,developed,', $colType) !== false) $data->parent = $devColumnID;
if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID;
if(strpos(',ready,develop,test,', $colType) === false)
{
$storyStatus = $this->config->kanban->storyColumnStatusList[$colType];
$storyStage = $this->config->kanban->storyColumnStageList[$colType];
foreach($objects as $storyID => $story)
{
if($colType == 'backlog' and $story->status == 'active' and $story->stage == 'projected') $data->cards .= $storyID . ',';
if($colType == 'closed' and $story->status == 'closed' and $story->stage == 'closed') $data->cards .= $storyID . ',';
if($story->stage == $colType and strpos(',backlog,closed,', $colType) === false and $story->status == 'active') $data->cards .= $storyID . ',';
if($story->status == $storyStatus and $story->stage == $storyStage) $data->cards .= $storyID . ',';
}
if(!empty($data->cards)) $data->cards = ',' . $data->cards;
}
@@ -130,20 +147,27 @@ class kanbanModel extends model
if(strpos(',testing,tested,', $colType) !== false) $data->parent = $testColumnID;
if(strpos(',resolving,fixing,test,testing,tested,', $colType) === false)
{
$bugStatus = $this->config->kanban->bugColumnStatusList[$colType];
foreach($objects as $bugID => $bug)
{
if($colType == 'unconfirmed' and $bug->status == 'active' and $bug->confirmed == 0) $data->cards .= $bugID . ',';
if($colType == 'confirmed' and $bug->status == 'active' and $bug->confirmed == 1) $data->cards .= $bugID . ',';
if($colType == 'fixed' and $bug->status == 'resolved') $data->cards .= $bugID . ',';
if($colType == 'closed' and $bug->status == 'closed') $data->cards .= $bugID . ',';
if($colType == 'unconfirmed' and $bug->status == $bugStatus and $bug->confirmed == 0)
{
$data->cards .= $bugID . ',';
}
elseif($colType == 'confirmed' and $bug->status == $bugStatus and $bug->confirmed == 1)
{
$data->cards .= $bugID . ',';
}
elseif($bug->status == $bugStatus)
{
$data->cards .= $bugID . ',';
}
}
$this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec();
if($colType == 'resolving') $resolvingColumnID = $this->dao->lastInsertId();
if($colType == 'test') $testColumnID = $this->dao->lastInsertId();
if(!empty($data->cards)) $data->cards = ',' . $data->cards;
}
$this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec();
if($colType == 'resolving') $resolvingColumnID = $this->dao->lastInsertId();
if($colType == 'test') $testColumnID = $this->dao->lastInsertId();
}
}
elseif($type == 'task')
@@ -158,18 +182,16 @@ class kanbanModel extends model
if(strpos(',developing,developed,', $colType) !== false) $data->parent = $devColumnID;
if(strpos(',develop,', $colType) === false)
{
$taskStatus = $this->config->kanban->taskColumnStatusList[$colType];
foreach($objects as $taskID => $task)
{
if($colType == 'developing' and $task->status == 'doing') $data->cards .= $taskID . ',';
if($task->status == $taskStatus) $data->cards .= $taskID . ',';
if($colType == 'developed' and $task->status == 'done') $data->cards .= $taskID . ',';
if(strpos(',wait,pause,canceled,closed,', $colType) !== false and $task->status == $colType) $data->cards .= $taskID . ',';
}
$this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec();
if($colType == 'develop') $devColumnID = $this->dao->lastInsertId();
if(!empty($data->cards)) $data->cards = ',' . $data->cards;
}
$this->dao->insert(TABLE_KANBANCOLUMN)->data($data)->exec();
if($colType == 'develop') $devColumnID = $this->dao->lastInsertId();
}
}
}
@@ -265,4 +287,51 @@ class kanbanModel extends model
}
}
}
/**
* Get column by id.
*
* @param int $columnID
* @access public
* @return object
*/
public function getColumnById($columnID)
{
$column = $this->dao->select('t1.*, t2.type as laneType')->from(TABLE_KANBANCOLUMN)->alias('t1')
->leftjoin(TABLE_KANBANLANE)->alias('t2')->on('t1.lane=t2.id')
->where('t1.id')->eq($columnID)
->andWhere('t1.deleted')->eq(0)
->fetch();
if(!empty($column->parent)) $column->parentName = $this->dao->findById($column->parent)->from(TABLE_KANBANCOLUMN)->fetch('name');
return $column;
}
/**
* Set WIP limit.
*
* @param int $columnID
* @access public
* @return bool
*/
public function setWIP($columnID)
{
$column = $this->getColumnById($columnID);
$data = fixer::input('post')
->remove('WIPCount,noLimit')
->get();
$this->lang->kanbancolumn = new stdclass();
$this->lang->kanbancolumn->limit = $this->lang->kanban->WIPCount;
$this->dao->update(TABLE_KANBANCOLUMN)->data($data)
->autoCheck()
->check(is_numeric($data->limit), 'limit', 'gt', 0)
->batchcheck($this->config->kanban->setwip->requiredFields, 'notempty')
->where('id')->eq($columnID)
->exec();
return dao::isError();
}
}
+69
View File
@@ -0,0 +1,69 @@
<?php
/**
* The set WIP file of task module of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Yuchun Li <liyuchun@easycorp.ltd>
* @package kanban
* @version $Id: setwip.html.php 935 2021-10-25 10:56:24Z liyuchun@easycorp.ltd $
* @link https://www.zentao.net
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2>
<?php echo "<span title='$title'>" . $title . '</span>';?>
</h2>
</div>
<form method='post' target='hiddenwin' onsubmit='return setWIPLimit();'>
<table align='center' class='table table-form'>
<?php if(!in_array($column->type, $config->kanban->parentColumn[$column->laneType])):?>
<tr>
<th><?php echo $lang->kanban->WIPStatus;?></th>
<td colspan='2'>
<?php echo html::input('WIPStatus', zget($lang->kanban->{$column->laneType . 'Column'}, $column->type, ''), "class='form-control' disabled");?>
</td>
<td></td>
</tr>
<?php if($column->laneType == 'story'):?>
<tr>
<th><?php echo $lang->kanban->WIPStage;?></th>
<td colspan='2'>
<?php $stage = zget($config->kanban->storyColumnStageList, $column->type);?>
<?php echo html::input('WIPStage', zget($lang->story->stageList, $stage), "class='form-control' disabled");?>
</td>
</tr>
<?php endif;?>
<?php endif;?>
<tr>
<th><?php echo $lang->kanban->WIPCount;?></th>
<td colspan='2'>
<?php echo html::hidden('limit', $column->limit, "class='form-control'");?>
<div class="table-col">
<?php $attr = $column->limit == -1 ? 'disabled' : '';?>
<?php echo html::input('WIPCount', $column->limit != -1 ? $column->limit : '', "class='form-control' $attr");?>
</div>
<div class="table-col w-50px">
<span class="input-group-addon" style="border: 1px solid #dcdcdc; border-left-width: 0px;">
<div class='checkbox-primary'>
<input id='noLimit' name='noLimit' value='-1' type='checkbox' class='no-margin' <?php echo $column->limit == -1 ? 'checked' : '';?>/>
<label for='needNotReview'><?php echo $lang->kanban->noLimit;?></label>
</div>
</span>
</div>
</td>
</tr>
<tr>
<td colspan='3' class='text-center form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>