* finish task #3289.

This commit is contained in:
wangyidong
2017-11-02 14:28:02 +08:00
parent 5c1ef6e4f2
commit 99bd7ed909
6 changed files with 33 additions and 28 deletions
+5 -11
View File
@@ -530,7 +530,7 @@ class project extends control
* @access public
* @return void
*/
public function story($projectID = 0, $orderBy = 'order', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
public function story($projectID = 0, $orderBy = 'order_desc', $type = 'byModule', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
{
/* Load these models. */
$this->loadModel('story');
@@ -2010,17 +2010,11 @@ class project extends control
$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)
$order = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('story')->in($idList)->andWhere('project')->eq($projectID)->orderBy('order_asc')->fetch('order');
foreach($idList as $storyID)
{
$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();
$this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('story')->eq($storyID)->andWhere('project')->eq($projectID)->exec();
$order++;
}
}
+8 -1
View File
@@ -6,7 +6,14 @@ $(function()
{
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});
$.post(createLink('project', 'storySort', 'projectID=' + projectID), {'storys' : list, 'orderBy' : orderBy}, function()
{
var $target = $(data.element[0]);
$target.hide();
$target.fadeIn(1000);
order = 'order_asc'
history.pushState({}, 0, createLink('project', 'story', "projectID=" + projectID + '&orderBy=' + order));
});
});
fixedTfootAction('#projectStoryForm');
+1
View File
@@ -2314,6 +2314,7 @@ class projectModel extends model
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->where('t1.project')->eq((int)$projectID)
->andWhere('t2.deleted')->eq(0)
->orderBy('t1.`order`_desc')
->fetchAll();
$storyGroups = array();
foreach($stories as $story) $storyGroups[$story->product][$story->module][$story->id] = $story;
+6 -6
View File
@@ -64,6 +64,9 @@
<tr class='colhead'>
<?php $vars = "projectID={$project->id}&orderBy=%s&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<th class='w-id {sorter:false}'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<?php if($canOrder):?>
<th class='w-50px {sorter:false}'> <?php common::printOrderLink('order', $orderBy, $vars, $lang->project->updateOrder);?></th>
<?php endif;?>
<th class='w-pri {sorter:false}'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='{sorter:false}'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th class='w-user {sorter:false}'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
@@ -75,9 +78,6 @@
<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 id='storyTableList' class='sortable'>
@@ -98,6 +98,9 @@
<?php endif;?>
<?php echo html::a($storyLink, sprintf('%03d', $story->id));?>
</td>
<?php if($canOrder):?>
<td class='sort-handler'><i class='icon-move'></i></td>
<?php endif;?>
<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 class='text-left' title="<?php echo $story->title?>">
<?php if(isset($branchGroups[$story->product][$story->branch])) echo "<span class='label label-info label-badge'>" . $branchGroups[$story->product][$story->branch] . '</span>';?>
@@ -154,9 +157,6 @@
}
?>
</td>
<?php if($canOrder):?>
<td class='sort-handler'><i class='icon-move'></i></td>
<?php endif;?>
</tr>
<?php endforeach;?>
</tbody>
+3 -2
View File
@@ -40,7 +40,7 @@ class storyModel extends model
$story->projects = $this->dao->select('t1.project, t2.name, t2.status')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.story')->eq($storyID)
->orderBy('t1.project DESC')
->orderBy('t1.`order` DESC')
->fetchAll('project');
$story->tasks = $this->dao->select('id, name, assignedTo, project, status, consumed, `left`')->from(TABLE_TASK)->where('story')->eq($storyID)->andWhere('deleted')->eq(0)->orderBy('id DESC')->fetchGroup('project');
$story->stages = $this->dao->select('*')->from(TABLE_STORYSTAGE)->where('story')->eq($storyID)->fetchPairs('branch', 'stage');
@@ -1574,7 +1574,7 @@ class storyModel extends model
* @access public
* @return array
*/
public function getProjectStories($projectID = 0, $orderBy = 'pri_asc,id_desc', $type = 'byModule', $param = 0, $pager = null)
public function getProjectStories($projectID = 0, $orderBy = 't1.`order`_desc', $type = 'byModule', $param = 0, $pager = null)
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectStories();
@@ -1667,6 +1667,7 @@ class storyModel extends model
->beginIF($productID)->andWhere('t2.product')->eq((int)$productID)->fi()
->beginIF($branch)->andWhere('t2.branch')->in("0,$branch")->fi()
->beginIF($moduleIdList)->andWhere('t2.module')->in($moduleIdList)->fi()
->orderBy('t1.`order` desc')
->fetchAll();
if(!$stories) return array();
return $this->formatStories($stories, $type);
+10 -8
View File
@@ -110,6 +110,7 @@ class tutorialModel extends model
$story->duplicateStory = 0;
$story->version = 1;
$story->deleted = '0';
$story->order = '0';
$stories = array();
$stories[] = $story;
@@ -202,14 +203,15 @@ class tutorialModel extends model
public function getTeamMembers()
{
$member = new stdclass();
$member->project = 1;
$member->account = $this->app->user->account;
$member->role = $this->app->user->role;
$member->join = $this->app->user->join;
$member->days = 10;
$member->hours = 7.0;
$member->totalHours = 70.0;
$member->realname = $this->app->user->realname;
$member->project = 1;
$member->account = $this->app->user->account;
$member->role = $this->app->user->role;
$member->join = $this->app->user->join;
$member->days = 10;
$member->hours = 7.0;
$member->totalHours = 70.0;
$member->realname = $this->app->user->realname;
$member->limitedUser = 0;
return array($member->account => $member);
}