* Finish task#859.

This commit is contained in:
chencongzhi520@gmail.com
2012-06-15 06:31:38 +00:00
parent 2bfe07e3a0
commit 32f8d985c0
7 changed files with 152 additions and 46 deletions
+4 -3
View File
@@ -1550,11 +1550,12 @@ INSERT INTO `zt_groupPriv` (`company`, `group`, `module`, `method`) VALUES
(1, 5, 'my', 'changePassword'),
(1, 1, 'story', 'batchClose'),
(1, 2, 'story', 'batchClose'),
(1, 3, 'story', 'batchClose'),
(1, 4, 'story', 'batchClose'),
(1, 5, 'story', 'batchClose'),
(1, 1, 'task', 'batchEdit'),
(1, 2, 'task', 'batchEdit'),
(1, 3, 'task', 'batchEdit'),
(1, 4, 'task', 'batchEdit'),
(1, 5, 'task', 'batchEdit');
(1, 5, 'task', 'batchEdit'),
(1, 1, 'release', 'exportStoriesAndBugs'),
(1, 2, 'release', 'exportStoriesAndBugs'),
(1, 5, 'release', 'exportStoriesAndBugs');
+2
View File
@@ -85,6 +85,7 @@ $lang->resource->release->edit = 'edit';
$lang->resource->release->delete = 'delete';
$lang->resource->release->view = 'view';
$lang->resource->release->ajaxGetStoriesAndBugs = 'ajaxGetStoriesAndBugs';
$lang->resource->release->exportStoriesAndBugs = 'exportStoriesAndBugs';
/* Project. */
$lang->resource->project->index = 'index';
@@ -374,3 +375,4 @@ $lang->changelog['3.1'][] = 'todo-batchCreate';
$lang->changelog['3.2'][] = 'my-changePassword';
$lang->changelog['3.2'][] = 'story-batchClose';
$lang->changelog['3.2'][] = 'task-batchEdit';
$lang->changelog['3.2'][] = 'release-exportStoriesAndBugs';
+50
View File
@@ -195,4 +195,54 @@ class release extends control
$this->view->orderBy = $orderBy;
die($this->display());
}
/**
* Export the stories of release to HTML.
*
* @param string $type story | bug
* @access public
* @return void
*/
public function exportStoriesAndBugs($type)
{
if(!empty($_POST))
{
if($type == 'story')
{
$this->loadModel('story');
$stories = $this->dao->select('id, title')->from(TABLE_STORY)->where($this->session->storyQueryCondition)
->beginIF($this->session->storyOrderBy != false)->orderBy($this->session->storyOrderBy)->fi()
->fetchAll('id');
foreach($stories as $story)
{
$story->title = "<a href='" . common::getSysURL() . $this->createLink('story', 'view', "storyID=$story->id") . "' target='_blank'>$story->title</a>";
}
$this->post->set('fields', array('id' => $this->lang->story->id, 'title' => $this->lang->story->title));
$this->post->set('rows', $stories);
$this->fetch('file', 'export2HTML', $_POST);
}
else if($type == 'bug')
{
$this->loadModel('bug');
$bugs = $this->dao->select('id, title')->from(TABLE_BUG)->where($this->session->bugQueryCondition)
->beginIF($this->session->bugOrderBy != false)->orderBy($this->session->bugOrderBy)->fi()
->fetchAll('id');
foreach($bugs as $bug)
{
$bug->title = "<a href='" . common::getSysURL() . $this->createLink('bug', 'view', "bugID=$bug->id") . "' target='_blank'>$bug->title</a>";
}
$this->post->set('fields', array('id' => $this->lang->bug->id, 'title' => $this->lang->bug->title));
$this->post->set('rows', $bugs);
$this->fetch('file', 'export2HTML', $_POST);
}
}
$this->display();
}
}
+1
View File
@@ -34,3 +34,4 @@ $lang->release->bugs = 'Linked bugs';
$lang->release->ajaxGetStoriesAndBugs = 'API: Get storeis and bugs';
$lang->release->finishStories = 'The total demand for a complete %s';
$lang->release->resolvedBugs = 'The total solution of bug%s';
$lang->release->exportStoriesAndBugs = 'Export as HTML';
+1
View File
@@ -35,3 +35,4 @@ $lang->release->bugs = '已关联Bugs';
$lang->release->ajaxGetStoriesAndBugs = '接口:获得需求和Bug';
$lang->release->finishStories = '本次共完成需求%s个';
$lang->release->resolvedBugs = '本次共解决Bug%s个';
$lang->release->exportStoriesAndBugs = '导出HTML';
+49
View File
@@ -0,0 +1,49 @@
<?php
/**
* The export stories or bugs to html view file of release module of ZenTaoPMS.
*
* @copyright Copyright 2009-2012 青岛易软天创网络科技有限公司 (QingDao Nature Easy Soft Network Technology Co,LTD www.cnezsoft.com)
* @license LGPL (http://www.gnu.org/licenses/lgpl.html)
* @author Congzhi Chen <congzhi@cnezsoft.com>
* @package file
* @version $Id$
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<?php include '../../common/view/colorbox.html.php';?>
<script>
function setDownloading()
{
if($.browser.opera) return true; // Opera don't support, omit it.
$.cookie('downloading', 0);
time = setInterval("closeWindow()", 300);
return true;
}
function closeWindow()
{
if($.cookie('downloading') == 1 || i >= 30)
{
parent.$.fn.colorbox.close();
$.cookie('downloading', null);
clearInterval(time);
}
i ++;
}
</script>
<br /><br />
<form method='post' target='hiddenwin' onsubmit='setDownloading();'>
<table class='table-1'>
<caption><?php echo $lang->export;?></caption>
<tr>
<td class='a-center'>
<?php echo $lang->setFileName;?>
<?php echo html::input('fileName', '', 'size=15') . ".html";?>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.lite.html.php';?>
+45 -43
View File
@@ -20,19 +20,22 @@
<div class='content'><?php echo $release->desc;?></div>
</fieldset>
<?php include '../../common/view/action.html.php';?>
<div class='a-center f-16px strong'>
<?php
$browseLink = $this->session->releaseList ? $this->session->releaseList : inlink('browse', "productID=$release->product");
if(!$release->deleted)
{
common::printLink('release', 'edit', "releaseID=$release->id", $lang->edit);
common::printLink('release', 'delete', "releaseID=$release->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
?>
</div>
<table class='table-1 fixed'>
<caption class='caption-t1'><?php echo $lang->release->stories;?></caption>
<div class='a-center f-16px strong'>
<?php
$browseLink = $this->session->releaseList ? $this->session->releaseList : inlink('browse', "productID=$release->product");
if(!$release->deleted)
{
common::printLink('release', 'edit', "releaseID=$release->id", $lang->edit);
common::printLink('release', 'delete', "releaseID=$release->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
?>
</div>
<table class='table-1 fixed'>
<caption class='caption-t1'>
<?php echo $lang->release->stories;?>
<div class='f-right'><?php if(count($stories)) common::printLink('release', 'exportStoriesAndBugs', 'type=story', $lang->release->exportStoriesAndBugs, '', "class='export'");?></div>
</caption>
<tr>
<th class='w-id'><?php echo $lang->idAB;?></th>
<th class='w-pri'><?php echo $lang->priAB;?></th>
@@ -54,12 +57,13 @@
<td><?php echo $lang->story->stageList[$story->stage];?></td>
</tr>
<?php endforeach;?>
<tr>
<td colspan="7" class='a-left strong'><?php echo sprintf($lang->release->finishStories, count($stories));?></td>
</tr>
<tr><td colspan="7" class='a-left strong'><?php echo sprintf($lang->release->finishStories, count($stories));?></td></tr>
</table>
<table class='table-1 fixed'>
<caption class='caption-t1'><?php echo $lang->release->bugs;?></caption>
<caption class='caption-t1'>
<?php echo $lang->release->bugs;?>
<div class='f-right'><?php if(count($bugs)) common::printLink('release', 'exportStoriesAndBugs', 'type=bug', $lang->release->exportStoriesAndBugs, '', "class='export'");?></div>
</caption>
<tr>
<th class='w-id'> <?php echo $lang->idAB;?></th>
<th><?php echo $lang->bug->title;?></th>
@@ -81,35 +85,33 @@
<td><?php echo substr($bug->resolvedDate, 5, 11)?></td>
</tr>
<?php endforeach;?>
<tr><td colspan="7" class='a-left strong'><?php echo sprintf($lang->release->resolvedBugs, count($bugs));?></td></tr>
</table>
</td>
<td class="divider"></td>
<td class="side">
<fieldset>
<legend><?php echo $lang->release->basicInfo?></legend>
<table class='table-1 a-left'>
<tr>
<td colspan="7" class='a-left strong'><?php echo sprintf($lang->release->resolvedBugs, count($bugs));?></td>
<th width='25%' class='a-right'><?php echo $lang->release->product;?></th>
<td><?php echo $release->productName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->name;?></th>
<td class='<?php if($release->deleted) echo 'deleted';?>'><?php echo $release->name;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->build;?></th>
<td><?php echo $release->buildName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->date;?></th>
<td><?php echo $release->date;?></td>
</tr>
</table>
</td>
<td class="divider"></td>
<td class="side">
<fieldset>
<legend><?php echo $lang->release->basicInfo?></legend>
<table class='table-1 a-left'>
<tr>
<th width='25%' class='a-right'><?php echo $lang->release->product;?></th>
<td><?php echo $release->productName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->name;?></th>
<td class='<?php if($release->deleted) echo 'deleted';?>'><?php echo $release->name;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->build;?></th>
<td><?php echo $release->buildName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->release->date;?></th>
<td><?php echo $release->date;?></td>
</fieldset>
</td>
</tr>
</table>
</fieldset>
</td>
</tr>
</table>
<?php include '../../common/view/footer.html.php';?>