Merge branch 'sprint/168_liyuchun_43503' into 'sprint/168'

Sprint/168 liyuchun 43503

See merge request easycorp/zentaopms!171
This commit is contained in:
孙广明
2021-10-27 02:46:22 +00:00
8 changed files with 183 additions and 8 deletions

View File

@@ -2,8 +2,10 @@
global $lang;
$config->kanban = new stdclass();
$config->kanban->setwip = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->setwip = new stdclass();
$config->kanban->setlane = new stdclass();
$config->kanban->setwip->requiredFields = 'limit';
$config->kanban->setlane->requiredFields = 'name,type';
$config->kanban->default = new stdclass();
$config->kanban->default->story = new stdclass();
@@ -64,3 +66,5 @@ $config->kanban->taskColumnStatusList['developed'] = 'done';
$config->kanban->taskColumnStatusList['pause'] = 'pause';
$config->kanban->taskColumnStatusList['canceled'] = 'cancel';
$config->kanban->taskColumnStatusList['closed'] = 'closed';
$config->kanban->laneColorList = array('#7ec5ff', '#333', '#2b529c', '#e48600', '#d2323d', '#229f24', '#777', '#d2691e', '#008b8b', '#2e8b57', '#4169e1', '#4b0082', '#fa8072', '#ba55d3', '#2e8b57', '#6b8e23');

View File

@@ -27,7 +27,7 @@ class kanban extends control
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('wip', $columnID, 'Edited');
die(js::reload('parent.parent'));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$this->app->loadLang('story');
@@ -43,4 +43,33 @@ class kanban extends control
$this->view->status = $status;
$this->display();
}
/**
* Set lane info.
*
* @param int $laneID
* @param int $executionID
* @access public
* @return void
*/
public function setLane($laneID, $executionID = 0)
{
if($_POST)
{
$this->kanban->setLane($laneID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('lane', $laneID, 'Edited');
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$lane = $this->kanban->getLaneById($laneID);
if(!$lane) die(js::error($this->lang->notFound) . js::locate($this->createLink('execution', 'kanban', "executionID=$executionID")));
$this->view->title = zget($this->lang->kanban->laneTypeList, $lane->type) . $this->lang->colon . $this->lang->kanban->setLane;
$this->view->lane = $lane;
$this->display();
}
}

View File

@@ -0,0 +1,4 @@
td>ul {padding-left: 0;}
li {display: block; float: left; padding: 5px; width: 28px; height: 28px;}
li>a { position: relative; display: block; width: 100%; height: 100%; padding: 0; margin: 0; font-family: ZentaoIcon; font-size: 14px; font-style: normal; font-weight: 400; font-variant: normal; line-height: 1; text-align: center; text-transform: none; border: 1px solid transparent; border-radius: 50%; speak: none; -webkit-font-smoothing: antialiased; }
li>a.active:before {font-size: 14px; content: "\e5ca"}

View File

@@ -0,0 +1,13 @@
/**
* Set lane color.
*
* @param string $color
* @access public
* @return void
*/
function setColor(color)
{
$('.cp-tile').removeClass('active');
$('.cp-tile[data-color="' + color + '"]').addClass('active');
$('#color').val(color);
}

View File

@@ -1,6 +1,22 @@
<?php
$lang->kanban = new stdClass();
$lang->kanban->WIP = 'WIP';
$lang->kanban->setWIP = 'WIP Settings';
$lang->kanban->WIPStatus = 'WIP Status';
$lang->kanban->WIPStage = 'WIP Stage';
$lang->kanban->WIPType = 'WIP Type';
$lang->kanban->WIPCount = 'WIP Count';
$lang->kanban->noLimit = 'No Limit ∞';
$lang->kanban->setLane = 'Lane Settings';
$lang->kanban->laneName = 'Lane Name';
$lang->kanban->laneColor = 'Lane Color';
$this->lang->kanban->laneTypeList = array();
$this->lang->kanban->laneTypeList['story'] = $lang->SRCommon;
$this->lang->kanban->laneTypeList['bug'] = 'Bug';
$this->lang->kanban->laneTypeList['task'] = 'Task';
$lang->kanban->storyColumn = array();
$lang->kanban->storyColumn['backlog'] = 'Backlog';
$lang->kanban->storyColumn['ready'] = 'Ready';
@@ -33,3 +49,9 @@ $lang->kanban->taskColumn['developed'] = 'Developed';
$lang->kanban->taskColumn['pause'] = 'Pause';
$lang->kanban->taskColumn['canceled'] = 'Canceled';
$lang->kanban->taskColumn['closed'] = 'Closed';
$lang->kanbancolumn = new stdclass();
$lang->kanbancolumn->limit = $lang->kanban->WIPCount;
$lang->kanbanlane = new stdclass();
$lang->kanbanlane->name = $lang->kanban->laneName;

View File

@@ -5,8 +5,17 @@ $lang->kanban->WIP = 'WIP';
$lang->kanban->setWIP = '在制品设置';
$lang->kanban->WIPStatus = '在制品状态';
$lang->kanban->WIPStage = '在制品阶段';
$lang->kanban->WIPType = '在制品类型';
$lang->kanban->WIPCount = '在制品数量';
$lang->kanban->noLimit = '不限制∞';
$lang->kanban->setLane = '泳道设置';
$lang->kanban->laneName = '泳道名称';
$lang->kanban->laneColor = '泳道颜色';
$this->lang->kanban->laneTypeList = array();
$this->lang->kanban->laneTypeList['story'] = $lang->SRCommon;
$this->lang->kanban->laneTypeList['bug'] = 'Bug';
$this->lang->kanban->laneTypeList['task'] = '任务';
$lang->kanban->storyColumn = array();
$lang->kanban->storyColumn['backlog'] = 'Backlog';
@@ -40,3 +49,9 @@ $lang->kanban->taskColumn['developed'] = '研发完毕';
$lang->kanban->taskColumn['pause'] = '已暂停';
$lang->kanban->taskColumn['canceled'] = '已取消';
$lang->kanban->taskColumn['closed'] = '已关闭';
$lang->kanbancolumn = new stdclass();
$lang->kanbancolumn->limit = $lang->kanban->WIPCount;
$lang->kanbanlane = new stdclass();
$lang->kanbanlane->name = $lang->kanban->laneName;

View File

@@ -60,7 +60,7 @@ class kanbanModel extends model
}
$kanban = array();
foreach($lanes as $laneID => $lane)
foreach($lanes as $laneID => $lane)
{
$lane->columns = $columns[$laneID];
$kanban[$lane->type] = $lane;
@@ -308,6 +308,18 @@ class kanbanModel extends model
return $column;
}
/**
* Get lane by id.
*
* @param int $laneID
* @access public
* @return object
*/
public function getLaneById($laneID)
{
return $this->dao->findById($laneID)->from(TABLE_KANBANLANE)->fetch();
}
/**
* Set WIP limit.
*
@@ -319,19 +331,37 @@ class kanbanModel extends model
{
$column = $this->getColumnById($columnID);
$data = fixer::input('post')
->cleanInt('limit')
->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)
->check('limit', 'gt', 0)
->batchcheck($this->config->kanban->setwip->requiredFields, 'notempty')
->where('id')->eq($columnID)
->exec();
return dao::isError();
}
/**
* Set lane info.
*
* @param int $laneID
* @access public
* @return bool
*/
public function setLane($laneID)
{
$lane = fixer::input('post')->get();
$this->dao->update(TABLE_KANBANLANE)->data($lane)
->autoCheck()
->batchcheck($this->config->kanban->setlane->requiredFields, 'notempty')
->where('id')->eq($laneID)
->exec();
return dao::isError();
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* The set lane 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: setlane.html.php 935 2021-10-26 16:24: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 class="load-indicator main-form form-ajax" method='post' target='hiddenwin'>
<table align='center' class='table table-form'>
<tr>
<th><?php echo $lang->kanban->laneName;?></th>
<td colspan='2'>
<?php echo html::input('name', $lane->name, "class='form-control'");?>
</td>
<td></td>
</tr>
<tr>
<th><?php echo $lang->kanban->WIPType;?></th>
<td colspan='2'>
<?php echo html::input('type', zget($lang->kanban->laneTypeList, $lane->type), "class='form-control' disabled");?>
</td>
</tr>
<tr>
<th><?php echo $lang->kanban->laneColor;?></th>
<td colspan='3'>
<?php echo html::hidden('color', $lane->color, "class='form-control'");?>
<ul>
<?php foreach($config->kanban->laneColorList as $color):?>
<li>
<a href='javascript:setColor("<?php echo $color;?>");' class='cp-tile <?php echo $color == $lane->color ? 'active' : '';?>' data-color='<?php echo $color;?>' style='color: #FFF; background: <?php echo $color;?>; border-color: transparent;'></a>
</li>
<?php endforeach;?>
</ul>
</td>
</tr>
<tr>
<td colspan='4' class='text-center form-actions'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>