* adjust code.

This commit is contained in:
wangyidong
2017-03-17 10:46:12 +08:00
parent e61a36a9e0
commit 41965a24b4
13 changed files with 86 additions and 58 deletions
+33
View File
@@ -397,6 +397,39 @@ class blockModel extends model
return $this->getListParams($module);
}
/**
* Get closed block pairs.
*
* @param string $closedBlock
* @access public
* @return array
*/
public function getClosedBlockPairs($closedBlock)
{
$blockPairs = array();
if(empty($closedBlock)) return $blockPairs;
foreach(explode(',', $closedBlock) as $block)
{
$block = trim($block);
if(empty($block)) continue;
list($moduleName, $blockKey) = explode('|', $block);
if(empty($moduleName))
{
if($blockKey == 'html') $blockPairs[$block] = 'HTML';
if($blockKey == 'flowchart') $blockPairs[$block] = $this->lang->block->lblFlowchart;
if($blockKey == 'dynamic') $blockPairs[$block] = $this->lang->block->dynamic;
}
else
{
$blockPairs[$block] = "{$this->lang->block->moduleList[$moduleName]}|{$this->lang->block->modules[$moduleName]->availableBlocks->$blockKey}";
}
}
return $blockPairs;
}
/**
* Build number params.
*
+2 -2
View File
@@ -429,8 +429,8 @@ $lang->pager->locate = "GO!";
$lang->proVersion = "<a href='http://api.zentao.net/goto.php?item=proversion&from=footer' target='_blank' id='proLink' class='text-important'>ZenTao Pro <i class='text-danger icon-pro-version'></i></a> &nbsp; ";
$lang->downNotify = "Download Desktop Notification";
$lang->suhosinInfo = "Warning! Data is reaching the limit. Please change <font color=red>sohusin.post.max_vars</font> and <font color=red>sohusin.request.max_vars</font> (set larger value) in php.ini, then save and restart Apache, or some data will not be saved.";
$lang->maxVarsInfo = "Warning! Data is reaching the limit. Please change <font color=red>max_input_vars</font> (set larger value) in php.ini, then save and restart Apache, or some data will not be saved.";
$lang->suhosinInfo = "Warning! Data is reaching the limit. Please change <font color=red>sohusin.post.max_vars</font> and <font color=red>sohusin.request.max_vars</font> (set larger value) in php.ini, then save and restart Apache or php-fpm, or some data will not be saved.";
$lang->maxVarsInfo = "Warning! Data is reaching the limit. Please change <font color=red>max_input_vars</font> (set larger value) in php.ini, then save and restart Apache or php-fpm, or some data will not be saved.";
$lang->pasteTextInfo = "Paste text into text field. Each line will be a header of each data record. ";
$lang->noticeImport = "<p style='font-size:14px'>Imported data contains data that has already existed in system. Please confirm you actions on the date </p><p><a href='javascript:submitForm(\"cover\")' class='btn btn-mini'>Override</a> <a href='javascript:submitForm(\"insert\")' class='btn btn-mini'>New Insertion</a></p>";
+2 -2
View File
@@ -430,8 +430,8 @@ $lang->pager->locate = "GO!";
$lang->proVersion = "<a href='http://api.zentao.net/goto.php?item=proversion&from=footer' target='_blank' id='proLink' class='text-important'>专业版 <i class='text-danger icon-pro-version'></i></a> &nbsp; ";
$lang->downNotify = "下载桌面提醒";
$lang->suhosinInfo = "警告:数据太多,请在php.ini中修改<font color=red>sohusin.post.max_vars</font>和<font color=red>sohusin.request.max_vars</font>(设置更大的数)。 保存并重新启动apache,否则会造成部分数据无法保存。";
$lang->maxVarsInfo = "警告:数据太多,请在php.ini中修改<font color=red>max_input_vars</font>(设置更大的数)。 保存并重新启动apache,否则会造成部分数据无法保存。";
$lang->suhosinInfo = "警告:数据太多,请在php.ini中修改<font color=red>sohusin.post.max_vars</font>和<font color=red>sohusin.request.max_vars</font>(设置更大的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->maxVarsInfo = "警告:数据太多,请在php.ini中修改<font color=red>max_input_vars</font>(设置更大的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->pasteTextInfo = "粘贴文本到文本域中,每行文字作为一条数据的标题。";
$lang->noticeImport = "<p style='font-size:14px'>导入数据中,含有已经存在系统的数据,请确认这些数据要覆盖或者全新插入</p><p><a href='javascript:submitForm(\"cover\")' class='btn btn-mini'>覆盖</a> <a href='javascript:submitForm(\"insert\")' class='btn btn-mini'>全新插入</a></p>";
+1
View File
@@ -7,3 +7,4 @@ $config->custom->canAdd['testcase'] = 'priList,typeList,stageList,resultList,sta
$config->custom->canAdd['testtask'] = 'priList';
$config->custom->canAdd['todo'] = 'priList,typeList';
$config->custom->canAdd['user'] = 'roleList';
$config->custom->canAdd['block'] = '';
+11 -26
View File
@@ -34,6 +34,7 @@ class custom extends control
public function set($module = 'story', $field = 'priList', $lang = 'zh_cn')
{
if($module == 'user' and $field == 'priList') $field = 'roleList';
if($module == 'block' and $field == 'priList')$field = 'closed';
$currentLang = $this->app->getClientLang();
$this->app->loadLang($module);
@@ -45,65 +46,49 @@ class custom extends control
unset($fieldList['newfeature']);
unset($fieldList['trackthings']);
}
if(($module == 'story' || $module == 'testcase') && $field == 'review')
if(($module == 'story' or $module == 'testcase') and $field == 'review')
{
$this->app->loadConfig($module);
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed');
$this->view->needReview = zget($this->config->$module, 'needReview', 1);
$this->view->forceReview = zget($this->config->$module, 'forceReview', '');
}
if($module == 'task' && $field == 'hours')
if($module == 'task' and $field == 'hours')
{
$this->app->loadConfig('project');
$this->view->weekend = $this->config->project->weekend;
$this->view->workhours = $this->config->project->defaultWorkhours;
}
if($module == 'bug' && $field == 'longlife')
if($module == 'bug' and $field == 'longlife')
{
$this->app->loadConfig('bug');
$this->view->longlife = $this->config->bug->longlife;
}
if($module == 'user' && $field == 'closedBlock')
if($module == 'block' and $field == 'closed')
{
$this->loadModel('block');
$closedBlock = isset($this->config->block->closed) ? $this->config->block->closed : '';
$blockPairs = array();
foreach(explode(',', $closedBlock) as $block)
{
$block = trim($block);
if(empty($block)) continue;
list($moduleName, $blockKey) = explode('|', $block);
if(empty($moduleName))
{
if($blockKey == 'html') $blockPairs[$block] = 'HTML';
if($blockKey == 'flowchart') $blockPairs[$block] = $this->lang->block->lblFlowchart;
if($blockKey == 'dynamic') $blockPairs[$block] = $this->lang->block->dynamic;
}
else
{
$blockPairs[$block] = "{$this->lang->block->moduleList[$moduleName]}|{$this->lang->block->modules[$moduleName]->availableBlocks->$blockKey}";
}
}
$this->view->blockPairs = $this->block->getClosedBlockPairs($closedBlock);
$this->view->closedBlock = $closedBlock;
$this->view->blockPairs = $blockPairs;
}
if(!empty($_POST))
{
if(($module == 'story' || $module == 'testcase') && $field == 'review')
if(($module == 'story' or $module == 'testcase') and $field == 'review')
{
$data = fixer::input('post')->join('forceReview', ',')->get();
$this->loadModel('setting')->setItems("system.$module", $data);
}
elseif($module == 'task' && $field == 'hours')
elseif($module == 'task' and $field == 'hours')
{
$this->loadModel('setting')->setItems('system.project', fixer::input('post')->get());
}
elseif($module == 'bug' && $field == 'longlife')
elseif($module == 'bug' and $field == 'longlife')
{
$this->loadModel('setting')->setItems('system.bug', fixer::input('post')->get());
}
elseif($module == 'user' && $field == 'closedBlock')
elseif($module == 'block' and $field == 'closed')
{
$this->loadModel('setting')->setItems('system.block', fixer::input('post')->join('closed', ',')->get());
}
+1 -1
View File
@@ -73,7 +73,7 @@ $lang->custom->confirmRestore = 'Do you want to reset to Default?';
$lang->custom->notice = new stdclass();
$lang->custom->notice->userRole = 'Key must be no more than 20 characters!';
$lang->custom->notice->canNotAdd = 'This item will be processed, so customized feature is not enabled.';
$lang->custom->notice->forceReview = 'Review is required for stories submitted by certain assignee.';
$lang->custom->notice->forceReview = 'Review is required for %s submitted by certain assignee.';
$lang->custom->notice->longlife = 'List "Undone" bugs that are older than hold days from "Longlife" bugs.';
$lang->custom->notice->priListKey = 'Priority list key should be numbers!';
$lang->custom->notice->severityListKey = 'Bug severity list key should be numbers.';
+6 -4
View File
@@ -16,6 +16,7 @@ $lang->custom->object['testcase'] = '用例';
$lang->custom->object['testtask'] = '版本';
$lang->custom->object['todo'] = '待办';
$lang->custom->object['user'] = '用户';
$lang->custom->object['block'] = '区块';
$lang->custom->story = new stdClass();
$lang->custom->story->fields['priList'] = '优先级';
@@ -61,9 +62,10 @@ $lang->custom->todo->fields['typeList'] = '类型';
$lang->custom->todo->fields['statusList'] = '状态';
$lang->custom->user = new stdClass();
$lang->custom->user->fields['roleList'] = '职位';
$lang->custom->user->fields['statusList'] = '状态';
$lang->custom->user->fields['closedBlock'] = '关闭的区块';
$lang->custom->user->fields['roleList'] = '职位';
$lang->custom->user->fields['statusList'] = '状态';
$lang->custom->block->fields['closed'] = '关闭的区块';
$lang->custom->currentLang = '适用当前语言';
$lang->custom->allLang = '适用所有语言';
@@ -73,7 +75,7 @@ $lang->custom->confirmRestore = '是否要恢复默认配置?';
$lang->custom->notice = new stdclass();
$lang->custom->notice->userRole = '键的长度必须小于20个字符!';
$lang->custom->notice->canNotAdd = '该项参与运算,不提供自定义添加功能';
$lang->custom->notice->forceReview = '指定人提交的需求必须评审。';
$lang->custom->notice->forceReview = "指定人提交的%s必须评审。";
$lang->custom->notice->longlife = 'Bug列表页面的久未处理标签中,列出设置天数之前未处理的Bug。';
$lang->custom->notice->priListKey = '优先级的键应当为数字!';
$lang->custom->notice->severityListKey = 'Bug严重程度的键应当为数字!';
+4 -4
View File
@@ -62,7 +62,7 @@ EOT;
<div class='panel-heading'>
<strong><?php echo $lang->custom->object[$module] . $lang->arrow . $lang->custom->$module->fields[$field]?></strong>
</div>
<?php if(($module == 'story' ||$module == 'testcase') and $field == 'review'):?>
<?php if(($module == 'story' or $module == 'testcase') and $field == 'review'):?>
<table class='table table-form mw-800px'>
<tr>
<th class='w-80px'><?php echo $lang->custom->storyReview;?></th>
@@ -72,7 +72,7 @@ EOT;
<tr>
<th><?php echo $lang->custom->forceReview;?></th>
<td><?php echo html::select('forceReview[]', $users, $forceReview, "class='form-control chosen' multiple");?></td>
<td class='w-180px'><?php echo $lang->custom->notice->forceReview;?></td>
<td class='w-180px'><?php printf($lang->custom->notice->forceReview, $lang->$module->common);?></td>
</tr>
<tr>
<td></td>
@@ -109,10 +109,10 @@ EOT;
</tr>
</table>
<div class='alert alert-info alert-block'><?php echo $lang->custom->notice->longlife;?></div>
<?php elseif($module == 'user' and $field == 'closedBlock'):?>
<?php elseif($module == 'block' and $field == 'closed'):?>
<table class='table table-form mw-600px'>
<tr>
<th class='w-100px'><?php echo $lang->custom->user->fields['closedBlock'];?></th>
<th class='w-100px'><?php echo $lang->custom->block->fields['closed'];?></th>
<td><?php echo html::select('closed[]', $blockPairs, $closedBlock, "class='form-control chosen' multiple");?></td>
</tr>
<tr>
+8 -8
View File
@@ -106,16 +106,16 @@
$storyTasks[$story->id] > 0 ? print(html::a($tasksLink, $storyTasks[$story->id], '', 'class="iframe"')) : print(0);
?>
<td>
<?php
$bugsLink = $this->createLink('story', 'bugs', "storyID=$story->id&projectID=$project->id");
$storyBugs[$story->id] > 0 ? print(html::a($bugsLink, $storyBugs[$story->id], '', 'class="iframe"')) : print(0);
?>
<?php
$bugsLink = $this->createLink('story', 'bugs', "storyID=$story->id&projectID=$project->id");
$storyBugs[$story->id] > 0 ? print(html::a($bugsLink, $storyBugs[$story->id], '', 'class="iframe"')) : print(0);
?>
</td>
<td>
<?php
$casesLink = $this->createLink('story', 'cases', "storyID=$story->id&projectID=$project->id");
$storyCases[$story->id] > 0 ? print(html::a($casesLink, $storyCases[$story->id], '', 'class="iframe"')) : print(0);
?>
<?php
$casesLink = $this->createLink('story', 'cases', "storyID=$story->id&projectID=$project->id");
$storyCases[$story->id] > 0 ? print(html::a($casesLink, $storyCases[$story->id], '', 'class="iframe"')) : print(0);
?>
</td>
<td>
<?php
+1 -1
View File
@@ -35,7 +35,7 @@
<th class='w-100px'><?php echo $lang->testtask->begin;?></th>
<th class='w-100px'><?php echo $lang->testtask->end;?></th>
<th class='w-80px'><?php echo $lang->statusAB;?></th>
<th class='w-120px'><?php echo $lang->actions;?></th>
<th class='w-120px {sorter:false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>
+1 -1
View File
@@ -1585,7 +1585,7 @@ class storyModel extends model
}
}
$allProduct = "`product` = 'all'";
$allProduct = "`product` = 'all'";
$storyQuery = $this->session->projectStoryQuery;
if(strpos($this->session->projectStoryQuery, $allProduct) !== false)
{
+7
View File
@@ -51,6 +51,13 @@ function loadLinkCases(caseID)
$('#linkCaseBox').load(caseLink);
}
/**
* Load lib modules.
*
* @param int $libID
* @access public
* @return void
*/
function loadLibModules(libID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=html&needManage=true');
+9 -9
View File
@@ -45,7 +45,7 @@ class testcaseModel extends model
$case = fixer::input('post')
->add('openedBy', $this->app->user->account)
->add('openedDate', $now)
->add('status', $this->isForceReview() ? 'wait' : 'normal')
->add('status', $this->forceReview() ? 'wait' : 'normal')
->add('version', 1)
->add('fromBug', $bugID)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story))
@@ -127,7 +127,7 @@ class testcaseModel extends model
$this->loadModel('story');
$storyVersions = array();
$isForceReview = $this->isForceReview();
$forceReview = $this->forceReview();
for($i = 0; $i < $batchNum; $i++)
{
if($cases->type[$i] != '' and $cases->title[$i] != '')
@@ -146,7 +146,7 @@ class testcaseModel extends model
$data[$i]->keywords = $cases->keywords[$i];
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->status = $isForceReview ? 'wait' : 'normal';
$data[$i]->status = $forceReview ? 'wait' : 'normal';
$data[$i]->version = 1;
$caseStory = $data[$i]->story;
@@ -518,7 +518,7 @@ class testcaseModel extends model
->join('stage', ',')
->remove('comment,steps,expects,files,labels,stepType')
->get();
if($this->isForceReview() and $stepChanged) $case->status = 'wait';
if($this->forceReview() and $stepChanged) $case->status = 'wait';
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec();
if(!$this->dao->isError())
{
@@ -721,7 +721,7 @@ class testcaseModel extends model
if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3;
if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0;
if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : '';
if($data->stories[$caseID] == '') $data->stories[$caseID] = 0;
if($data->stories[$caseID] == '') $data->stories[$caseID] = 0;
$prev['pri'] = $data->pris[$caseID];
$prev['module'] = $data->modules[$caseID];
@@ -929,7 +929,7 @@ class testcaseModel extends model
$cases[$key] =$caseData;
}
$isForceReview = $this->isForceReview();
$forceReview = $this->forceReview();
foreach($cases as $key => $caseData)
{
if(!empty($_POST['id'][$key]) and empty($_POST['insert']))
@@ -984,7 +984,7 @@ class testcaseModel extends model
{
$caseData->lastEditedBy = $this->app->user->account;
$caseData->lastEditedDate = $now;
if($stepChanged and $isForceReview) $caseData->status = 'wait';
if($stepChanged and $forceReview) $caseData->status = 'wait';
$this->dao->update(TABLE_CASE)->data($caseData)->where('id')->eq($caseID)->autoCheck()->exec();
if($stepChanged)
{
@@ -1018,7 +1018,7 @@ class testcaseModel extends model
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
$caseData->branch = isset($data->branch[$key]) ? $data->branch[$key] : $branch;
if($isForceReview) $caseData->status = 'wait';
if($forceReview) $caseData->status = 'wait';
$this->dao->insert(TABLE_CASE)->data($caseData)->autoCheck()->exec();
if(!dao::isError())
@@ -1383,7 +1383,7 @@ class testcaseModel extends model
* @access public
* @return void
*/
public function isForceReview()
public function forceReview()
{
if(!$this->config->testcase->needReview) return false;
if(empty($this->config->testcase->forceReview)) return true;