* Code for task#47988.

This commit is contained in:
xieqiyu
2022-01-24 23:12:40 +08:00
parent c1faac726f
commit 053985fb05
5 changed files with 82 additions and 12 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ $config->kanban->editor->viewcard = array('id' => 'comment', 'tools' => 'simp
$config->kanban->fromType = array('execution', 'productplan', 'release', 'build');
$config->kanban->executionField = array('name', 'status', 'end', 'PM', 'type', 'deleted');
$config->kanban->productplanField = array();
$config->kanban->productplanField = array('title', 'status', 'begin', 'end', 'deleted');
$config->kanban->releaseField = array('name', 'status', 'date', 'deleted');
$config->kanban->buildField = array('name', 'date', 'builder');
+6 -6
View File
@@ -102,9 +102,9 @@
.gray .actions {display:none;}
.kanban-card .header .executionName {display: flex; width: 100%; float: left; white-space: nowrap; overflow: hidden;}
.kanban-card .header .executionName .title, .releaseTitle {padding-right: 0px; margin-right: 5px; white-space: nowrap; overflow: hidden;}
.kanban-card .header .executionName .title, .releaseTitle, .productplanTitle {padding-right: 0px; margin-right: 5px; white-space: nowrap; overflow: hidden;}
.kanban-card .header .executionName > span {flex: none;}
.execInfo, .releaseInfo {margin-top: 23px;}
.execInfo, .releaseInfo, .productplanInfo {margin-top: 23px;}
.execInfo .execStatus{margin-right: 20px;}
.label-wait {background: #EFEFEF !important; color: #838A9D;}
.label-doing {background: #f8d2d2 !important; color: #e64b4c;}
@@ -112,7 +112,7 @@
.label-closed, .label-terminate {background: #e5e5e5 !important; color: #b8b8b8;}
.label-deleted {background: #ff5d5d !important; color: #fff;}
.label-normal {background: #e1e8d9 !important; color: #9abe76;}
.region .kanban-item > .kanban-card > .execInfo > .user, .region .kanban-item > .kanban-card > .releaseInfo > .user {position: absolute; right: 10px; bottom: -2px}
.region .kanban-item > .kanban-card > .execInfo > .user > .avatar, .region .kanban-item > .kanban-card > .releaseInfo > .user > .avatar {display: inline-block; width: 24px; height: 24px; line-height: 24px; margin-right: 0px; margin-left: 2px}
.kanban-card .releaseTitle .icon, .kanban-card .title .icon {padding-right: 5px;}
.kanban-card .releaseTitle {width: 100%; float: left;}
.region .kanban-item > .kanban-card > .execInfo > .user, .region .kanban-item > .kanban-card > .releaseInfo > .user, .region .kanban-item > .kanban-card > .productplanInfo > .user {position: absolute; right: 10px; bottom: -2px}
.region .kanban-item > .kanban-card > .execInfo > .user > .avatar, .region .kanban-item > .kanban-card > .releaseInfo > .user > .avatar, .region .kanban-item > .kanban-card > .productplanInfo > .user > .avatar {display: inline-block; width: 24px; height: 24px; line-height: 24px; margin-right: 0px; margin-left: 2px}
.kanban-card .releaseTitle .icon, .kanban-card .title .icon, .kanban-card .productplanTitle .icon, .kanban-card .title .icon {padding-right: 5px;}
.kanban-card .releaseTitle, .kanban-card .productplanTitle {width: 100%; float: left;}
+65
View File
@@ -288,6 +288,10 @@ function renderKanbanItem(item, $item)
{
renderBuildItem(item, $item);
}
else if(item.fromType == 'productplan')
{
renderProductplanItem(item, $item);
}
else
{
var $title = $item.children('.title');
@@ -533,6 +537,67 @@ function renderReleaseItem(item, $item)
}
}
/**
* Render product plan item.
*
* @param object item
* @param object $item
* @access public
* @return void
*/
function renderProductplanItem(item, $item)
{
var privs = item.actions;
/* Print name. */
var $title = $item.children('.productplanTitle');
if(!$title.length)
{
if(privs.includes('viewPlan') && item.deleted == '0') $title = $('<a class="productplanTitle"><i class="icon icon-run"></i>' + item.title + '</a>').appendTo($item).attr('href', createLink('productplan', 'view', 'productplanID=' + item.fromID));
if(!privs.includes('viewPlan') || item.deleted == '1') $title = $('<a class="productplanTitle"><i class="icon icon-run"></i>' + item.title + '</a>').appendTo($item);
}
$title.attr('title', item.title);
var $info = $item.children('.productplanInfo');
if(!$info.length) $info = $(
[
'<div class="productplanInfo">',
'</div>'
].join('')).appendTo($item);
var $statusBox = $info.children('.productplanStatus');
if(!$statusBox.length)
{
if(item.deleted == '0')
{
$statusBox = $('<span class="productplanStatus label label-' + item.status + '">' + productplanLang.statusList[item.status] + '</span>').appendTo($info);
}
else
{
$statusBox = $('<span class="productplanStatus label label-deleted">' + productplanLang.deleted + '</span>').appendTo($info);
}
}
/* Display product plan date. */
var $date = $info.children('.date');
var productplanDate = $.zui.createDate(item.date);
var today = new Date();
var labelType = productplanDate.toLocaleDateString() == today.toLocaleDateString() ? 'light' : 'wait';
if(!$date.length) $date = $('<span class="date label label-' + labelType + '"></span>').appendTo($info);
$date.text($.zui.formatDate(productplanDate, 'yyyy-MM-dd')).attr('title', $.zui.formatDate(productplanDate, 'yyyy-MM-dd')).show();
if(labelType == 'light') $date.css('background-color', 'rgba(210, 50, 61, 0.3)');
/* Display avatars of creator. */
var $user = $info.children('.user');
var user = [item.createdBy];
if(users[item.createdBy])
{
if(!$user.length) $user = $('<div class="user"></div>').appendTo($info);
$user.html(renderUsersAvatar(user, item.id)).attr('title', users[item.createdBy]);
}
}
/**
* Render build item.
*
+8 -5
View File
@@ -523,14 +523,17 @@ class kanbanModel extends model
$targetLaneID = $data->targetLane;
$objectCards = array();
$now = helper::now();
foreach($objectIDList as $objectID)
{
$cardData = new stdClass();
$cardData->kanban = $kanbanID;
$cardData->region = $regionID;
$cardData->group = $groupID;
$cardData->fromID = $objectID;
$cardData->fromType = $objectType;
$cardData->kanban = $kanbanID;
$cardData->region = $regionID;
$cardData->group = $groupID;
$cardData->fromID = $objectID;
$cardData->fromType = $objectType;
$cardData->createdBy = $this->app->user->account;
$cardData->createdDate = $now;
$this->dao->insert(TABLE_KANBANCARD)->data($cardData)->exec();
$cardID = $this->dao->lastInsertID();
+2
View File
@@ -16,6 +16,7 @@
<?php
$app->loadLang('execution');
$app->loadLang('release');
$app->loadLang('productplan');
$laneCount = 0;
foreach($regions as $region) $laneCount += $region->laneCount;
@@ -27,6 +28,7 @@ js::set('kanbancolumnLang', $lang->kanbancolumn);
js::set('kanbancardLang', $lang->kanbancard);
js::set('executionLang', $lang->execution);
js::set('releaseLang', $lang->release);
js::set('productplanLang', $lang->productplan);
js::set('kanbanID', $kanban->id);
js::set('laneCount', $laneCount);
js::set('userList', $userList);