* Code for task #43519.

This commit is contained in:
liyuchun
2021-10-26 14:38:00 +08:00
parent ff8f020485
commit 0dc857f2bb
6 changed files with 244 additions and 0 deletions
+49
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,49 @@ $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->storyColumnStageList = array();
$config->kanban->storyColumnStageList['backlog'] = 'projected';
$config->kanban->storyColumnStageList['ready'] = 'projected';
$config->kanban->storyColumnStageList['develop'] = 'developing';
$config->kanban->storyColumnStageList['developing'] = 'developing';
$config->kanban->storyColumnStageList['developed'] = 'developed';
$config->kanban->storyColumnStageList['test'] = 'testing';
$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['develop'] = 'active';
$config->kanban->storyColumnStatusList['developing'] = 'active';
$config->kanban->storyColumnStatusList['developed'] = 'active';
$config->kanban->storyColumnStatusList['test'] = '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['resolving'] = 'active';
$config->kanban->bugColumnStatusList['fixing'] = 'active';
$config->kanban->bugColumnStatusList['fixed'] = 'resolved';
$config->kanban->bugColumnStatusList['test'] = '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['develop'] = '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);
}
+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'] = '准备好';
+47
View File
@@ -265,4 +265,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();
}
}
+67
View File
@@ -0,0 +1,67 @@
<?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'>
<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;?>
<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';?>