* task#622.

This commit is contained in:
wangchunsheng
2011-11-29 07:07:47 +00:00
parent f0b1da3206
commit 903d221d19
11 changed files with 123 additions and 44 deletions
+6
View File
@@ -2,3 +2,9 @@ ALTER TABLE `zt_bug` ADD `toStory` MEDIUMINT( 8 ) NOT NULL DEFAULT '0' AFTER `to
ALTER TABLE `zt_testResult` ADD `runAccount` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `stepResults` ;
ALTER TABLE `zt_testRun` ADD `runAccount` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `assignedTo` ;
ALTER TABLE `zt_case` ADD `runAccount` VARCHAR( 30 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER `deleted` ;
-- adjust the working hours.
ALTER TABLE `zt_project` ADD `days` SMALLINT UNSIGNED NOT NULL AFTER `end`;
ALTER TABLE `zt_team` CHANGE `joinDate` `join` DATE NOT NULL DEFAULT '0000-00-00';
ALTER TABLE `zt_team` CHANGE `workingHour` `hours` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT '0'
ALTER TABLE `zt_team` ADD `days` SMALLINT UNSIGNED NOT NULL AFTER `joinDate` ;
+2 -1
View File
@@ -1,5 +1,6 @@
<?php
$config->project->projectCounts = 50;
$config->project->projectCounts = 50;
$config->project->defaultWorkhours = 7;
global $lang, $app;
$app->loadLang('task');
+41
View File
@@ -2,8 +2,49 @@ function setWhite(acl)
{
acl == 'custom' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}
function switchGroup(projectID, groupBy)
{
link = createLink('project', 'groupTask', 'project=' + projectID + '&groupBy=' + groupBy);
location.href=link;
}
/**
* Convert a date string like 2011-11-11 to date object in js.
*
* @param string $date
* @access public
* @return date
*/
function convertStringToDate(dateString)
{
var myDate = dateString.split('-')
return new Date(myDate[0], myDate[1], myDate[2]);
}
/**
* Compute delta of two days.
*
* @param string $date1
* @param string $date1
* @access public
* @return int
*/
function computeDaysDelta(date1, date2)
{
date1 = convertStringToDate(date1);
date2 = convertStringToDate(date2);
return (date2 - date1) / (1000 * 60 * 60 * 24)
}
/* Auto compute the work days. */
$(function()
{
$(".date").bind('dateSelected', function()
{
beginDate = $('#begin').val();
endDate = $('#end').val();
if(beginDate && endDate) $('#days').val(computeDaysDelta(beginDate, endDate));
})
});
+7 -4
View File
@@ -20,6 +20,7 @@ $lang->project->name = 'Name';
$lang->project->code = 'Code';
$lang->project->begin = 'Begin';
$lang->project->end = 'End';
$lang->project->days = 'Workdays';
$lang->project->status = 'Status';
$lang->project->statge = 'Stage';
$lang->project->pri = 'Priority';
@@ -48,10 +49,12 @@ $lang->project->viewBug = 'View bug';
$lang->project->noProduct = 'No product';
$lang->project->select = '--select project--';
$lang->team->account = 'Account';
$lang->team->role = 'Role';
$lang->team->joinDate = 'Join date';
$lang->team->workingHour = 'Hour/Day';
$lang->team->account = 'Account';
$lang->team->role = 'Role';
$lang->team->join = 'Join date';
$lang->team->hours = 'Hour/Day';
$lang->team->days = 'Workdays';
$lang->team->totalHours = 'Total';
/* Lists. */
$lang->project->statusList[''] = '';
+7 -4
View File
@@ -20,6 +20,7 @@ $lang->project->name = '项目名称';
$lang->project->code = '项目代号';
$lang->project->begin = '开始日期';
$lang->project->end = '结束日期';
$lang->project->days = '可用工作日';
$lang->project->status = '项目状态';
$lang->project->statge = '所处阶段';
$lang->project->pri = '优先级';
@@ -48,10 +49,12 @@ $lang->project->viewBug = '查看bug';
$lang->project->noProduct = '无产品项目';
$lang->project->select = '--请选择项目--';
$lang->team->account = '用户';
$lang->team->role = '角色';
$lang->team->joinDate = '加盟日';
$lang->team->workingHour = '工时/天';
$lang->team->account = '用户';
$lang->team->role = '角色';
$lang->team->join = '加盟日';
$lang->team->hours = '可用工时/天';
$lang->team->days = '可用工日';
$lang->team->totalHours = '总计';
/* 字段取值列表。*/
$lang->project->statusList[''] = '';
+18 -19
View File
@@ -152,7 +152,9 @@ class projectModel extends model
$projectID = $this->dao->lastInsertId();
$member->project = $projectID;
$member->account = $this->app->user->account;
$member->joinDate = helper::today();
$member->join = helper::today();
$member->days = $project->days;
$member->hours = $this->config->project->defaultWorkhours;
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
return $projectID;
}
@@ -196,11 +198,12 @@ class projectModel extends model
{
if(!empty($value) and !isset($team[$value]))
{
$member->project = (int)$projectID;
$member->account = $value;
$member->joinDate = helper::today();
$member->role = $fieldName;
$member->workingHour = '';
$member->project = (int)$projectID;
$member->account = $value;
$member->join = helper::today();
$member->role = $fieldName;
$member->days = $project->days;
$member->hours = $this->config->project->defaultWorkhours;
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
}
}
@@ -419,6 +422,7 @@ class projectModel extends model
->andWhere('status')->ne('cancel')
->andWhere('deleted')->eq(0)
->fetch();
$project->days = $project->days ? $project->days : '';
$project->totalEstimate = round($total->totalEstimate, 1);
$project->totalConsumed = round($total->totalConsumed, 1);
$project->totalLeft = round($total->totalLeft, 1);
@@ -779,26 +783,21 @@ class projectModel extends model
foreach($accounts as $key => $account)
{
if(empty($account)) continue;
$role = $roles[$key];
$workingHour = $workingHours[$key];
$member->role = $roles[$key];
$member->days = $days[$key];
$member->hours = $hours[$key];
$mode = $modes[$key];
if($mode == 'update')
{
$this->dao->update(TABLE_TEAM)
->set('role')->eq($role)
->set('workingHour')->eq($workingHour)
->where('project')->eq((int)$projectID)
->andWhere('account')->eq($account)
->exec();
$this->dao->update(TABLE_TEAM)->data($member)->where('project')->eq((int)$projectID)->andWhere('account')->eq($account)->exec();
}
else
{
$member->project = (int)$projectID;
$member->account = $account;
$member->joinDate = helper::today();
$member->role = $role;
$member->workingHour = $workingHour;
$member->project = (int)$projectID;
$member->account = $account;
$member->join = helper::today();
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
}
}
+6 -2
View File
@@ -44,11 +44,15 @@ $(document).ready(function()
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->begin;?></th>
<td><?php echo html::input('begin', '', "class='text-3 date'");?></td>
<td><?php echo html::input('begin', '', "class='text-3 date' onchange='computeDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->end;?></th>
<td><?php echo html::input('end', '', "class='text-3 date'");?></td>
<td><?php echo html::input('end', '', "class='text-3 date' onchange='computeDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->days;?></th>
<td><?php echo html::input('days', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->teamname;?></th>
+6 -2
View File
@@ -26,11 +26,15 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->begin;?></th>
<td><?php echo html::input('begin', $project->begin, "class='text-3 date'");?></td>
<td><?php echo html::input('begin', $project->begin, "class='text-3 date' onchange='computeDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->end;?></th>
<td><?php echo html::input('end', $project->end, "class='text-3 date'");?></td>
<td><?php echo html::input('end', $project->end, "class='text-3 date' onchange='computeDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->days;?></th>
<td><?php echo html::input('days', $project->days, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->teamname;?></th>
+7 -4
View File
@@ -17,16 +17,18 @@
<tr>
<th><?php echo $lang->team->account;?></th>
<th><?php echo $lang->team->role;?></th>
<th><?php echo $lang->team->workingHour;?></th>
<th><?php echo $lang->team->days;?></th>
<th><?php echo $lang->team->hours;?></th>
</tr>
<?php foreach($members as $key => $member):?>
<?php unset($users[$member->account]);?>
<tr>
<td><input type='text' name='accounts[]' id='account<?php echo $key;?>' value='<?php echo $member->account;?>' readonly class='text-2' /></td>
<td><input type='text' name='roles[]' id='role<?php echo $key;?>' value='<?php echo $member->role;?>' class='text-2' /></td>
<td><input type='text' name='days[] ' id='days<?php echo $key;?>' value='<?php echo $member->days;?>' class='text-2' /></td>
<td>
<input type='text' name='workingHours[]' id='workingHour<?php echo $key;?>' value='<?php echo $member->workingHour;?>' class='text-2' />
<input type='hidden' name='modes[]' value='update' />
<input type='text' name='hours[]' id='hours<?php echo $key;?>' value='<?php echo $member->hours;?>' class='text-2' />
<input type='hidden' name='modes[]' value='update' />
</td>
</tr>
<?php endforeach;?>
@@ -39,8 +41,9 @@
<tr>
<td><?php echo html::select('accounts[]', $users, '', 'class=select-2');?></td>
<td><input type='text' name='roles[]' id='role<?php echo ($key + $i);?>' class='text-2' /></td>
<td><input type='text' name='days[]' id='days<?php echo ($key + $i);?>' class='text-2' /></td>
<td>
<input type='text' name='workingHours[]' id='workingHour<?php echo ($key + $i);?>' class='text-2' />
<input type='text' name='hours[]' id='hours<?php echo ($key + $i);?>' class='text-2' />
<input type='hidden' name='modes[]' value='create' />
</td>
</tr>
+19 -8
View File
@@ -12,34 +12,45 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<table align='center' class='table-4 tablesorter'>
<table align='center' class='table-5 tablesorter'>
<thead>
<tr class='colhead'>
<th><?php echo $lang->team->account;?></th>
<th><?php echo $lang->team->role;?></th>
<th><?php echo $lang->team->joinDate;?></th>
<th><?php echo $lang->team->workingHour;?></th>
<th><?php echo $lang->team->join;?></th>
<th><?php echo $lang->team->days;?></th>
<th><?php echo $lang->team->hours;?></th>
<th><?php echo $lang->team->totalHours;?></th>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->actions</th>";?>
</tr>
</thead>
<tbody>
<?php $totalHours = 0;?>
<?php foreach($teamMembers as $member):?>
<tr class='a-center'>
<td>
<?php
if(common::hasPriv('user', 'view')) echo html::a($this->createLink('user', 'view', "account=$member->account"), $member->realname);
else echo $member->realname;
common::hasPriv('user', 'view') ? print(html::a($this->createLink('user', 'view', "account=$member->account"), $member->realname)) : print($member->realname);
$memberHours = $member->days * $member->hours;
$totalHours += $memberHours;
?>
</td>
<td><?php echo $member->role;?></td>
<td><?php echo substr($member->joinDate, 2);?></td>
<td><?php echo $member->workingHour;?></td>
<td><?php echo substr($member->join, 2);?></td>
<td><?php echo $member->days;?></td>
<td><?php echo $member->hours;?></td>
<td><?php echo $memberHours;?></td>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<td>" . html::a($this->createLink('project', 'unlinkmember', "projectID=$project->id&account=$member->account"), $lang->project->unlinkMember, 'hiddenwin') . '</td>';?>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr><td colspan='5' class='a-right'><?php common::printLink('project', 'managemembers', "projectID=$project->id", $lang->project->manageMembers);?></td></tr>
<tr>
<td colspan='7'>
<div class='f-left'><?php echo $lang->team->totalHours . $lang->comma . "<strong>$totalHours</strong>";?></div>
<div class='f-right'><?php common::printLink('project', 'managemembers', "projectID=$project->id", $lang->project->manageMembers);?></div>
</td>
</tr>
</tfoot>
</table>
<?php include '../../common/view/footer.html.php';?>
+4
View File
@@ -25,6 +25,10 @@
<th class='rowhead'><?php echo $lang->project->beginAndEnd;?></th>
<td><?php echo $project->begin . ' ~ ' . $project->end;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->days;?></th>
<td><?php echo $project->days;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->goal;?></th>
<td class='content'><?php echo $project->goal;?></td>