This commit is contained in:
滔哥
2017-10-31 10:04:00 +08:00
7 changed files with 73 additions and 5 deletions
+1
View File
@@ -98,3 +98,4 @@ CREATE TABLE `zt_score` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `zt_cron` (`m`, `h`, `dom`, `mon`, `dow`, `command`, `remark`, `type`, `buildin`, `status`, `lastTime`) VALUES ('*/5', '*', '*', '*', '*', 'moduleName=webhook&methodName=asyncSend', '异步发送Webhook', 'zentao', 1, 'normal', '0000-00-00 00:00:00');
ALTER TABLE `zt_projectstory` ADD `order` smallint(6) unsigned NOT NULL;
+2
View File
@@ -485,6 +485,8 @@ class file extends control
if(empty($file) or !file_exists($file->realPath)) return false;
$mime = in_array($file->extension, $this->config->file->imageExtensions) ? "image/{$file->extension}" : $this->config->file->mimes['default'];
ob_end_clean();
header("Content-type: $mime");
$handle = fopen($file->realPath, "r");
+27 -1
View File
@@ -530,7 +530,7 @@ class project extends control
* @access public
* @return void
*/
public function story($projectID = 0, $orderBy = '', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
public function story($projectID = 0, $orderBy = 'order', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
{
/* Load these models. */
$this->loadModel('story');
@@ -1991,6 +1991,32 @@ class project extends control
}
}
/**
* Story sort.
*
* @param int $projectID
* @access public
* @return void
*/
public function storySort($projectID)
{
$idList = explode(',', trim($this->post->storys, ','));
$orderBy = $this->post->orderBy;
$stories = $this->dao->select('story,`order`')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.story')->in($idList)
->andWhere('t1.project')->eq($projectID)
->orderBy($orderBy)
->fetchPairs('order', 'story');
foreach($stories as $order => $id)
{
$newID = array_shift($idList);
if($id == $newID) continue;
$this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('story')->eq($newID)->andWhere('project')->eq($projectID)->exec();
}
}
/**
* All project.
*
+7
View File
@@ -2,6 +2,13 @@ $(function()
{
ajaxGetSearchForm();
$('#storyList').on('sort.sortable', function(e, data)
{
var list = '';
for(i = 0; i < data.list.length; i++) list += $(data.list[i]).attr('data-id') + ',';
$.post(createLink('project', 'storySort', 'projectID=' + projectID), {'storys' : list, 'orderBy' : orderBy});
});
fixedTfootAction('#projectStoryForm');
fixedTheadOfList('#storyList');
+13 -3
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<?php include '../../common/view/sortable.html.php';?>
<?php js::set('moduleID', ($type == 'byModule' ? $param : 0));?>
<?php js::set('productID', ($type == 'byProduct' ? $param : 0));?>
<?php js::set('confirmUnlinkStory', $lang->project->confirmUnlinkStory)?>
@@ -55,6 +56,7 @@
<div class='main'>
<script>setTreeBox();</script>
<form method='post' id='projectStoryForm'>
<?php $canOrder = common::hasPriv('project', 'storySort');?>
<table class='table tablesorter table-condensed table-fixed table-selectable' id='storyList'>
<thead>
<tr class='colhead'>
@@ -71,9 +73,12 @@
<th title='<?php echo $lang->story->bugCount?>' class='w-30px'><?php echo $lang->story->bugCountAB;?></th>
<th title='<?php echo $lang->story->caseCount?>' class='w-30px'><?php echo $lang->story->caseCountAB;?></th>
<th class='w-110px {sorter:false}'> <?php echo $lang->actions;?></th>
<?php if($canOrder):?>
<th class='w-50px {sorter:false}'> <?php common::printOrderLink('order', $orderBy, $vars, $lang->project->updateOrder);?></th>
<?php endif;?>
</tr>
</thead>
<tbody>
<tbody id='storyTableList' class='sortable'>
<?php
$totalEstimate = 0;
$canBatchEdit = common::hasPriv('story', 'batchEdit');
@@ -84,7 +89,7 @@
$storyLink = $this->createLink('story', 'view', "storyID=$story->id&version=$story->version&from=project&param=$project->id");
$totalEstimate += $story->estimate;
?>
<tr class='text-center' id="story<?php echo $story->id?>">
<tr class='text-center' id="story<?php echo $story->id?>" data-id='<?php echo $story->id ?>' data-order='<?php echo $story->order ?>'>
<td class='cell-id'>
<?php if($canBatchEdit or $canBatchClose):?>
<input type='checkbox' name='storyIDList[<?php echo $story->id;?>]' value='<?php echo $story->id;?>' />
@@ -147,12 +152,15 @@
}
?>
</td>
<?php if($canOrder):?>
<td class='sort-handler'><i class='icon-move'></i></td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='12'>
<td colspan='<?php echo $canOrder ? 13 : 12;?>'>
<div class='table-actions clearfix'>
<?php
$storyInfo = sprintf($lang->project->productStories, inlink('linkStory', "project={$project->id}"));
@@ -193,4 +201,6 @@
</table>
</form>
</div>
<?php js::set('projectID', $project->id);?>
<?php js::set('orderBy', $orderBy)?>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -198,8 +198,8 @@ class testreportModel extends model
{
$foundBugs[$bug->id] = $bug;
if($bug->status == 'active' OR $bug->resolvedDate > "$end 23:59:59") $legacyBugs[$bug->id] = $bug;
if($bug->case and !empty($bug->testtask) and in_array($bug->testtask, $taskIdList)) $byCaseNum ++;
}
if($bug->case and !empty($bug->testtask) and in_array($bug->testtask, $taskIdList)) $byCaseNum ++;
}
$severityGroups = $statusGroups = $openedByGroups = $resolvedByGroups = $resolutionGroups = $moduleGroups = $typeGroups = array();
+22
View File
@@ -1793,4 +1793,26 @@ class upgradeModel extends model
return !dao::isError();
}
/**
* Init project story order.
*
* @access public
* @return bool
*/
public function initProjectStoryOrder()
{
$storyGroup = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->orderBy('story_asc')->fetchGroup('project', 'story');
foreach($storyGroup as $projectID => $stories)
{
$order = 1;
foreach($stories as $storyID => $projectStory)
{
$this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('project')->eq($projectID)->andWhere('story')->eq($storyID)->exec();
$order++;
}
}
return true;
}
}