* finish task #7311.
This commit is contained in:
@@ -1 +1,2 @@
|
||||
update `zt_build` set `deleted`='1' where `project`='0' and `id` in (select `build` from `zt_release` where `deleted`='1');
|
||||
ALTER TABLE `zt_productplan` ADD `parent` mediumint(9) NOT NULL DEFAULT '0' AFTER `branch`;
|
||||
|
||||
@@ -42,7 +42,7 @@ class productplan extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function create($product = '', $branch = 0)
|
||||
public function create($product = '', $branch = 0, $parent = 0)
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
@@ -65,11 +65,15 @@ class productplan extends control
|
||||
$begin = date('Y-m-d', strtotime("+$delta days", $timestamp));
|
||||
}
|
||||
$this->view->begin = $lastPlan ? $begin : '';
|
||||
if($parent) $this->view->parentPlan = $this->productplan->getById($parent);
|
||||
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->create;
|
||||
$this->view->lastPlan = $lastPlan;
|
||||
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->create;
|
||||
$this->view->position[] = $this->lang->productplan->common;
|
||||
$this->view->position[] = $this->lang->productplan->create;
|
||||
|
||||
$this->view->lastPlan = $lastPlan;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->parent = $parent;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -206,6 +210,7 @@ class productplan extends control
|
||||
$this->view->title = $products[$productID] . $this->lang->colon . $this->lang->productplan->browse;
|
||||
$this->view->position[] = $this->lang->productplan->browse;
|
||||
$this->view->productID = $productID;
|
||||
$this->view->branch = $branch;
|
||||
$this->view->browseType = $browseType;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->plans = $this->productplan->getList($productID, $branch, $browseType, $pager, $sort);
|
||||
|
||||
@@ -1 +1,13 @@
|
||||
.table td.content { overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
|
||||
|
||||
.table-children {border-left: 2px solid #cbd0db; border-right: 2px solid #cbd0db;}
|
||||
.table tbody > tr.table-children.table-child-top {border-top: 2px solid #cbd0db;}
|
||||
.table tbody > tr.table-children.table-child-bottom {border-bottom: 2px solid #cbd0db;}
|
||||
.table td.has-child > a {max-width: 90%; max-width: calc(100% - 30px); display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
|
||||
.table td.has-child > .task-toggle {color: #838a9d; position: relative; top: 1px;}
|
||||
.table td.has-child > .task-toggle:hover {color: #006af1; cursor: pointer;}
|
||||
.table td.has-child > .task-toggle > .icon {font-size: 16px; display: inline-block; transition: transform .2s; -ms-transform:rotate(-90deg); -moz-transform:rotate(-90deg); -o-transform:rotate(-90deg); -webkit-transform:rotate(-90deg); transform: rotate(-90deg);}
|
||||
.table td.has-child > .task-toggle > .icon:before {text-align: left;}
|
||||
.table td.has-child > .task-toggle.collapsed > .icon {-ms-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -webkit-transform:rotate(90deg); transform: rotate(90deg);}
|
||||
.main-table tbody > tr.table-children > td:first-child::before {width: 3px;}
|
||||
@-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;}}
|
||||
|
||||
@@ -27,6 +27,7 @@ $lang->productplan->batchUnlinkStory = "Batch Unlink";
|
||||
$lang->productplan->linkedStories = 'Linked Story';
|
||||
$lang->productplan->unlinkedStories = 'Unlinked Story';
|
||||
$lang->productplan->updateOrder = 'Sort';
|
||||
$lang->productplan->createChildren = "Create subplans";
|
||||
|
||||
$lang->productplan->linkBug = "Link Bug";
|
||||
$lang->productplan->unlinkBug = "Unlink Bug";
|
||||
@@ -54,6 +55,8 @@ $lang->productplan->stories = 'Stories';
|
||||
$lang->productplan->bugs = 'Bugs';
|
||||
$lang->productplan->hour = 'Hour';
|
||||
$lang->productplan->project = $lang->projectCommon;
|
||||
$lang->productplan->parent = "Father plan";
|
||||
$lang->productplan->children= "Sub plan";
|
||||
|
||||
$lang->productplan->endList[7] = '1 Week';
|
||||
$lang->productplan->endList[14] = '2 Weeks';
|
||||
|
||||
@@ -27,6 +27,7 @@ $lang->productplan->batchUnlinkStory = "批量移除需求";
|
||||
$lang->productplan->linkedStories = '需求';
|
||||
$lang->productplan->unlinkedStories = '未关联需求';
|
||||
$lang->productplan->updateOrder = '排序';
|
||||
$lang->productplan->createChildren = "创建子计划";
|
||||
|
||||
$lang->productplan->linkBug = "关联Bug";
|
||||
$lang->productplan->unlinkBug = "移除Bug";
|
||||
@@ -54,6 +55,8 @@ $lang->productplan->stories = '需求数';
|
||||
$lang->productplan->bugs = 'Bug数';
|
||||
$lang->productplan->hour = '工时';
|
||||
$lang->productplan->project = $lang->projectCommon;
|
||||
$lang->productplan->parent = "父计划";
|
||||
$lang->productplan->children= "子计划";
|
||||
|
||||
$lang->productplan->endList[7] = '一星期';
|
||||
$lang->productplan->endList[14] = '两星期';
|
||||
|
||||
@@ -75,8 +75,8 @@ class productplanModel extends model
|
||||
*/
|
||||
public function getList($product = 0, $branch = 0, $browseType = 'all', $pager = null, $orderBy = 'begin_desc')
|
||||
{
|
||||
$date = date('Y-m-d');
|
||||
$productPlans = $this->dao->select('t1.*,t2.project')->from(TABLE_PRODUCTPLAN)->alias('t1')
|
||||
$date = date('Y-m-d');
|
||||
$plans = $this->dao->select('t1.*,t2.project')->from(TABLE_PRODUCTPLAN)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t2.plan = t1.id and t2.product = ' . $product)
|
||||
->where('t1.product')->eq($product)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
@@ -87,21 +87,49 @@ class productplanModel extends model
|
||||
->page($pager)
|
||||
->fetchAll('id');
|
||||
|
||||
if(!empty($productPlans))
|
||||
$planIdList = array();
|
||||
$childrenPlans = array();
|
||||
foreach($plans as $plan)
|
||||
{
|
||||
foreach($productPlans as $productPlan)
|
||||
$planIdList[$plan->id] = $plan->id;
|
||||
if($plan->parent > 0)
|
||||
{
|
||||
$stories = $this->dao->select('id,estimate')->from(TABLE_STORY)
|
||||
->where("CONCAT(',', plan, ',')")->like("%,{$productPlan->id},%")
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs('id', 'estimate');
|
||||
$productPlan->stories = count($stories);
|
||||
$productPlan->bugs = $this->dao->select()->from(TABLE_BUG)->where("plan")->eq($productPlan->id)->andWhere('deleted')->eq(0)->count();
|
||||
$productPlan->hour = array_sum($stories);
|
||||
$productPlan->projectID = $productPlan->project;
|
||||
$childrenPlans[$plan->parent][$plan->id] = $plan;
|
||||
unset($plans[$plan->id]);
|
||||
}
|
||||
}
|
||||
return $productPlans;
|
||||
|
||||
if(!empty($childrenPlans))
|
||||
{
|
||||
$processedPlans = array();
|
||||
foreach($plans as $plan)
|
||||
{
|
||||
$processedPlans[$plan->id] = $plan;
|
||||
if(isset($childrenPlans[$plan->id]))
|
||||
{
|
||||
$plan->children = count($childrenPlans[$plan->id]);
|
||||
foreach($childrenPlans[$plan->id] as $childrenPlan) $processedPlans[$childrenPlan->id] = $childrenPlan;
|
||||
}
|
||||
}
|
||||
$plans = $processedPlans;
|
||||
}
|
||||
|
||||
if(!empty($plans))
|
||||
{
|
||||
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where("plan")->in($planIdList)->andWhere('deleted')->eq(0)->fetchGroup('plan', 'id');
|
||||
foreach($plans as $plan)
|
||||
{
|
||||
$stories = $this->dao->select('id,estimate')->from(TABLE_STORY)
|
||||
->where("CONCAT(',', plan, ',')")->like("%,{$plan->id},%")
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetchPairs('id', 'estimate');
|
||||
$plan->stories = count($stories);
|
||||
$plan->bugs = isset($bugs[$plan->id]) ? count($bugs[$plan->id]) : 0;
|
||||
$plan->hour = array_sum($stories);
|
||||
$plan->projectID = $plan->project;
|
||||
}
|
||||
}
|
||||
return $plans;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -228,6 +256,7 @@ class productplanModel extends model
|
||||
$planID = $this->dao->lastInsertID();
|
||||
$this->file->updateObjectID($this->post->uid, $planID, 'plan');
|
||||
$this->loadModel('score')->create('productplan', 'create', $planID);
|
||||
if($plan->parent) $this->dao->update(TABLE_PRODUCTPLAN)->set('parent')->eq('-1')->where('id')->eq($plan->parent)->andWhere('parent')->eq('0')->exec();
|
||||
return $planID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,14 +63,33 @@
|
||||
<th class='w-60px'> <?php echo $lang->productplan->hour;?></th>
|
||||
<th class='w-60px'> <?php echo $lang->productplan->project;?></th>
|
||||
<th> <?php echo $lang->productplan->desc;?></th>
|
||||
<th class='c-actions-5 text-center'><?php echo $lang->actions;?></th>
|
||||
<th class='c-actions-6 text-center'><?php echo $lang->actions;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $this->loadModel('file');?>
|
||||
<?php foreach($plans as $plan):?>
|
||||
<?php $plan = $this->file->replaceImgURL($plan, 'desc');?>
|
||||
<tr>
|
||||
<?php
|
||||
$plan = $this->file->replaceImgURL($plan, 'desc');
|
||||
if($plan->parent == '-1')
|
||||
{
|
||||
$parent = $plan->id;
|
||||
$children = $plan->children;
|
||||
}
|
||||
if($plan->parent == 0) $parent = 0;
|
||||
if(!empty($parent) and $plan->parent > 0 and $plan->parent != $parent) $parent = 0;
|
||||
if($plan->parent <= 0) $i = 0;
|
||||
|
||||
$class = '';
|
||||
if(!empty($parent) and $plan->parent == $parent)
|
||||
{
|
||||
$class = "table-children parent-{$parent}";
|
||||
$class .= $i == 0 ? ' table-child-top' : '';
|
||||
$class .= ($i + 1 == $children) ? ' table-child-bottom' : '';
|
||||
$i++;
|
||||
}
|
||||
?>
|
||||
<tr class='<?php echo $class;?>'>
|
||||
<td class='cell-id'>
|
||||
<?php if(common::hasPriv('productplan', 'batchEdit')):?>
|
||||
<?php echo html::checkbox('planIDList', array($plan->id => '')) . html::a(helper::createLink('productplan', 'view', "planID=$plan->id"), sprintf('%03d', $plan->id));?>
|
||||
@@ -78,7 +97,12 @@
|
||||
<?php echo sprintf('%03d', $plan->id);?>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
<td class='text-left' title="<?php echo $plan->title?>"><?php echo html::a(inlink('view', "id=$plan->id"), $plan->title);?></td>
|
||||
<td class='text-left<?php if($plan->parent == '-1') echo ' has-child';?>' title="<?php echo $plan->title?>">
|
||||
<?php
|
||||
echo html::a(inlink('view', "id=$plan->id"), $plan->title);
|
||||
if($plan->parent == '-1') echo '<a class="task-toggle" data-id="' . $plan->id . '"><i class="icon icon-angle-double-right"></i></a>';
|
||||
?>
|
||||
</td>
|
||||
<?php if($this->session->currentProductType != 'normal'):?>
|
||||
<td><?php echo $branches[$plan->branch];?></td>
|
||||
<?php endif;?>
|
||||
@@ -95,6 +119,11 @@
|
||||
if(common::hasPriv('productplan', 'linkStory')) echo html::a(inlink('view', "planID=$plan->id&type=story&orderBy=id_desc&link=true"), '<i class="icon-link"></i>', '', "class='btn' title='{$lang->productplan->linkStory}'");
|
||||
if(common::hasPriv('productplan', 'linkBug') and $config->global->flow != 'onlyStory') echo html::a(inlink('view', "planID=$plan->id&type=bug&orderBy=id_desc&link=true"), '<i class="icon-bug"></i>', '', "class='btn' title='{$lang->productplan->linkBug}'");
|
||||
common::printIcon('productplan', 'edit', "planID=$plan->id", $plan, 'list');
|
||||
if(common::hasPriv('productplan', 'create'))
|
||||
{
|
||||
if($plan->parent != '0') echo "<button type='button' class='disabled btn'><i class='disabled icon-treemap-alt' title='{$this->lang->productplan->children}'></i></button>";
|
||||
if($plan->parent == '0') echo html::a($this->createLink('productplan', 'create', "product=$productID&branch=$branch&parent={$plan->id}"), "<i class='icon-treemap-alt'></i>", '', "class='btn' title='{$this->lang->productplan->children}'");
|
||||
}
|
||||
|
||||
if(common::hasPriv('productplan', 'delete', $plan))
|
||||
{
|
||||
|
||||
@@ -17,11 +17,17 @@
|
||||
<div id='mainContent'class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2> <?php echo $lang->productplan->create;?></h2>
|
||||
<h2> <?php echo $parent ? $lang->productplan->createChildren : $lang->productplan->create;?></h2>
|
||||
</div>
|
||||
<form class='load-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform'>
|
||||
<table class='table table-form'>
|
||||
<tbody>
|
||||
<?php if($parent):?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->parent;?></th>
|
||||
<td class='muted'><?php echo $parentPlan->title;?></td><td></td><td></td>
|
||||
</tr>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->product;?></th>
|
||||
<td class='muted'><?php echo $product->name;?></td><td></td><td></td>
|
||||
@@ -32,6 +38,7 @@
|
||||
<td><?php echo html::select('branch', $branches, $branch, "class='form-control chosen'");?></td><td></td><td></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<th><?php echo $lang->productplan->title;?></th>
|
||||
<td><?php echo html::input('title', '', "class='form-control' autocomplete='off' required");?></td>
|
||||
@@ -61,6 +68,8 @@
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::backButton();?>
|
||||
<?php echo html::hidden('product', $product->id);?>
|
||||
<?php echo html::hidden('branch', $parent ? $parentPlan->branch : $branch);?>
|
||||
<?php echo html::hidden('parent', $parent);?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user