* finish task #971.

This commit is contained in:
wangyidong
2012-12-13 06:34:30 +00:00
parent 7b06b0811a
commit 78e6472bb7
9 changed files with 54 additions and 8 deletions
+3 -1
View File
@@ -917,7 +917,9 @@ class bug extends control
}
/* Get bugs. */
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($this->session->bugQueryCondition)->orderBy($orderBy)->fetchAll('id');
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($this->session->bugQueryCondition)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id');
/* Get users, products and projects. */
$users = $this->loadModel('user')->getPairs('noletter');
+4
View File
@@ -35,6 +35,7 @@ $lang->link = 'Link';
$lang->unlink = 'Unlink';
$lang->import = 'Import';
$lang->export = 'Export';
$lang->exportType = 'Exprot Type';
$lang->setFileName = 'Filename:';
$lang->activate = 'Activate';
$lang->submitting = 'Saving...';
@@ -114,6 +115,9 @@ $lang->exportFileTypeList['csv'] = 'csv';
$lang->exportFileTypeList['xml'] = 'xml';
$lang->exportFileTypeList['html'] = 'html';
$lang->exportTypeList['all'] = 'Export ALL';
$lang->exportTypeList['selected'] = 'Export Checked';
/* Support charset. */
$lang->exportEncodeList['gbk'] = 'GBK';
$lang->exportEncodeList['big5'] = 'BIG5';
+4
View File
@@ -35,6 +35,7 @@ $lang->link = '关联';
$lang->unlink = '移除';
$lang->import = '导入';
$lang->export = '导出';
$lang->exportType = '导出类型';
$lang->setFileName = '文件名:';
$lang->activate = '激活';
$lang->submitting = '稍候...';
@@ -114,6 +115,9 @@ $lang->exportFileTypeList['csv'] = 'csv';
$lang->exportFileTypeList['xml'] = 'xml';
$lang->exportFileTypeList['html'] = 'html';
$lang->exportTypeList['all'] = '导出全部';
$lang->exportTypeList['selected'] = '导出选中';
/* 支持的编码格式。*/
$lang->exportEncodeList['gbk'] = 'GBK';
$lang->exportEncodeList['big5'] = 'BIG5';
+1
View File
@@ -49,6 +49,7 @@ function switchEncode(fileType)
<caption><?php echo $lang->export;?></caption>
<tr>
<td class='a-center'>
<?php echo '<p>' . $lang->exportType . ':' . html::radio('exportType', $lang->exportTypeList, ($this->cookie->checkedItem) ? 'selected' : 'all') . '</p>'?>
<?php echo $lang->setFileName;?>
<?php echo html::input('fileName', '', 'size=15');?>
<?php echo html::select('fileType', $lang->exportFileTypeList, '', 'onchange=switchEncode(this.value)');?>
+4 -2
View File
@@ -866,11 +866,13 @@ class story extends control
$stories = array();
if($this->session->storyOnlyCondition == 'true')
{
$stories = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyQueryCondition)->orderBy($orderBy)->fetchAll('id', false);
$stories = $this->dao->select('*')->from(TABLE_STORY)->where($this->session->storyQueryCondition)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id', false);
}
else
{
$stmt = $this->dbh->query($this->session->storyQueryCondition . " ORDER BY " . strtr($orderBy, '_', ' '));
$stmt = $this->dbh->query($this->session->storyQueryCondition . ($this->post->exportType == 'selected' ? " AND id IN({$this->cookie->checkedItem})" : '') . " ORDER BY " . strtr($orderBy, '_', ' '));
while($row = $stmt->fetch()) $stories[$row->id] = $row;
}
+3 -1
View File
@@ -770,7 +770,9 @@ class task extends control
}
/* Get tasks. */
$tasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($this->session->taskQueryCondition)->orderBy($orderBy)->fetchAll('id');
$tasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($this->session->taskQueryCondition)
->beginIF($this->post->exportType == 'selected')->andWhere('t1.id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id');
/* Get users and projects. */
$users = $this->loadModel('user')->getPairs('noletter');
+7 -2
View File
@@ -533,11 +533,15 @@ class testcase extends control
if($taskID)
{
$caseIDList = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs();
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)->andWhere('id')->in($caseIDList)->orderBy($orderBy)->fetchAll('id');
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)->andWhere('id')->in($caseIDList)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id');
}
else
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)->orderBy($orderBy)->fetchAll('id');
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($this->session->testcaseQueryCondition)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id');
}
}
else
@@ -548,6 +552,7 @@ class testcase extends control
while($row = $stmt->fetch())
{
$caseID = isset($row->case) ? $row->case : $row->id;
if($this->post->exportType == 'selected' and strpos(",{$this->cookie->checkedItem},", ",$caseID,") === false) continue;
$cases[$caseID] = $row;
$row->id = $caseID;
}
+4 -2
View File
@@ -331,7 +331,9 @@ class todo extends control
unset($fields['private']);
/* Get bugs. */
$todos = $this->dao->select('*')->from(TABLE_TODO)->where($this->session->todoReportCondition)->orderBy($orderBy)->fetchAll('id');
$todos = $this->dao->select('*')->from(TABLE_TODO)->where($this->session->todoReportCondition)
->beginIF($this->post->exportType == 'selected')->andWhere('id')->in($this->cookie->checkedItem)->fi()
->orderBy($orderBy)->fetchAll('id');
/* Get users, bugs, tasks and times. */
$users = $this->loadModel('user')->getPairs('noletter');
@@ -347,7 +349,7 @@ class todo extends control
if(isset($times[$todo->end])) $todo->end = $times[$todo->end];
if($todo->type == 'bug') $todo->name = isset($bugs[$todo->idvalue]) ? $bugs[$todo->idvalue] : '';
if($todo->type == 'task') $todo->name = isset($tasks[$todo->idvalue]) ? $tasks[$todo->idvalue] : '';
if(isset($todoLang->typeList->{$todo->type})) $todo->type = $todoLang->typeList->{$todo->type};
if(isset($todoLang->typeList[$todo->type])) $todo->type = $todoLang->typeList[$todo->type];
if(isset($todoLang->priList[$todo->pri])) $todo->pri = $todoLang->priList[$todo->pri];
if(isset($todoLang->statusList[$todo->status])) $todo->status = $todoLang->statusList[$todo->status];
if($todo->private == 1) $todo->desc = $this->lang->todo->thisIsPrivate;
+24
View File
@@ -796,6 +796,29 @@ function selectItem(SelectID)
}
}
/**
* Save checked item to cookie when click a object.
*
* @param string $obj
* @access public
* @return void
*/
function getCheckedItem(obj)
{
$(obj).click(function(){
var checkeds = '';
$(':checkbox').each(function(){
if($(this).attr('checked'))
{
var checkedVal = parseInt($(this).val());
if(checkedVal != 0) checkeds = checkeds + checkedVal + ',';
}
})
if(checkeds != '') checkeds = checkeds.substring(0, checkeds.length - 1);
$.cookie('checkedItem', checkeds, {expires:config.cookieLife, path:config.webRoot});
})
}
/* Ping the server every some minutes to keep the session. */
needPing = true;
@@ -819,6 +842,7 @@ $(document).ready(function()
togglesearch();
saveWindowSize();
loadFixedCSS();
getCheckedItem('.export');
$(window).resize(function(){saveWindowSize()}); // When window resized, call it again.
if(needPing) setTimeout('setPing()', 1000 * 60); // After 5 minutes, begin ping.
});