* finish task #1429.

This commit is contained in:
wangyidong
2013-06-25 01:25:26 +00:00
parent 670ec60f6c
commit 776dccf2a2
6 changed files with 87 additions and 90 deletions

View File

@@ -25,5 +25,5 @@ function changeAction(formName, actionName, actionLink)
$(function()
{
if(browseType == 'bysearch') ajaxGetSearchForm();
$(function(){$('.iframe').colorbox({width:900, height:500, iframe:true, transition:'none', onCleanup:function(){parent.location.href=parent.location.href;}});})
loadColorbox('iframe', 'storyList');
})

View File

@@ -10,6 +10,7 @@
* @link http://www.zentao.net
*/
?>
<?php if(isonlybody())die(include './storylist.html.php'); ?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/treeview.html.php';?>
<?php include '../../common/view/colorize.html.php';?>
@@ -53,84 +54,7 @@ var browseType = '<?php echo $browseType;?>';
</td>
<td class='divider <?php echo $treeClass;?>'></td>
<td>
<table class='table-1 fixed colored tablesorter datatable'>
<thead>
<tr class='colhead'>
<?php $vars = "productID=$productID&browseType=$browseType&param=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='w-p30'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th> <?php common::printOrderLink('plan', $orderBy, $vars, $lang->story->planAB);?></th>
<th> <?php common::printOrderLink('source', $orderBy, $vars, $lang->story->source);?></th>
<th> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->assignedToAB);?></th>
<th class='w-hour'><?php common::printOrderLink('estimate', $orderBy, $vars, $lang->story->estimateAB);?></th>
<th> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th> <?php common::printOrderLink('stage', $orderBy, $vars, $lang->story->stageAB);?></th>
<th class='w-140px {sorter:false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($stories as $key => $story):?>
<?php
$viewLink = $this->createLink('story', 'view', "storyID=$story->id");
$canView = common::hasPriv('story', 'view');
?>
<tr class='a-center'>
<td>
<input type='checkbox' name='storyIDList[<?php echo $story->id;?>]' value='<?php echo $story->id;?>' />
<?php if($canView) echo html::a($viewLink, sprintf('%03d', $story->id)); else printf('%03d', $story->id);?>
</td>
<td><span class='<?php echo 'pri' . $lang->story->priList[$story->pri];?>'><?php echo $lang->story->priList[$story->pri]?></span></td>
<td class='a-left' title="<?php echo $story->title?>"><nobr><?php echo html::a($viewLink, $story->title);?></nobr></td>
<td title="<?php echo $story->planTitle?>"><?php echo $story->planTitle;?></td>
<td><?php echo $lang->story->sourceList[$story->source];?></td>
<td><?php echo $users[$story->openedBy];?></td>
<td><?php echo $users[$story->assignedTo];?></td>
<td><?php echo $story->estimate;?></td>
<td class='<?php echo $story->status;?>'><?php echo $lang->story->statusList[$story->status];?></td>
<td><?php echo $lang->story->stageList[$story->stage];?></td>
<td class='a-right'>
<?php
$vars = "story={$story->id}";
common::printIcon('story', 'change', $vars, $story, 'list');
common::printIcon('story', 'review', $vars, $story, 'list');
common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true);
common::printIcon('story', 'edit', $vars, $story, 'list');
common::printIcon('story', 'createCase', "productID=$story->product&module=0&from=&param=0&$vars", $story, 'list', 'createCase');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='11' class='a-right'>
<div class='f-left'>
<?php
if(count($stories))
{
echo html::selectAll() . html::selectReverse();
if(common::hasPriv('story', 'batchEdit'))
{
$actionLink = $this->createLink('story', 'batchEdit', "from=productBrowse&productID=$productID&projectID=0&orderBy=$orderBy");
echo html::commonButton($lang->edit, "onclick=\"changeAction('productStoryForm', 'batchEdit', '$actionLink')\"");
}
if(common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory')
{
$actionLink = $this->createLink('story', 'batchClose', "from=productBrowse&productID=$productID&projectID=0&orderBy=$orderBy");
echo html::commonButton($lang->close, "onclick=\"changeAction('productStoryForm', 'batchClose', '$actionLink')\"");
}
}
echo $summary;
?>
</div>
<?php $pager->show();?>
</td>
</tr>
</tfoot>
</table>
<?php include "./storylist.html.php";?>
</td>
</tr>
</table>

View File

@@ -0,0 +1,79 @@
<?php $_GET['onlybody'] = 'no';?>
<table class='table-1 fixed colored tablesorter datatable' id='storyList'>
<thead>
<tr class='colhead'>
<?php $vars = "productID=$productID&browseType=$browseType&param=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='w-p30'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th> <?php common::printOrderLink('plan', $orderBy, $vars, $lang->story->planAB);?></th>
<th> <?php common::printOrderLink('source', $orderBy, $vars, $lang->story->source);?></th>
<th> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->assignedToAB);?></th>
<th class='w-hour'><?php common::printOrderLink('estimate', $orderBy, $vars, $lang->story->estimateAB);?></th>
<th> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th> <?php common::printOrderLink('stage', $orderBy, $vars, $lang->story->stageAB);?></th>
<th class='w-140px {sorter:false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
<?php foreach($stories as $key => $story):?>
<?php
$viewLink = $this->createLink('story', 'view', "storyID=$story->id");
$canView = common::hasPriv('story', 'view');
?>
<tr class='a-center'>
<td>
<input type='checkbox' name='storyIDList[<?php echo $story->id;?>]' value='<?php echo $story->id;?>' />
<?php if($canView) echo html::a($viewLink, sprintf('%03d', $story->id)); else printf('%03d', $story->id);?>
</td>
<td><span class='<?php echo 'pri' . $lang->story->priList[$story->pri];?>'><?php echo $lang->story->priList[$story->pri]?></span></td>
<td class='a-left' title="<?php echo $story->title?>"><nobr><?php echo html::a($viewLink, $story->title);?></nobr></td>
<td title="<?php echo $story->planTitle?>"><?php echo $story->planTitle;?></td>
<td><?php echo $lang->story->sourceList[$story->source];?></td>
<td><?php echo $users[$story->openedBy];?></td>
<td><?php echo $users[$story->assignedTo];?></td>
<td><?php echo $story->estimate;?></td>
<td class='<?php echo $story->status;?>'><?php echo $lang->story->statusList[$story->status];?></td>
<td><?php echo $lang->story->stageList[$story->stage];?></td>
<td class='a-right'>
<?php
$vars = "story={$story->id}";
common::printIcon('story', 'change', $vars, $story, 'list');
common::printIcon('story', 'review', $vars, $story, 'list');
common::printIcon('story', 'close', $vars, $story, 'list', '', '', 'iframe', true);
common::printIcon('story', 'edit', $vars, $story, 'list');
common::printIcon('story', 'createCase', "productID=$story->product&module=0&from=&param=0&$vars", $story, 'list', 'createCase');
?>
</td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='11' class='a-right'>
<div class='f-left'>
<?php
if(count($stories))
{
echo html::selectAll() . html::selectReverse();
if(common::hasPriv('story', 'batchEdit'))
{
$actionLink = $this->createLink('story', 'batchEdit', "from=productBrowse&productID=$productID&projectID=0&orderBy=$orderBy");
echo html::commonButton($lang->edit, "onclick=\"changeAction('productStoryForm', 'batchEdit', '$actionLink')\"");
}
if(common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory')
{
$actionLink = $this->createLink('story', 'batchClose', "from=productBrowse&productID=$productID&projectID=0&orderBy=$orderBy");
echo html::commonButton($lang->close, "onclick=\"changeAction('productStoryForm', 'batchClose', '$actionLink')\"");
}
}
echo $summary;
?>
</div>
<?php $pager->show();?>
</td>
</tr>
</tfoot>
</table>

View File

@@ -587,6 +587,7 @@ class story extends control
$actionID = $this->action->create('story', $storyID, 'Closed', $this->post->comment, ucfirst($this->post->closedReason));
$this->action->logHistory($actionID, $changes);
$this->sendMail($storyID, $actionID);
if(isonlybody()) die(js::closeColorbox('parent.parent'));
die(js::locate(inlink('view', "storyID=$storyID"), 'parent'));
}

View File

@@ -708,15 +708,13 @@ class storyModel extends model
*/
public function getProductStories($productID = 0, $moduleIds = 0, $status = 'all', $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('t1.*, t2.title as planTitle, t3.verify, t3.spec')
return $this->dao->select('t1.*, t2.title as planTitle')
->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
->leftJoin(TABLE_STORYSPEC)->alias('t3')->on('t1.id = t3.story')
->where('t1.product')->in($productID)
->beginIF(!empty($moduleIds))->andWhere('module')->in($moduleIds)->fi()
->beginIF($status != 'all')->andWhere('status')->in($status)->fi()
->andWhere('t1.deleted')->eq(0)
->andWhere('t3.version=t1.version')
->orderBy($orderBy)->page($pager)->fetchAll();
}
@@ -1027,17 +1025,15 @@ class storyModel extends model
*/
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null)
{
$stories = $this->dao->select('t1.*, t2.title as planTitle, t3.name as productTitle, t4.spec, t4.verify')
$stories = $this->dao->select('t1.*, t2.title as planTitle, t3.name as productTitle')
->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id')
->leftJoin(TABLE_STORYSPEC)->alias('t4')->on('t1.id = t4.story')
->where('t1.deleted')->eq(0)
->beginIF($type == 'assignedTo')->andWhere('assignedTo')->eq($account)->fi()
->beginIF($type == 'openedBy')->andWhere('openedBy')->eq($account)->fi()
->beginIF($type == 'reviewedBy')->andWhere('reviewedBy')->like('%' . $account . '%')->fi()
->beginIF($type == 'closedBy')->andWhere('closedBy')->eq($account)->fi()
->andWhere('t4.version=t1.version')
->orderBy($orderBy)
->page($pager)
->fetchAll();

View File

@@ -834,11 +834,8 @@ function loadColorbox(colorboxClass, replaceID)
onCleanup:function()
{
saveWindowSize();
var link = self.location.href;
var onlybody = config.requestType == 'PATH_INFO' ? "?onlybody=yes" : '&onlybody=yes';
link = link + onlybody;
$.get(link, function(data)
var link = self.location.href;
$.get(link, {onlybody:"yes"}, function(data)
{
$('#' + replaceID).replaceWith(data)
loadColorbox(colorboxClass, replaceID)