* adjust code.

This commit is contained in:
wangyidong
2015-11-04 12:16:40 +08:00
parent 35771f7f36
commit 2a39736fd7
11 changed files with 54 additions and 25 deletions

View File

@@ -132,6 +132,9 @@ class build extends control
$build = $this->build->getById((int)$buildID, true);
if(!$build) die(js::error($this->lang->notFound) . js::locate('back'));
$product = $this->loadModel('product')->getById($build->product);
if($product->type != 'normal') $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($build->stories)->andWhere('deleted')->eq(0)->fetchAll('id');
$stages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->in($build->stories)->andWhere('branch')->eq($build->branch)->fetchPairs('story', 'stage');
foreach($stages as $storyID => $stage)$stories[$storyID]->stage = $stage;

View File

@@ -24,8 +24,8 @@
<table class='table table-form'>
<tr>
<th class='w-110px'><?php echo $lang->build->product;?></th>
<td class='w-p25-f'>
<?php if($products):?>
<?php if($products):?>
<td>
<div class='input-group'>
<?php echo html::select('product', $products, $product->id, "onchange='loadBranches(this.value);' class='form-control chosen'");?>
<?php
@@ -36,13 +36,13 @@
}
?>
</div>
<?php endif;?>
</td>
<?php endif;?>
<td><?php if(empty($products)) printf($lang->build->noProduct, $this->createLink('project', 'manageproducts', "projectID=$projectID"));?></td>
</tr>
<tr>
<th><?php echo $lang->build->name;?></th>
<td>
<td class='w-p25-f'>
<?php echo html::input('name', '', "class='form-control'");?>
</td>
<td>

View File

@@ -31,4 +31,5 @@ $lang->file->errorExtract = 'Decompression failure! The file may have been d
$lang->file->uploadImagesExplain = <<<EOD
<p>1. Upload file to contain pictures of zip package, the program will take the file name as a title, as content with pictures</p>
<p>2. The file name at the beginning contains 'digital+underline', generation of title will they ignore.</p>
<p>3、Image format : jpg|jpeg|gif|png.</p>
EOD;

View File

@@ -31,4 +31,5 @@ $lang->file->errorExtract = '解压缩失败!可能文件已经损坏,
$lang->file->uploadImagesExplain = <<<EOD
<p>1、上传文件为包含图片的zip压缩包程序会以文件名作为标题以图片作为内容。</p>
<p>2、如果文件名可以开头含有 数字+下划线,以方便排序,程序会将他们忽略。</p>
<p>3、图片格式jpg|jpeg|gif|png。</p>
EOD;

View File

@@ -408,8 +408,8 @@ class fileModel extends model
$files = $zip->listContent();
foreach($files as $uploadFile)
{
$extension = substr(strrchr($uploadFile['filename'], '.'), 1);
if(empty($extension) or strpos($this->config->file->dangers, $extension) !== false) return false;
$extension = strtolower(substr(strrchr($uploadFile['filename'], '.'), 1));
if(empty($extension) or !in_array($extension, $this->config->file->imageExtensions)) return false;
}
if($zip->extract(PCLZIP_OPT_PATH, $filePath) == 0) return false;

View File

@@ -522,7 +522,7 @@ class story extends control
$users = $this->user->getPairs('noletter');
/* Set the menu. */
$this->product->setMenu($this->product->getPairs(), $product->id);
$this->product->setMenu($this->product->getPairs(), $product->id, $story->branch);
if($from == 'project')
{

View File

@@ -46,7 +46,15 @@ class storyModel extends model
//$story->bugCount = $this->dao->select('COUNT(*)')->alias('count')->from(TABLE_BUG)->where('story')->eq($storyID)->fetch('count');
//$story->caseCount = $this->dao->select('COUNT(*)')->alias('count')->from(TABLE_CASE)->where('story')->eq($storyID)->fetch('count');
if($story->toBug) $story->toBugTitle = $this->dao->findById($story->toBug)->from(TABLE_BUG)->fetch('title');
if($story->plan) $story->planTitle = join(' ', $this->dao->select('*')->from(TABLE_PRODUCTPLAN)->where('id')->in($story->plan)->fetchPairs('id', 'title'));
if($story->plan)
{
$plans = $this->dao->select('id,title,branch')->from(TABLE_PRODUCTPLAN)->where('id')->in($story->plan)->fetchAll('id');
foreach($plans as $planID => $plan)
{
$story->planTitle[$planID] = $plan->title;
if($plan->branch and !isset($story->stages[$plan->branch])) $story->stages[$plan->branch] = 'planned';
}
}
$extraStories = array();
if($story->duplicateStory) $extraStories = array($story->duplicateStory);
if($story->linkStories) $extraStories = explode(',', $story->linkStories);
@@ -390,12 +398,11 @@ class storyModel extends model
$oldStory = $this->getById($storyID);
$story = fixer::input('post')
->cleanInt('product,module,pri,plan')
->cleanInt('product,module,pri')
->add('assignedDate', $oldStory->assignedDate)
->add('lastEditedBy', $this->app->user->account)
->add('lastEditedDate', $now)
->setDefault('status', $oldStory->status)
->setIF($this->post->plan !== false and $this->post->plan == '', 'plan', 0)
->setIF($this->post->assignedTo != $oldStory->assignedTo, 'assignedDate', $now)
->setIF($this->post->closedBy != false and $oldStory->closedDate == '', 'closedDate', $now)
->setIF($this->post->closedReason != false and $oldStory->closedDate == '', 'closedDate', $now)
@@ -405,6 +412,7 @@ class storyModel extends model
->join('mailto', ',')
->remove('files,labels,comment')
->get();
if(is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ',');
$this->dao->update(TABLE_STORY)
->data($story)
@@ -1271,6 +1279,7 @@ class storyModel extends model
->page($pager)
->fetchAll('id');
$query = $this->dao->get();
$branches = array();
foreach($stories as $story)
{
@@ -1281,6 +1290,8 @@ class storyModel extends model
$stages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->in($storyIDList)->andWhere('branch')->eq($branchID)->fetchPairs('story', 'stage');
foreach($stages as $storyID => $stage) $stories[$storyID]->stage = $stage;
}
$this->dao->sqlobj->sql = $query;
return $stories;
}
@@ -1364,8 +1375,7 @@ class storyModel extends model
*/
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null)
{
$stories = $this->dao->select('t1.*, t2.name as productTitle')
->from(TABLE_STORY)->alias('t1')
$stories = $this->dao->select('t1.*, t2.name as productTitle')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->where('t1.deleted')->eq(0)
->beginIF($type != 'all')
@@ -1828,6 +1838,7 @@ class storyModel extends model
foreach($storyPlans as $planID) $story->planTitle .= zget($plans, $planID) . ' ';
}
$this->dao->sqlobj->sql = $query;
return $stories;
}
}

View File

@@ -83,7 +83,8 @@
<th><?php echo $lang->story->plan;?></th>
<td>
<div class='input-group' id='planIdBox'>
<?php echo html::select('plan', $plans, $story->plan, "class='form-control chosen'");
<?php $multiple = ($this->session->currentProductType != 'normal' and empty($story->branch)) ? true : false;?>
<?php echo html::select($multiple ? 'plan[]' : 'plan', $plans, $story->plan, "class='form-control chosen'" . ($multiple ? ' multiple' : ''));
if(count($plans) == 1)
{
echo "<span class='input-group-addon'>";

View File

@@ -147,7 +147,18 @@
</tr>
<tr>
<th><?php echo $lang->story->plan;?></th>
<td><?php if(isset($story->planTitle)) if(!common::printLink('productplan', 'view', "planID=$story->plan", $story->planTitle)) echo $story->planTitle;?></td>
<td>
<?php
if(isset($story->planTitle))
{
foreach($story->planTitle as $planID => $planTitle)
{
if(!common::printLink('productplan', 'view', "planID=$planID", $planTitle)) echo $lanTitle;
echo '<br />';
}
}
?>
</td>
</tr>
<tr>
<th><?php echo $lang->story->source;?></th>

View File

@@ -286,6 +286,7 @@ class testtask extends control
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->where($caseQuery)
->andWhere('t1.task')->eq($taskID)
->beginIF($task->branch)->andWhere('t2.branch')->in("0,{$task->branch}")->fi()
->orderBy(strpos($sort, 'assignedTo') !== false ? ('t1.' . $sort) : ('t2.' . $sort))
->page($pager)
->fetchAll();
@@ -302,16 +303,8 @@ class testtask extends control
$this->config->testcase->search['params']['product']['values']= array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
$this->config->testcase->search['actionURL'] = inlink('cases', "taskID=$taskID&browseType=bySearch&queryID=myQueryID");
if($this->session->currentProductType == 'normal')
{
unset($this->config->testcase->search['fields']['branch']);
unset($this->config->testcase->search['params']['branch']);
}
else
{
$this->config->testcase->search['fields']['branch'] = $this->lang->product->branch;
$this->config->testcase->search['params']['branch']['values'] = array('' => '') + $this->loadModel('branch')->getPairs($productID, 'noempty');
}
unset($this->config->testcase->search['fields']['branch']);
unset($this->config->testcase->search['params']['branch']);
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases;
@@ -335,6 +328,14 @@ class testtask extends control
$this->display();
}
/**
* Group case.
*
* @param int $taskID
* @param string $groupBy
* @access public
* @return void
*/
public function groupCase($taskID, $groupBy = 'story')
{
/* Save the session. */

View File

@@ -45,7 +45,7 @@
<td><span class='<?php echo 'pri' . zget($lang->story->priList, $story->pri, $story->pri);?>'><?php echo zget($lang->story->priList, $story->pri, $story->pri);?></span></td>
<td><?php echo $story->productTitle;?></td>
<td class='text-left nobr'><?php echo html::a($storyLink, $story->title);?></td>
<td><?php echo $story->planTitle;?></td>
<td title='<?php echo $story->planTitle;?>'><?php echo $story->planTitle;?></td>
<td><?php echo $users[$story->openedBy];?></td>
<td><?php echo $story->estimate;?></td>
<td class='story-<?php echo $story->status;?>'><?php echo $lang->story->statusList[$story->status];?></td>