Merge branch 'master' of https://gitlab.zcorp.cc/easycorp/zentaopms into dht_unittest

This commit is contained in:
denghongtao
2022-09-02 05:07:28 +00:00
17 changed files with 254 additions and 147 deletions
+9
View File
@@ -1,6 +1,7 @@
stages:
- sonar
- unit_test
- uitest
- cleanup_packages
- package
sonarqube:
@@ -32,6 +33,14 @@ unit_test:
only:
- master
- merge_requests
uitest:
stage: uitest
script:
- "/home/gitlab-runner/bin/zentao-uitest.sh ${CI_PROJECT_DIR}"
allow_failure: true
only:
- master
- merge_requests
#notify:
# script:
# - 'curl --location --request POST ''http://api.lf.oop.cc/api/v1/xuan/chatMessage'' --header ''Content-Type: application/json'' --data-raw ''{"gid": "84be4c6e-02e3-4fdc-b081-318c0c1eca02", "title": "开源包下载地址", "content": "点击查看详情链接", "url": "http://10.0.7.242:8080/allpacks/"}'''
+1
View File
@@ -20,6 +20,7 @@ $filter->default->paramName = 'reg::paramName';
$filter->default->paramValue = 'reg::paramValue';
$filter->default->get['onlybody'] = 'equal::yes';
$filter->default->get['_single'] = 'equal::1';
$filter->default->get['tid'] = 'reg::word';
$filter->default->get['HTTP_X_REQUESTED_WITH'] = 'equal::XMLHttpRequest';
+2
View File
@@ -11,3 +11,5 @@ CREATE TABLE `zt_taskteam` (
PRIMARY KEY (`id`),
KEY `task` (`task`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `zt_taskestimate` ADD `order` tinyint unsigned NULL DEFAULT '0';
ALTER TABLE `zt_effort` ADD `order` tinyint unsigned NOT NULL DEFAULT '0' AFTER `end`;
+2
View File
@@ -1594,6 +1594,7 @@ CREATE TABLE IF NOT EXISTS `zt_taskestimate` (
`consumed` float unsigned NOT NULL,
`account` char(30) NOT NULL default '',
`work` text,
`order` tinyint(3) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
KEY `task` (`task`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -6534,6 +6535,7 @@ ALTER TABLE `zt_effort` ADD `consumed` float NOT NULL AFTER `left`;
ALTER TABLE `zt_effort` CHANGE `begin` `begin` smallint(4) unsigned zerofill NOT NULL AFTER `consumed`;
ALTER TABLE `zt_effort` CHANGE `end` `end` smallint(4) unsigned zerofill NOT NULL AFTER `begin`;
ALTER TABLE `zt_effort` ADD `deleted` enum('0','1') NOT NULL DEFAULT '0' AFTER `end`;
ALTER TABLE `zt_effort` ADD `order` tinyint unsigned NOT NULL DEFAULT '0' AFTER `end`;
ALTER TABLE `zt_effort` ADD INDEX `execution` (`execution`);
ALTER TABLE `zt_effort` ADD INDEX `objectID` (`objectID`);
ALTER TABLE `zt_effort` ADD INDEX `date` (`date`);
+4 -5
View File
@@ -35,6 +35,10 @@ class api extends control
*/
public function index($libID = 0, $moduleID = 0, $apiID = 0, $version = 0, $release = 0, $appendLib = 0, $browseType = '', $param = 0)
{
/* Get all api doc libraries. */
$libs = $this->doc->getApiLibs($appendLib);
if($libID == 0 and !empty($libs)) $libID = key($libs);
/* Get an api doc. */
if($apiID > 0)
{
@@ -61,11 +65,6 @@ class api extends control
$this->view->typeList = $this->api->getTypeList($libID);
}
/* Get all api doc libraries. */
$libs = $this->doc->getApiLibs($appendLib);
if($libID == 0 and $apiID > 0) $libID = $api->lib;
if($libID == 0 and !empty($libs)) $libID = key($libs);
$lib = $this->doc->getLibById($libID);
$appendLib = (!empty($lib) and $lib->deleted == '1') ? $libID : 0;
+25 -21
View File
@@ -388,17 +388,15 @@ class kanban extends control
/**
* View a kanban.
*
* @param int $kanbanID
* @param int|string $regionID
* @param int $kanbanID
* @access public
* @return void
*/
public function view($kanbanID, $regionID = 'all')
public function view($kanbanID)
{
$this->session->set('kanbanView', $this->app->getURI(true), 'kanban');
$kanban = $this->kanban->getByID($kanbanID);
$users = $this->loadModel('user')->getPairs('noletter|nodeleted');
$kanban = $this->kanban->getByID($kanbanID);
$users = $this->loadModel('user')->getPairs('noletter|nodeleted');
$regionID = $this->session->regionID ? $this->session->regionID : 'all';
if(!$kanban)
{
@@ -474,15 +472,9 @@ class kanban extends control
$regionID = $this->kanban->createRegion($kanban, '', $copyRegionID, $from);
$this->session->set('regionID', $regionID, 'kanban');
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
if($from == 'kanban')
{
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadKanban($kanbanID, $regionID)"));
}
else
{
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
}
$regions = $this->kanban->getRegionPairs($kanbanID, 0, $from);
@@ -948,7 +940,7 @@ class kanban extends control
{
$this->kanban->batchCreateCard($kanbanID, $regionID, $groupID, $columnID);
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->session->kanbanView));
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $backLink));
}
$kanbanUsers = $kanbanID == 0 ? ',' : trim($kanban->owner) . ',' . trim($kanban->team);
@@ -1143,7 +1135,7 @@ class kanban extends control
$this->loadModel('action')->create('kanbancard', $cardID, 'importedcard', '', $cards2Imported[$cardID]->kanban);
}
return print(js::locate($this->session->kanbanView, 'parent.parent'));
return print(js::locate($this->createLink('kanban', 'view', "kanbanID=$kanbanID"), 'parent.parent'));
}
/* Find Kanban other than this kanban. */
@@ -1190,7 +1182,7 @@ class kanban extends control
$this->loadModel('action')->create('kanbancard', $cardID, 'importedProductplan', '', $planID);
}
return print(js::locate($this->session->kanbanView, 'parent.parent'));
return print(js::locate($this->createLink('kanban', 'view', "kanbanID=$kanbanID"), 'parent.parent'));
}
$this->loadModel('product');
@@ -1242,7 +1234,7 @@ class kanban extends control
$this->loadModel('action')->create('kanbancard', $cardID, 'importedRelease', '', $releaseID);
}
return print(js::locate($this->session->kanbanView, 'parent.parent'));
return print(js::locate($this->createLink('kanban', 'view', "kanbanID=$kanbanID"), 'parent.parent'));
}
$this->loadModel('product');
@@ -1291,7 +1283,7 @@ class kanban extends control
$this->loadModel('action')->create('kanbancard', $cardID, 'importedBuild', '', $buildID);
}
return print(js::locate($this->session->kanbanView, 'parent.parent'));
return print(js::locate($this->createLink('kanban', 'view', "kanbanID=$kanbanID"), 'parent.parent'));
}
$this->loadModel('build');
@@ -1353,7 +1345,7 @@ class kanban extends control
$this->loadModel('action')->create('kanbancard', $cardID, 'importedExecution', '', $executionID);
}
return print(js::locate($this->session->kanbanView, 'parent.parent'));
return print(js::locate($this->createLink('kanban', 'view', "kanbanID=$kanbanID"), 'parent.parent'));
}
$this->loadModel('project');
@@ -1969,4 +1961,16 @@ class kanban extends control
return print(html::select($fieldName, $users, $selectedUser, "class='form-control' $multiple"));
}
/**
* Ajax save regionID.
*
* @param int|string $regionID
* @access public
* @return void
*/
public function ajaxSaveRegionID($regionID)
{
$this->session->set('regionID', $regionID, 'kanban');
}
}
+9 -4
View File
@@ -161,17 +161,22 @@
#regionTabs {background-color: #efefef; z-index: 100; display: flex;}
#regionTabs .leftBtn.disabled i, #regionTabs .rightBtn.disabled i{color: #c2c2c2;}
#regionTabs .icon-angle-left, #regionTabs .icon-angle-right {font-size: 20px; vertical-align: -webkit-baseline-middle;}
#regionNavTabs {display: inline-flex; overflow: hidden; width: 100%;}
#regionNavTabs > ul {display: inline-flex; border-bottom: unset; transform: translateX(10px);}
#regionNavTabs {display: inline-flex; overflow: hidden; width: 100%; padding-left: 10px;}
#regionNavTabs > ul {display: inline-flex; border-bottom: unset;}
#regionNavTabs > ul > li {padding: 6px 15px; margin-bottom: 6px; border-radius: 4px 4px 0px 0px;}
#regionNavTabs > ul > li.active {background-color: #fff;}
#regionNavTabs > ul > li.active::before {content: ''; width: 10px; height: 10px; position: absolute; left: -10px; top: 21px; background: radial-gradient(circle at 0% 0%,transparent 10px,#fff 0);}
#regionNavTabs > ul > li.active::after {content: ''; width: 10px; height: 10px; position: absolute; left: calc(100%); top: 21px; background: radial-gradient(circle at 100% 0%,transparent 10px,#fff 0);}
#regionNavTabs > ul > li > a {max-width: 195px; overflow: hidden; white-space: nowrap; padding: 0;}
#regionNavTabs > ul > li > a {max-width: 195px; overflow: hidden; white-space: nowrap; padding: 0; background-color: transparent;}
#regionNavTabs > ul > li.active > a:before {background: unset;}
#regionTabs.affixed {margin-bottom: 5px; position: fixed; top: 0px;}
#regionTabs.affixed + #kanbanContainer .kanban-board.kanban-affixed > .kanban-header {margin-top: 30px;}
#regionTabs.affixed + #kanbanContainer .kanban-board.kanban-affixed > .kanban-header + .kanban-lane {margin-top: 38px;}
#regionTabs.affixed ul > li {margin-bottom: 0px !important;}
#regionTabs .region-actions .dropdown-menu {top: 25px;}
#region-tab-actions {display: flex; position: relative; right: 0px; top: -2px;}
#region-tab-actions {display: none;}
#region-tab-actions.active {display: flex; position: relative; right: 0px; top: -2px;}
.region {display: none;}
.region.active {display: block;}
.region.active.notAll {margin-top: 0px;}
.region.active.notAll .region-header > * {display: none;}
-13
View File
@@ -148,16 +148,3 @@ function loadOwners(spaceID)
$('#owner').chosen();
});
}
/**
* Load kanban.
*
* @param int $kanbanID
* @param int $regionID
* @access public
* @return void
*/
function loadKanban(kanbanID, regionID)
{
location.href = createLink('kanban', 'view', 'kanbanID=' + kanbanID + '&regionID=' + regionID);
}
+81 -13
View File
@@ -1433,6 +1433,8 @@ function initKanban($kanban)
*/
$(function()
{
$(document).find('main#main').css('padding-top', '16px');
window.isMultiLanes = laneCount > 1;
$.cookie('isFullScreen', 0);
@@ -1552,6 +1554,8 @@ $(function()
setToolTip();
distance = 0;
radiusWidth = 10;
$(window).on('resize', initRegionTabs);
$('.leftBtn').click(function()
@@ -1565,6 +1569,8 @@ $(function()
if($(this).hasClass('disabled')) return;
swipeRegionNavTabs($('#regionNavTabs').find('ul'), 'right');
});
if(Object.values(regions).length <= 1) $('#kanbanBox').removeClass('hidden');
});
/**
@@ -1842,8 +1848,6 @@ function swipeRegionNavTabs($object, direction)
var offsetWidth = $regionNavTabs[0].offsetWidth;
var objectWidth = $object[0].offsetWidth;
$object.css('transition-duration', '1s');
$object.find('li').each(function()
{
/* Get the offset of the item. */
@@ -1854,13 +1858,13 @@ function swipeRegionNavTabs($object, direction)
var radius = $item.hasClass('active') ? radiusWidth : 0;
/* Calculate the offset after sliding. */
if(direction == 'left' && (itemOffset + distance + radius) >= 0)
if(direction == 'left' && (itemOffset + distance + radius) >= -5)
{
/* If you swipe left, the distance is equal to the item's left. */
distance = - itemLeft + radius - ($item.prev().hasClass('active') ? radiusWidth : 0);
if(distance + radius >= 0)
if($item.prev().length == 0)
{
distance = radius;
distance = 0;
$('.leftBtn').addClass('disabled');
}
$object[0].style.transform = 'translateX(' + distance + 'px)';
@@ -1871,13 +1875,13 @@ function swipeRegionNavTabs($object, direction)
}
var nextRadius = $item.next().hasClass('active') ? radiusWidth : 0;
if(direction == 'right' && itemOffset > (offsetWidth - distance + nextRadius))
if(direction == 'right' && itemOffset > (offsetWidth - distance + nextRadius + radiusWidth * 2))
{
/* If you swipe right, the distance is equal to the left distance of item plus the width of item minus the width of the regionNavTabs. */
distance = offsetWidth - itemOffset - radius + nextRadius;
distance = offsetWidth - itemOffset - radius + nextRadius - radiusWidth * 2;
if($item.next().length == 0)
{
distance = - objectWidth + offsetWidth - radius;
distance = - objectWidth + offsetWidth - radiusWidth * 2;
$('.rightBtn').addClass('disabled');
}
$object[0].style.transform = 'translateX(' + distance + 'px)';
@@ -1912,11 +1916,75 @@ function initRegionTabs()
/* Print left and right button. */
if(regionTabULWidth > regionTabsWidth) $('.leftBtn, .rightBtn').removeClass('hidden');
/* Locate the position of the currently selected item. */
radiusWidth = 10;
distance = (acitiveItemLeft + acitiveItemWidth) > regionTabsWidth ? - (acitiveItemLeft + acitiveItemWidth - regionTabsWidth + radiusWidth) : 0;
if($acitiveItem.prev().length == 0) distance = radiusWidth;
$regionNavTabs.find('ul')[0].style.transform = 'translateX(' + distance + 'px)';
if(acitiveItemLeft + distance < 0)
{
distance = - acitiveItemLeft;
if($acitiveItem.prev().length == 0)
{
distance = 0;
$('.leftBtn').addClass('disabled');
}
$('#regionNavTabs > ul')[0].style.transform = 'translateX(' + distance + 'px)';
}
else if(acitiveItemWidth + acitiveItemLeft + distance + radiusWidth * 2 > regionTabsWidth && acitiveItemLeft != 0 && acitiveItemWidth != 0)
{
distance = regionTabsWidth - acitiveItemWidth - acitiveItemLeft + (distance != 0 ? - radiusWidth * 2 : radiusWidth);
if($acitiveItem.next().length == 0)
{
distance = regionTabsWidth - acitiveItemWidth - acitiveItemLeft - radiusWidth * 2;
$('.rightBtn').addClass('disabled');
}
$('#regionNavTabs > ul')[0].style.transform = 'translateX(' + distance + 'px)';
}
if(distance < 0) $('#regionTabs').find('.leftBtn').removeClass('disabled');
if($acitiveItem.next().length != 0 && regionTabULWidth > regionTabsWidth) $('#regionTabs').find('.rightBtn').removeClass('disabled');
$('#kanbanBox').removeClass('hidden');
}
$('[data-tab]').on('shown.zui.tab', function(e)
{
/* Init vars. */
var $current = $(e.target);
var $prev = $(e.relatedTarget);
var $regionActions = $('#region-tab-actions');
var $regions = $('.region');
var contentID = $current.attr('href');
var regionID = $current.parent().attr('data-id');
var hasActions = $regionActions.hasClass('active');
/* Highlight the currently selected tab. */
$current.addClass('btn-active-text');
$current.parent().addClass('active');
$prev.removeClass('btn-active-text');
$prev.parent().removeClass('active');
/* Dynamic display and hidden of regions. */
if(contentID == 'all')
{
$regions.addClass('active').removeClass('notAll');
if(hasActions) $regionActions.removeClass('active');
}
else
{
var $currentRegion = $(contentID);
$regions.removeClass('active');
$currentRegion.addClass('active notAll');
$currentRegion.find('.kanban').css('display', 'block');
if(!hasActions) $regionActions.addClass('active');
/* Replace the link of the region actions button with the ID of the current region. */
$regionActions.find('li').each(function()
{
if($(this).hasClass('editRegion')) $(this).find('a').attr('href', createLink('kanban', 'editRegion', 'regionID=' + regionID, '', true));
if($(this).hasClass('createLane')) $(this).find('a').attr('href', createLink('kanban', 'createLane', 'kanbanID=' + kanbanID + '&regionID=' + regionID, '', true));
if($(this).hasClass('deleteRegion')) $(this).find('a').attr('href', createLink('kanban', 'deleteRegion', 'regionID=' + regionID));
if($(this).hasClass('archivedCard')) $(this).find('a').attr('href', "javascript:loadMore(\"Card\", " + regionID + ')');
if($(this).hasClass('archivedColumn')) $(this).find('a').attr('href', "javascript:loadMore(\"Column\", " + regionID + ')');
});
}
/* To manually refresh stay under the current tab, save the ID of the current region. */
var url = createLink('kanban', 'ajaxSaveRegionID', 'regionID=' + regionID);
$.get(url);
});
+22 -56
View File
@@ -54,102 +54,68 @@ $canViewArchivedCard = commonModel::hasPriv('kanban', 'viewArchivedCard');
$canViewArchivedColumn = commonModel::hasPriv('kanban', 'viewArchivedColumn');
?>
<div id='kanbanBox'>
<div id='kanbanBox' class='hidden'>
<?php if(count($regions) > 1):?>
<div id='regionTabs'>
<div class='leftBtn hidden disabled'><a><i class='icon icon-angle-left'></i></a></div>
<div id='regionNavTabs'>
<ul class="nav nav-tabs">
<li data-id='all' class="<?php echo $regionID === 'all' ? 'active' : '';?>" title="<?php echo $lang->kanbanregion->all;?>">
<a href="<?php echo inlink('view', "kanbanID=$kanban->id&regionID=all");?>" class="<?php echo $regionID === 'all' ? 'btn-active-text' : '';?>">
<span class='text'><?php echo $lang->kanbanregion->all;?></span>
</a>
<?php $active = $regionID == 'all' ? 'btn-active-text' : '';?>
<?php echo html::a('all', "<span class='text'>{$lang->kanbanregion->all}</span>", '', "class='$active' data-tab");?>
</li>
<?php foreach($regions as $region):?>
<li data-id="<?php echo $region->id;?>" class="<?php echo $region->id == $regionID ? 'active' : '';?>" title="<?php echo $region->name;?>">
<a href="<?php echo inlink('view', "kanbanID=$kanban->id&regionID=$region->id");?>" class="<?php echo $region->id == $regionID ? 'btn-active-text' : '';?>">
<span class='text'><?php echo $region->name;?></span>
</a>
<?php $active = $region->id == $regionID ? 'btn-active-text' : '';?>
<?php echo html::a("#region{$region->id}", "<span class='text'>$region->name</span>", '', "class='$active' data-tab");?>
</li>
<?php endforeach;?>
</ul>
</div>
<div class='rightBtn hidden disabled'><a><i class='icon icon-angle-right'></i></a></div>
<?php if($regionID !== 'all'):?>
<div id='region-tab-actions'>
<div id='region-tab-actions' class="<?php echo $regionID !== 'all' ? 'active' : '';?>">
<div class='region-actions'>
<?php if(($canViewArchivedCard or $canViewArchivedColumn) and $kanban->archived):?>
<div>
<button data-toggle="dropdown" class="btn btn-link action" type="button" title=<?php echo $this->lang->kanban->archived;?>>
<span><?php echo $this->lang->kanban->archived;?></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<?php if($canViewArchivedCard) echo '<li>' . html::a("javascript:loadMore(\"Card\", $regionID)", '<i class="icon icon-card-archive"></i>' . $this->lang->kanban->viewArchivedCard) . '</li>';?>
<?php if($canViewArchivedColumn) echo '<li>' . html::a("javascript:loadMore(\"Column\", $regionID)", '<i class="icon icon-col-archive"></i>' . $this->lang->kanban->viewArchivedColumn) . '</li>';?>
</ul>
</div>
<?php endif;?>
<ul class="dropdown-menu pull-right">
<?php echo '<li>' . html::a(inlink('viewArchivedCard', "", '', 1), '<i class="icon icon-card-archive"></i>' . $this->lang->kanban->viewArchivedCard, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php echo '<li>' . html::a(inlink('viewArchivedColumn', "", '', 1), '<i class="icon icon-col-archive"></i>' . $this->lang->kanban->viewArchivedColumn, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
</ul>
</div>
<div class='region-actions'>
<?php if(($canEditRegion || $canCreateLane || $canDeleteRegion || $canCreateRegion) and !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed')):?>
<?php if(($canEditRegion or $canCreateLane or $canDeleteRegion or $canCreateRegion or ($kanban->archived and ($canViewArchivedCard or $canViewArchivedColumn))) and !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed')):?>
<button class="btn btn-link action" type="button" data-toggle="dropdown"><i class="icon icon-ellipsis-v"></i></button>
<ul class="dropdown-menu pull-right">
<?php if($canCreateRegion) echo '<li>' . html::a(inlink('createRegion', "kanbanID={$kanban->id}", '', 1), '<i class="icon icon-plus"></i>' . $this->lang->kanban->createRegion, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php if($canEditRegion) echo '<li>' . html::a(inlink('editRegion', "regionID={$regionID}", '', 1), '<i class="icon icon-edit"></i>' . $this->lang->kanban->editRegion, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php if($canCreateLane) echo '<li>' . html::a(inlink('createLane', "kanbanID={$kanban->id}&regionID={$regionID}", '', 1), '<i class="icon icon-plus"></i>' . $this->lang->kanban->createLane, '', "class='iframe'") . '</li>';?>
<?php if($canDeleteRegion and count($regions) > 1) echo '<li>' . html::a(inlink('deleteRegion', "regionID={$regionID}"), '<i class="icon icon-trash"></i>' . $this->lang->kanban->deleteRegion, "hiddenwin") . '</li>';?>
<?php if($canEditRegion) echo "<li class='editRegion'>" . html::a(inlink('editRegion', "regionID={$regionID}", '', 1), '<i class="icon icon-edit"></i>' . $this->lang->kanban->editRegion, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php if($canCreateLane) echo "<li class='createLane'>" . html::a(inlink('createLane', "kanbanID={$kanban->id}&regionID={$regionID}", '', 1), '<i class="icon icon-plus"></i>' . $this->lang->kanban->createLane, '', "class='iframe'") . '</li>';?>
<?php if($canDeleteRegion and count($regions) > 1) echo "<li class='deleteRegion'>" . html::a(inlink('deleteRegion', "regionID={$regionID}"), '<i class="icon icon-trash"></i>' . $this->lang->kanban->deleteRegion, "hiddenwin") . '</li>';?>
<?php if(($canCreateRegion or $canEditRegion or $canCreateLane or ($canDeleteRegion and count($regions) > 1)) and ($kanban->archived and ($canViewArchivedCard or $canViewArchivedColumn)))echo "<li class='divider'></li>"?>
<?php if($canViewArchivedCard and $kanban->archived) echo "<li class='archivedCard'>" . html::a("javascript:loadMore(\"Card\", $regionID)", '<i class="icon icon-card-archive"></i>' . $this->lang->kanban->viewArchivedCard) . '</li>';?>
<?php if($canViewArchivedColumn and $kanban->archived) echo "<li class='archivedColumn'>" . html::a("javascript:loadMore(\"Column\", $regionID)", '<i class="icon icon-col-archive"></i>' . $this->lang->kanban->viewArchivedColumn) . '</li>';?>
</ul>
<?php endif;?>
</div>
</div>
<?php endif;?>
</div>
<?php endif;?>
<div class='panel' id='kanbanContainer'>
<div class='panel-body'>
<div id="kanban" data-id='<?php echo $kanban->id;?>'>
<?php $regionGroup = ($regionID !== 'all' and isset($regions[$regionID])) ? array($regionID => $regions[$regionID]) : $regions;?>
<?php foreach($regionGroup as $region):?>
<div class="region<?php if($canSortRegion) echo ' sort';?>" data-id="<?php echo $region->id;?>">
<?php foreach($regions as $region):?>
<?php $regionClass = ($regionID == 'all' or $region->id == $regionID) ? 'active' : '';?>
<?php if($canSortRegion) $regionClass .= ' sort';?>
<?php if($regionID !== 'all') $regionClass .= ' notAll';?>
<div class="region <?php echo $regionClass;?>" data-id="<?php echo $region->id;?>" id="<?php echo 'region' . $region->id?>">
<div class="region-header dropdown">
<?php if($regionID === 'all'):?>
<strong><?php echo $region->name;?></strong>
<i class="icon icon-angle-top btn-link" data-id="<?php echo $region->id;?>"></i>
<div class='region-actions'>
<?php if(($canEditRegion || $canCreateLane || $canDeleteRegion || $canCreateRegion) and !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed')):?>
<?php if(($canEditRegion or $canCreateLane or $canDeleteRegion or $canCreateRegion or ($kanban->archived and ($canViewArchivedCard or $canViewArchivedColumn))) and !(isset($this->config->CRKanban) and $this->config->CRKanban == '0' and $kanban->status == 'closed')):?>
<button class="btn btn-link action" type="button" data-toggle="dropdown"><i class="icon icon-ellipsis-v"></i></button>
<ul class="dropdown-menu pull-right">
<?php if($canCreateRegion) echo '<li>' . html::a(inlink('createRegion', "kanbanID={$kanban->id}", '', 1), '<i class="icon icon-plus"></i>' . $this->lang->kanban->createRegion, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php if($canEditRegion) echo '<li>' . html::a(inlink('editRegion', "regionID={$region->id}", '', 1), '<i class="icon icon-edit"></i>' . $this->lang->kanban->editRegion, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php if($canCreateLane) echo '<li>' . html::a(inlink('createLane', "kanbanID={$kanban->id}&regionID={$region->id}", '', 1), '<i class="icon icon-plus"></i>' . $this->lang->kanban->createLane, '', "class='iframe'") . '</li>';?>
<?php if($canDeleteRegion and count($regions) > 1) echo '<li>' . html::a(inlink('deleteRegion', "regionID={$region->id}"), '<i class="icon icon-trash"></i>' . $this->lang->kanban->deleteRegion, "hiddenwin") . '</li>';?>
<?php if(($canCreateRegion or $canEditRegion or $canCreateLane or ($canDeleteRegion and count($regions) > 1)) and ($kanban->archived and ($canViewArchivedCard or $canViewArchivedColumn)))echo "<li class='divider'></li>"?>
<?php if($canViewArchivedCard and $kanban->archived) echo '<li>' . html::a("javascript:loadMore(\"Card\", $regionID)", '<i class="icon icon-card-archive"></i>' . $this->lang->kanban->viewArchivedCard) . '</li>';?>
<?php if($canViewArchivedColumn and $kanban->archived) echo '<li>' . html::a("javascript:loadMore(\"Column\", $regionID)", '<i class="icon icon-col-archive"></i>' . $this->lang->kanban->viewArchivedColumn) . '</li>';?>
</ul>
<?php endif;?>
</div>
<div class='region-actions'>
<?php if(($canViewArchivedCard or $canViewArchivedColumn) and $kanban->archived):?>
<div>
<button data-toggle="dropdown" class="btn btn-link action" type="button" title=<?php echo $this->lang->kanban->archived;?>>
<span><?php echo $this->lang->kanban->archived;?></span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right">
<?php if($canViewArchivedCard) echo '<li>' . html::a("javascript:loadMore(\"Card\", $region->id)", '<i class="icon icon-card-archive"></i>' . $this->lang->kanban->viewArchivedCard) . '</li>';?>
<?php if($canViewArchivedColumn) echo '<li>' . html::a("javascript:loadMore(\"Column\", $region->id)", '<i class="icon icon-col-archive"></i>' . $this->lang->kanban->viewArchivedColumn) . '</li>';?>
</ul>
</div>
<?php endif;?>
<ul class="dropdown-menu pull-right">
<?php echo '<li>' . html::a(inlink('viewArchivedCard', "", '', 1), '<i class="icon icon-card-archive"></i>' . $this->lang->kanban->viewArchivedCard, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
<?php echo '<li>' . html::a(inlink('viewArchivedColumn', "", '', 1), '<i class="icon icon-col-archive"></i>' . $this->lang->kanban->viewArchivedColumn, '', 'class="iframe" data-toggle="modal" data-width="600px"') . '</li>';?>
</ul>
</div>
<?php endif;?>
</div>
<div id='kanban<?php echo $region->id;?>' data-id='<?php echo $region->id;?>' class='kanban'></div>
</div>
+1
View File
@@ -314,6 +314,7 @@ function setBudgetTipsAndAclList(parentID)
budgetNotes = programBudget != 0 ? (PGMParentBudget + PGMBudgetUnit + data.availableBudget) : '';
$('#budget').attr('placeholder', budgetNotes);
refreshBudgetUnit(data);
});
$('.aclBox').html($('#subPGMAcl').html());
}
+1 -11
View File
@@ -145,17 +145,7 @@ function setParentProgram(parentProgram)
}
budgetOverrunTips();
outOfDateTip();
$('#budgetUnit').val(data.budgetUnit).trigger('chosen:updated');
if(typeof(data.availableBudget) == 'undefined')
{
$('#budget').removeAttr('placeholder').attr('disabled', true);
$('#future').prop('checked', true);
}
else
{
$('#budget').removeAttr('disabled')
$('#future').prop('checked', false);
}
refreshBudgetUnit(data);
});
$('#parent').attr('data-lastSelected', parentProgram);
+6 -2
View File
@@ -1177,8 +1177,12 @@ class task extends control
$this->session->set('estimateList', $uri, 'execution');
if(isonlybody()) $this->session->set('estimateList', $uri . (strpos($uri, '?') === false ? '?' : '&') . 'onlybody=yes', 'execution');
$this->view->task = $this->task->getById($taskID);
$this->view->estimates = $this->task->getTaskEstimate($taskID);
$task = $this->task->getById($taskID);
$orderBy = 'date,id';
if(!empty($task->team) and $task->mode == 'linear') $orderBy = 'order,date,id';
$this->view->task = $task;
$this->view->estimates = $this->task->getTaskEstimate($taskID, '', '', $orderBy);
$this->view->title = $this->lang->task->record;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->display();
+43 -17
View File
@@ -487,7 +487,7 @@ class taskModel extends model
$clonedTaskID = $this->dao->lastInsertID();
/* Update the table by judging the beginning of the version number. */
if(preg_match('/^\d/', $this->config->version))
if($this->config->edition == 'open')
{
/* ZenTao Pms update TABLE_TASKESTIMATE. */
$this->dao->update(TABLE_TASKESTIMATE)->set('task')->eq($clonedTaskID)->where('task')->eq($oldParentTask->id)->exec();
@@ -985,6 +985,8 @@ class taskModel extends model
$taskID = 0;
foreach($teams as $team)
{
if(isset($extra['order']) and $team->order == $extra['order'] and $team->account == $account) return $team;
if(empty($taskID)) $taskID = $team->task;
if(isset($members[$team->account])) $duplicates[$team->account] = $team->account;
if(!isset($members[$team->account])) $members[$team->account] = 0;
@@ -1746,7 +1748,7 @@ class taskModel extends model
$estimate->account = $this->app->user->account;
$estimate->consumed = (!empty($oldTask->team) and $currentTeam) ? $estimate->consumed - $currentTeam->consumed : $estimate->consumed - $oldTask->consumed;
if($this->post->comment) $estimate->work = $this->post->comment;
$this->addTaskEstimate($estimate);
$estimateID = $this->addTaskEstimate($estimate);
if(!empty($oldTask->team) and $currentTeam)
{
@@ -1756,6 +1758,7 @@ class taskModel extends model
$data->status = 'doing';
$this->dao->update(TABLE_TASKTEAM)->data($data)->where('id')->eq($currentTeam->id)->exec();
if($oldTask->mode == 'linear') $this->updateEstimateOrder($estimateID, $currentTeam->order);
$task = $this->computeHours4Multiple($oldTask, $task);
@@ -1834,6 +1837,7 @@ class taskModel extends model
$estimates[$id]->left = $record->left[$id];
$estimates[$id]->work = $record->work[$id];
$estimates[$id]->account = $this->app->user->account;
$estimates[$id]->order = !empty($record->order[$id]) ? $record->order[$id] : 0;
}
}
@@ -1903,11 +1907,14 @@ class taskModel extends model
/* Process multi-person task. Update consumed on team table. */
if(!empty($task->team))
{
$currentTeam = $this->getTeamByAccount($task->team, $this->app->user->account);
$extra = array('filter' => 'done');
if(!empty($estimate->order)) $extra['order'] = $estimate->order;
$currentTeam = $this->getTeamByAccount($task->team, $this->app->user->account, $extra);
if($currentTeam)
{
$teamStatus = $estimate->left == 0 ? 'done' : 'doing';
$this->dao->update(TABLE_TASKTEAM)->set('left')->eq($estimate->left)->set("consumed = consumed + {$estimate->consumed}")->set('status')->eq($teamStatus)->where('id')->eq($currentTeam->id)->exec();
if($task->mode == 'linear') $this->updateEstimateOrder($estimateID, $currentTeam->order);
$currentTeam->consumed += $estimate->consumed;
$currentTeam->left = $estimate->left;
$currentTeam->status = $teamStatus;
@@ -1946,12 +1953,15 @@ class taskModel extends model
public function resetEffortLeft($taskID, $members)
{
$table = $this->config->edition == 'open' ? TABLE_TASKESTIMATE : TABLE_EFFORT;
$this->dao->update($table)->set('`left`')->eq(0)->where('account')->in($members)
->beginIF($this->config->edition == 'open')->andWhere('task')->eq($taskID)->fi()
->beginIF($this->config->edition != 'open')->andWhere('objectID')->eq($taskID)->andWhere('objectType')->eq('task')->fi()
->orderBy('date_desc,id_desc')
->limit('1')
->exec();
foreach($members as $account)
{
$this->dao->update($table)->set('`left`')->eq(0)->where('account')->eq($account)
->beginIF($this->config->edition == 'open')->andWhere('task')->eq($taskID)->fi()
->beginIF($this->config->edition != 'open')->andWhere('objectID')->eq($taskID)->andWhere('objectType')->eq('task')->fi()
->orderBy('date_desc,id_desc')
->limit('1')
->exec();
}
}
/**
@@ -2020,11 +2030,12 @@ class taskModel extends model
$estimate->account = $this->app->user->account;
$estimate->consumed = $consumed;
if($this->post->comment) $estimate->work = $this->post->comment;
if($estimate->consumed) $this->addTaskEstimate($estimate);
if($estimate->consumed) $estimateID = $this->addTaskEstimate($estimate);
if(!empty($oldTask->team) and $currentTeam)
{
$this->dao->update(TABLE_TASKTEAM)->set('left')->eq(0)->set('consumed')->eq($task->consumed)->set('status')->eq('done')->where('id')->eq($currentTeam->id)->exec();
if($oldTask->mode == 'linear' and isset($estimateID)) $this->updateEstimateOrder($estimateID, $currentTeam->order);
$task = $this->computeHours4Multiple($oldTask, $task);
}
@@ -2775,16 +2786,31 @@ class taskModel extends model
return $taskCounts;
}
/**
* Update estimate order for linear task team.
*
* @param int $estimateID
* @param int $order
* @access public
* @return void
*/
public function updateEstimateOrder($estimateID, $order)
{
$table = $this->config->edition == 'open' ? TABLE_TASKESTIMATE : TABLE_EFFORT;
$this->dao->update($table)->set('`order`')->eq((int)$order)->where('id')->eq($estimateID)->exec();
}
/**
* Get task estimate.
*
* @param int $taskID
* @param string $account
* @param string $append
* @param string $orderBy
* @access public
* @return array
*/
public function getTaskEstimate($taskID, $account = '', $append = '')
public function getTaskEstimate($taskID, $account = '', $append = '', $orderBy = 'date,id')
{
if($this->config->edition == 'open')
{
@@ -2792,7 +2818,7 @@ class taskModel extends model
->where('task')->eq($taskID)
->beginIF($account)->andWhere('account')->eq($account)->fi()
->beginIF($append)->orWhere('id')->eq($append)->fi()
->orderBy('date,id')
->orderBy($orderBy)
->fetchAll();
}
return $this->dao->select('*')->from(TABLE_EFFORT)->where('objectID')->eq($taskID)
@@ -2800,7 +2826,7 @@ class taskModel extends model
->andWhere('deleted')->eq('0')
->beginIF($account)->andWhere('account')->eq($account)->fi()
->beginIF($append)->orWhere('id')->eq($append)->fi()
->orderBy('date,id')
->orderBy($orderBy)
->fetchAll();
}
@@ -2838,7 +2864,6 @@ class taskModel extends model
/* Check for add effort. */
if(empty($effort))
{
if($task->mode == 'linear' and strpos('|done|closed|cancel|pause|', "|{$task->status}|") !== false) return false;
$members = array_map(function($member){ return $member->account; }, $task->team);
if(!in_array($this->app->user->account, $members)) return false;
if($task->mode == 'linear' and $this->app->user->account != $task->assignedTo) return false;
@@ -2899,7 +2924,7 @@ class taskModel extends model
if(!empty($task->team))
{
$currentTeam = $this->getTeamByAccount($task->team, $oldEstimate->account, array('effortID' => $estimateID));
$currentTeam = $this->getTeamByAccount($task->team, $oldEstimate->account, array('order' => $oldEstimate->order));
if($currentTeam)
{
$newTeamInfo = new stdClass();
@@ -2985,7 +3010,7 @@ class taskModel extends model
if(!empty($task->team))
{
$currentTeam = $this->getTeamByAccount($task->team, $estimate->account, array('effortID' => $estimateID));
$currentTeam = $this->getTeamByAccount($task->team, $estimate->account, array('effortID' => $estimateID, 'order' => $estimate->order));
if($currentTeam)
{
$left = $currentTeam->left;
@@ -3589,11 +3614,12 @@ class taskModel extends model
*
* @param object $data
* @access public
* @return void
* @return int
*/
public function addTaskEstimate($data)
{
$this->dao->insert(TABLE_TASKESTIMATE)->data($data)->autoCheck()->exec();
return $this->dao->lastInsertID();
}
/**
+10 -1
View File
@@ -7251,7 +7251,7 @@ class upgradeModel extends model
*/
public function convertTaskteam()
{
$oldTeamGroup = $this->dao->select('root as task, account, estimate, consumed, left')->from(TABLE_TEAM)->where('type')->eq('task')->fetchGroup('task');
$oldTeamGroup = $this->dao->select('root as task, account, estimate, consumed, `left`')->from(TABLE_TEAM)->where('type')->eq('task')->fetchGroup('task');
foreach($oldTeamGroup as $taskID => $oldTeams)
{
$order = 0;
@@ -7263,6 +7263,15 @@ class upgradeModel extends model
if($oldTeam->consumed > 0 and $oldTeam->left == 0) $oldTeam->status = 'done';
$this->dao->insert(TABLE_TASKTEAM)->data($oldTeam)->exec();
if($this->config->edition == 'open')
{
$this->dao->update(TABLE_TASKESTIMATE)->set('`order`')->eq($order)->where('task')->eq($oldTeam->task)->exec();
}
else
{
$this->dao->update(TABLE_EFFORT)->set('`order`')->eq($order)->where('objectType')->eq('task')->andWhere('objectID')->eq($oldTeam->task)->exec();
}
$order ++;
}
}
+16 -4
View File
@@ -565,7 +565,7 @@ class webhookModel extends model
}
/**
* Get weixin data.
* Get weixin send data.
*
* @param string $title
* @param string $text
@@ -573,7 +573,7 @@ class webhookModel extends model
* @access public
* @return object
*/
public function getWeixinData($title, $text, $mobile)
public function getWeixinData($title, $text, $mobile = '')
{
$data = new stdclass();
$data->msgtype = 'markdown';
@@ -581,13 +581,25 @@ class webhookModel extends model
$markdown = new stdclass();
$markdown->content = $text;
if($mobile) $markdown->mentioned_mobile_list = array($mobile);
if($mobile)
{
$data->msgtype = 'text';
$markdown->mentioned_mobile_list = array($mobile);
}
$data->markdown = $markdown;
$data->{$data->msgtype} = $markdown;
return $data;
}
/**
* Get feishu send data.
*
* @param string $title
* @param string $text
* @access public
* @return string
*/
public function getFeishuData($title, $text)
{
$data = new stdclass();
+22
View File
@@ -1307,3 +1307,25 @@ function setCustomFieldsStyle(maxFieldCount, $name, nameMinWidth)
if($name.width() < nameMinWidth) $name.width(200);
}
/**
* Refresh budget units of the project.
*
* @param object $data
* @access public
* @return void
*/
function refreshBudgetUnit(data)
{
$('#budgetUnit').val(data.budgetUnit).trigger('chosen:updated');
if(typeof(data.availableBudget) == 'undefined')
{
$('#budget').removeAttr('placeholder').attr('disabled', true);
$('#future').prop('checked', true);
}
else
{
$('#budget').removeAttr('disabled');
$('#future').prop('checked', false);
}
}