* adjust code.

This commit is contained in:
wangyidong
2017-03-21 15:06:38 +08:00
parent a6c7eed490
commit dc812fd161
41 changed files with 181 additions and 429 deletions
+3 -20
View File
@@ -66,27 +66,10 @@ class branch extends control
$this->view->module = $module;
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->branches = $this->branch->getPairs($productID);
$this->display();
}
/**
* Ajax get matched items
*
* @param string $keywords
* @param string $module
* @param string $method
* @param string $extra
* @param int $objectID
* @access public
* @return void
*/
public function ajaxGetMatchedItems($keywords, $module, $method, $extra, $objectID)
{
$this->view->link = $this->loadModel('product')->getProductLink($module, $method, $extra, true);
$this->view->branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('deleted')->eq(0)->andWhere('product')->eq($objectID)->andWhere('name')->like("%$keywords%")->orderBy('id desc')->fetchPairs('id', 'name');
$this->view->productID = $objectID;
$this->view->keywords = $keywords;
$branches = $this->branch->getPairs($productID);
$this->view->branches = $branches;
$this->view->branchesPinyin = common::convert2Pinyin($branches);
$this->display();
}
+1 -1
View File
@@ -9,7 +9,7 @@
<?php
foreach($branches as $branchID => $branch)
{
echo "<li>" . html::a(sprintf($link, $productID, $branchID), "<i class='icon-cube'></i> " . $branch, '', "class='text-important'"). "</li>";
echo "<li data-key='{$branchesPinyin[$branch]}'>" . html::a(sprintf($link, $productID, $branchID), "<i class='icon-cube'></i> " . $branch, '', "class='text-important'"). "</li>";
}
?>
</ul>
@@ -1,11 +0,0 @@
<div class='search-list'>
<ul>
<?php if(!$branches) echo "<li class='no-result-tip'>" . sprintf($lang->product->noMatched, $keywords) . '</li>';?>
<?php
foreach($branches as $branchID => $branch)
{
echo "<li>" . html::a(sprintf($link, $productID, $branchID), "<i class='icon-cube'></i> " . $branch). "</li>";
}
?>
</ul>
</div>
+3 -4
View File
@@ -652,10 +652,9 @@ class bug extends control
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where('id')->in($bugIDList)->fetchAll('id');
/* Judge whether the editedTasks is too large and set session. */
$showSuhosinInfo = false;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($bugs), count(explode(',', $this->config->bug->custom->batchEditFields)) + 2);
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo;
$countInputVars = count($bugs) * (count(explode(',', $this->config->bug->custom->batchEditFields)) + 2);
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
/* Set Custom*/
foreach(explode(',', $this->config->bug->list->customBatchEditFields) as $field) $customFields[$field] = $this->lang->bug->$field;
-3
View File
@@ -532,9 +532,6 @@ class bugModel extends model
$data = fixer::input('post')->get();
$bugIDList = $this->post->bugIDList ? $this->post->bugIDList : array();
/* Adjust whether the post data is complete, if not, remove the last element of $bugIDList. */
if($this->session->showSuhosinInfo) array_pop($bugIDList);
if(!empty($bugIDList))
{
/* Process the data if the value is 'ditto'. */
+4 -3
View File
@@ -22,6 +22,9 @@
</div>
</div>
</div>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo;?></div>
<?php else:?>
<?php
$visibleFields = array();
foreach(explode(',', $showFields) as $field)
@@ -99,15 +102,13 @@ $columns = count($visibleFields) + 2;
</td>
</tr>
<?php endforeach;?>
<?php if(isset($suhosinInfo)):?>
<tr><td colspan='<?php echo $columns;?>'><div class='alert alert-info'><?php echo $suhosinInfo;?></div></td></tr>
<?php endif;?>
</tbody>
<tfoot>
<tr><td colspan='<?php echo $columns;?>' class='text-center'><?php echo html::submitButton();?></td></tr>
</tfoot>
</table>
</form>
<?php endif;?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=bug&section=custom&key=batchEditFields')?>
<?php include '../../common/view/customfield.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+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或php-fpm,否则会造成部分数据无法保存。";
$lang->maxVarsInfo = "警告:数据太多,请在php.ini中修改<font color=red>max_input_vars</font>(设置更大的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->suhosinInfo = "警告:数据太多,请在php.ini中修改<font color=red>sohusin.post.max_vars</font>和<font color=red>sohusin.request.max_vars</font>(大于%s的数)。 保存并重新启动apache或php-fpm,否则会造成部分数据无法保存。";
$lang->maxVarsInfo = "警告:数据太多,请在php.ini中修改<font color=red>max_input_vars</font>(大于%s的数)。 保存并重新启动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>";
+6 -7
View File
@@ -914,23 +914,22 @@ class commonModel extends model
/**
* Judge Suhosin Setting whether the actual size of post data is large than the setting size.
*
* @param int $numberOfItems
* @param int $columns
* @param int $countInputVars
* @access public
* @return void
* @return bool
*/
public function judgeSuhosinSetting($numberOfItems, $columns)
public function judgeSuhosinSetting($countInputVars)
{
if(extension_loaded('suhosin'))
{
$maxPostVars = ini_get('suhosin.post.max_vars');
$maxRequestVars = ini_get('suhosin.request.max_vars');
if($numberOfItems * $columns > $maxPostVars or $numberOfItems * $columns > $maxRequestVars) return true;
if($countInputVars > $maxPostVars or $countInputVars > $maxRequestVars) return true;
}
else
{
$maxInputVars = ini_get('max_input_vars');
if($maxInputVars and $numberOfItems * $columns > (int)$maxInputVars) return true;
if($maxInputVars and $countInputVars > (int)$maxInputVars) return true;
}
return false;
@@ -1346,7 +1345,7 @@ class commonModel extends model
if($wordPinyin) $abbr .= $wordPinyin[0];
}
$allConverted[$item] = join($wordsPinYin) . ' ' . $abbr;
$allConverted[$item] = strtolower(join($wordsPinYin) . ' ' . $abbr);
}
}
+1 -1
View File
@@ -314,7 +314,7 @@ class mail extends control
}
$this->dao->update(TABLE_MAILQUEUE)->set('status')->eq('sending')->where('id')->in($queue->id)->exec();
$this->mail->send($queue->toList, $queue->subject, $queue->body, $queue->ccList, $includeMe = true);
$this->mail->send($queue->toList, $queue->subject, $queue->body, $queue->ccList, true);
$data = new stdclass();
$data->sendTime = $now;
+2 -49
View File
@@ -562,60 +562,13 @@ class product extends control
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($this->products))->orderBy('`order` desc')->fetchAll();
$productPairs = array();
foreach($products as $product) $productPairs[$product->id] = $product->name;
$toPinyin = common::convert2Pinyin($productPairs);
$productsPinyin = common::convert2Pinyin($productPairs);
foreach($products as $key => $product)
{
$product->key = $toPinyin[$product->name];
}
foreach($products as $key => $product) $product->key = $productsPinyin[$product->name];
$this->view->products = $products;
$this->display();
}
/**
* The results page of search.
*
* @param string $keywords
* @param string $module
* @param string $method
* @param mix $extra
* @access public
* @return void
*/
public function ajaxGetMatchedItems($keywords, $module, $method, $extra)
{
$products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('deleted')->eq(0)->orderBy('`order` desc')->fetchAll();
$productPairs = array();
foreach($products as $product) $productPairs[$product->id] = $product->name;
$toPinyin = common::convert2Pinyin($productPairs);
foreach($toPinyin as $key => $value)
{
if(!strstr($value ,$keywords) && !strstr($key,$keywords))
{
unset($toPinyin[$key]);
}
}
foreach($products as $key => $product)
{
if(!isset($toPinyin[$product->name])) {
unset($products[$key]);
continue;
}
if(!$this->product->checkPriv($product)) unset($products[$key]);
}
$this->view->link = $this->product->getProductLink($module, $method, $extra);
$this->view->products = $products;
$this->view->keywords = $keywords;
$this->view->toPinyin = $toPinyin;
$this->view->productPairs = $productPairs;
$this->display();
}
/**
* Update order.
*
@@ -1,11 +0,0 @@
<div class='search-list'>
<ul>
<?php if(!$products) echo "<li class='no-result-tip'>" . sprintf($lang->product->noMatched, $keywords) . '</li>';?>
<?php
foreach($products as $product)
{
echo "<li>" . html::a(sprintf($link, $product->id), "<i class='icon-cube'></i> " . $product->name, '', "class='$product->status'"). "</li>";
}
?>
</ul>
</div>
+2 -46
View File
@@ -1881,56 +1881,12 @@ class project extends control
$this->view->extra = $extra;
$projects = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in(array_keys($this->projects))->orderBy('order desc')->fetchAll();
$productPairs = array();
foreach($projects as $project) $projectPairs[$project->id] = $project->name;
$toPinyin = common::convert2Pinyin($projectPairs);
foreach($projects as $key => $project)
{
$project->key = $toPinyin[$project->name];
}
$this->view->projects = $projects;
$this->display();
}
/**
* The results page of search.
*
* @param string $keywords
* @param string $module
* @param string $method
* @param mix $extra
* @access public
* @return void
*/
public function ajaxGetMatchedItems($keywords, $module, $method, $extra)
{
$projects = $this->dao->select('*')->from(TABLE_PROJECT)->where('deleted')->eq(0)->orderBy('order desc')->fetchAll();
$projectPairs = array();
foreach($projects as $project) $projectPairs[$project->id] = $project->name;
$toPinyin = common::convert2Pinyin($projectPairs);
$projectsPinyin = common::convert2Pinyin($projectPairs);
foreach($projects as $key => $project) $project->key = $projectsPinyin[$project->name];
foreach($toPinyin as $key => $value)
{
if(!strstr($value ,$keywords) && !strstr($key,$keywords)) unset($toPinyin[$key]);
}
foreach($projects as $key => $project)
{
if(!isset($toPinyin[$project->name]))
{
unset($projects[$key]);
continue;
}
if(!$this->project->checkPriv($project)) unset($projects[$key]);
}
$this->view->link = $this->project->getProjectLink($module, $method, $extra);
$this->view->projects = $projects;
$this->view->keywords = $keywords;
$this->display();
}
@@ -1,11 +0,0 @@
<div class='search-list'>
<ul>
<?php if(!$projects) echo "<li class='no-result-tip'>" . sprintf($lang->project->noMatched, $keywords) . '</li>';?>
<?php
foreach($projects as $project)
{
echo "<li>" . html::a(sprintf($link, $project->id), "<i class='icon-cube'></i> " . $project->name, '', "class='$project->status'"). "</li>";
}
?>
</ul>
</div>
+6 -8
View File
@@ -457,10 +457,9 @@ class story extends control
$this->view->showFields = $this->config->story->custom->batchEditFields;
/* Judge whether the editedStories is too large and set session. */
$showSuhosinInfo = false;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($stories), count(explode(',', $this->config->story->custom->batchEditFields)) + 3);
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo;
$countInputVars = count($stories) * (count(explode(',', $this->config->story->custom->batchEditFields)) + 3);
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
$this->view->position[] = $this->lang->story->common;
$this->view->position[] = $this->lang->story->batchEdit;
@@ -810,10 +809,9 @@ class story extends control
}
/* Judge whether the editedStories is too large and set session. */
$showSuhosinInfo = false;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($stories), $this->config->story->batchClose->columns);
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo;
$countInputVars = count($stories) * $this->config->story->batchClose->columns;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
$this->view->position[] = $this->lang->story->common;
$this->view->position[] = $this->lang->story->batchClose;
-5
View File
@@ -505,9 +505,6 @@ class storyModel extends model
$data = fixer::input('post')->get();
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : array();
/* Adjust whether the post data is complete, if not, remove the last element of $taskIDList. */
if($this->session->showSuhosinInfo) array_pop($storyIDList);
/* Init $stories. */
if(!empty($storyIDList))
{
@@ -796,8 +793,6 @@ class storyModel extends model
$data = fixer::input('post')->get();
$storyIDList = $data->storyIDList ? $data->storyIDList : array();
/* Adjust whether the post data is complete, if not, remove the last element of $storyIDList. */
if($this->session->showSuhosinInfo) array_pop($storyIDList);
$oldStories = $this->getByList($storyIDList);
foreach($storyIDList as $storyID)
{
+4 -4
View File
@@ -18,7 +18,9 @@
<small class='text-danger'><?php echo html::icon($lang->icons['batchClose']);?></small>
</div>
</div>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo;?></div>
<?php else:?>
<form class='form-condensed' method='post' target='hiddenwin' action="<?php echo inLink('batchClose', "from=storyBatchClose")?>">
<table class='table table-fixed table-form with-border'>
<thead>
@@ -54,10 +56,8 @@
<td><?php echo html::input("comments[$storyID]", '', "class='form-control' autocomplete='off'");?></td>
</tr>
<?php endforeach;?>
<?php if(isset($suhosinInfo)):?>
<tr><td colspan='5'><div class='text-left blue'><?php echo $suhosinInfo;?></div></td></tr>
<?php endif;?>
<tr><td colspan='5' class='text-center'><?php echo html::submitButton();?></td></tr>
</table>
</form>
<?php endif;?>
<?php include '../../common/view/footer.html.php';?>
+4 -3
View File
@@ -24,6 +24,9 @@
</div>
</div>
</div>
<?php if(isset($suhosinInfo)):?>
<div id='suhosinInfo' class='alert alert-info'><?php echo $suhosinInfo;?></div>
<?php else:?>
<?php
$visibleFields = array();
foreach(explode(',', $showFields) as $field)
@@ -105,15 +108,13 @@ foreach(explode(',', $showFields) as $field)
<td <?php echo zget($visibleFields, 'keywords', "class='hidden'")?>><?php echo html::input("keywords[$storyID]", $stories[$storyID]->keywords, 'class="form-control" autocomplete="off"');?></td>
</tr>
<?php endforeach;?>
<?php if(isset($suhosinInfo)):?>
<tr><td colspan='<?php echo count($visibleFields) + 3;?>'><div id='suhosinInfo' class='alert alert-info'><?php echo $suhosinInfo;?></div></td></tr>
<?php endif;?>
</tbody>
<tfoot>
<tr><td colspan='<?php echo count($visibleFields) + 3;?>' class='text-center'><?php echo html::submitButton();?></td></tr>
</tfoot>
</table>
</form>
<?php endif;?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=story&section=custom&key=batchEditFields')?>
<?php include '../../common/view/customfield.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+3 -4
View File
@@ -370,10 +370,9 @@ class task extends control
$tasks = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($taskIDList)->fetchAll('id');
/* Judge whether the editedTasks is too large and set session. */
$showSuhosinInfo = false;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($tasks), count(explode(',', $this->config->task->custom->batchEditFields)) + 3);
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo;
$countInputVars = count($tasks) * (count(explode(',', $this->config->task->custom->batchEditFields)) + 3);
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
/* Set Custom*/
foreach(explode(',', $this->config->task->customBatchEditFields) as $field) $customFields[$field] = $this->lang->task->$field;
-3
View File
@@ -287,9 +287,6 @@ class taskModel extends model
$data = fixer::input('post')->get();
$taskIDList = $this->post->taskIDList;
/* Adjust whether the post data is complete, if not, remove the last element of $taskIDList. */
if($this->session->showSuhosinInfo) array_pop($taskIDList);
/* Process data if the value is 'ditto'. */
foreach($taskIDList as $taskID)
{
+5 -6
View File
@@ -22,6 +22,9 @@
</div>
</div>
</div>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo;?></div>
<?php else:?>
<?php
$visibleFields = array();
foreach(explode(',', $showFields) as $field)
@@ -89,17 +92,13 @@ foreach(explode(',', $showFields) as $field)
<td <?php echo zget($visibleFields, 'closedReason', "class='hidden'")?>><?php echo html::select("closedReasons[$taskID]", $lang->task->reasonList, $tasks[$taskID]->closedReason, 'class=form-control');?></td>
</tr>
<?php endforeach;?>
<?php $columns = count($visibleFields) + 3?>
<?php if(isset($suhosinInfo)):?>
<tr><td colspan='<?php echo $columns;?>'><div class='f-left blue'><?php echo $suhosinInfo;?></div></td></tr>
<?php endif;?>
</tbody>
<tfoot>
<tr><td colspan='<?php echo $columns;?>'><?php echo html::submitButton();?></td></tr>
<tr><td colspan='<?php echo count($visibleFields) + 3;?>'><?php echo html::submitButton();?></td></tr>
</tfoot>
</table>
</form>
<?php endif;?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=task&section=custom&key=batchEditFields')?>
<?php include '../../common/view/customfield.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+19 -37
View File
@@ -110,17 +110,8 @@ class testcase extends control
$this->config->testcase->search['onMenuBar'] = 'yes';
$this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL);
$linkedLibs = array();
foreach($cases as $case)
{
if($case->lib and $case->fromCaseID) $linkedLibs[$case->lib] = $case->lib;
}
$showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : '';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule, $linkedLibs) : array();
$moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
$libModuleTree = $this->tree->getCaseLibTreeInCase('case', $productID, array('treeModel', 'createCaseLink'));
if($libModuleTree) $moduleTree = substr($moduleTree, 0, strrpos($moduleTree, '</ul>')) . $libModuleTree . '</ul>';
$this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array();
/* Assign. */
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common;
@@ -130,7 +121,7 @@ class testcase extends control
$this->view->product = $this->product->getById($productID);
$this->view->productName = $this->products[$productID];
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
$this->view->moduleTree = $moduleTree;
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), '', $branch);
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
$this->view->moduleID = $moduleID;
$this->view->pager = $pager;
@@ -602,7 +593,7 @@ class testcase extends control
if(empty($case->steps))
{
$step = new stdclass();
$step->type = 'item';
$step->type = 'step';
$step->desc = '';
$step->expect = '';
$case->steps[] = $step;
@@ -720,15 +711,7 @@ class testcase extends control
$this->testcase->setMenu($this->products, $productID, $branch);
/* Set modules. */
$libs = array();
$existModules = array();
foreach($cases as $case)
{
if($case->lib and $case->fromCaseID) $libs[$case->lib] = $case->lib;
$existModules[$case->module] = $case->module;
}
$modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
if($libs) $modules += $this->tree->getExistLibModules($libs, $existModules);
$modules = array('ditto' => $this->lang->testcase->ditto) + $modules;
$this->view->modules = $modules;
@@ -748,14 +731,7 @@ class testcase extends control
/* Set modules. */
$productIdList = array();
$libs = array();
$existModules = array();
foreach($cases as $case)
{
if($case->lib and $case->fromCaseID) $libs[$case->lib] = $case->lib;
$productIdList[$case->product] = $case->product;
$existModules[$case->module] = $case->module;
}
foreach($cases as $case) $productIdList[$case->product] = $case->product;
$products = $this->product->getByIdList($productIdList);
$modules = array();
@@ -764,16 +740,15 @@ class testcase extends control
$productModules = $this->tree->getOptionMenu($product->id, $viewType = 'case', $startModuleID = 0);
foreach($productModules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $product->name . $moduleName;
}
if($libs) $modules += $this->tree->getExistLibModules($libs, $existModules);
$this->view->modules = array('ditto' => $this->lang->testcase->ditto) + $modules;
}
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
/* Judge whether the editedTasks is too large and set session. */
$showSuhosinInfo = false;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($cases), count(explode(',', $this->config->testcase->custom->batchEditFields)) + 3);
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo;
$countInputVars = count($cases) * (count(explode(',', $this->config->testcase->custom->batchEditFields)) + 3);
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
$this->loadModel('story');
$this->view->stories = $this->story->getProductStoryPairs($productID, $branch);
@@ -810,7 +785,7 @@ class testcase extends control
if(dao::isError()) die(js::error(dao::getError()));
$result = $this->post->result;
$this->loadModel('action')->create('case', $caseID, 'Reviewed', $this->post->comment, ucfirst($result));
die(js::locate(inlink('view', "caseID=$caseID"), 'parent.parent'));
die(js::reload('parent.parent'));
}
$this->view->users = $this->user->getPairs('noletter|nodeleted|noclosed');
@@ -1147,7 +1122,7 @@ class testcase extends control
foreach($relatedSteps[$case->id] as $step)
{
$stepId = 0;
if($step->type == 'group' or ($step->type == 'item' and $step->parent == 0))
if($step->type == 'group' or $step->type == 'step')
{
$i++;
$childId = 0;
@@ -1441,6 +1416,7 @@ class testcase extends control
$endField = end($fields);
$caseData = array();
$stepData = array();
$stepVars = 0;
foreach($rows as $row => $data)
{
$case = new stdclass();
@@ -1502,7 +1478,7 @@ class testcase extends control
$signbit = $sign == '.' ? 1 : 3;
$step = trim(substr($step, strlen($num) + $signbit));
if(!empty($step)) $caseStep[$num]['content'] = $step;
$caseStep[$num]['type'] = 'item';
$caseStep[$num]['type'] = 'step';
}
elseif(isset($num))
{
@@ -1514,7 +1490,7 @@ class testcase extends control
{
$num = 1;
$caseStep[$num]['content'] = $step;
$caseStep[$num]['type'] = 'item';
$caseStep[$num]['type'] = 'step';
}
if($field == 'stepExpect' and isset($stepData[$row]['desc']))
{
@@ -1526,6 +1502,7 @@ class testcase extends control
}
unset($num);
unset($sign);
$stepVars += count($caseStep, COUNT_RECURSIVE) - count($caseStep);
$stepData[$row][$stepKey] = $caseStep;
}
}
@@ -1541,6 +1518,11 @@ class testcase extends control
}
if(!$this->config->testcase->needReview) unset($this->lang->testcase->statusList['wait']);
/* Judge whether the editedTasks is too large and set session. */
$countInputVars = count($caseData) * 12 + $stepVars;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
$this->view->title = $this->lang->testcase->common . $this->lang->colon . $this->lang->testcase->showImport;
$this->view->position[] = $this->lang->testcase->showImport;
+1 -1
View File
@@ -81,7 +81,7 @@ $lang->testcase->browse = "用例列表";
$lang->testcase->groupCase = "分组浏览用例";
$lang->testcase->import = "导入";
$lang->testcase->importFile = "导入CSV";
$lang->testcase->importFromLib = "从库中导入";
$lang->testcase->importFromLib = "从用例库中导入";
$lang->testcase->showImport = "显示导入内容";
$lang->testcase->exportTemplet = "导出模板";
$lang->testcase->export = "导出数据";
+8 -11
View File
@@ -714,9 +714,6 @@ class testcaseModel extends model
$data = fixer::input('post')->get();
$caseIDList = $this->post->caseIDList;
/* Adjust whether the post data is complete, if not, remove the last element of $caseIDList. */
if($this->session->showSuhosinInfo) array_pop($caseIDList);
/* Process data if the value is 'ditto'. */
foreach($caseIDList as $caseID)
{
@@ -995,16 +992,16 @@ class testcaseModel extends model
{
$step = (array)$step;
if(empty($step['desc'])) continue;
$isGroup = $step['type'] == 'group';
$stepData = new stdclass();
$stepData->parent = $isGroup ? 0 : $parentStepID;
$stepData->type = ($step['type'] == 'item' and $parentStepID == 0) ? 'step' : $step['type'];
$stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0;
$stepData->case = $caseID;
$stepData->version = $version;
$stepData->type = $step['type'];
$stepData->desc = htmlspecialchars($step['desc']);
$stepData->expect = htmlspecialchars($step['expect']);
$this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
if($isGroup) $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'step') $parentStepID = 0;
}
}
$oldCase->steps = $this->joinStep($oldStep);
@@ -1031,16 +1028,16 @@ class testcaseModel extends model
{
$desc = trim($desc);
if(empty($desc)) continue;
$isGroup = $data->stepType[$key][$id] == 'group';
$stepData = new stdclass();
$stepData->parent = $isGroup ? 0 : $parentStepID;
$stepData->type = ($data->stepType[$key][$id] == 'item' and $parentStepID == 0) ? 'step' : $data->stepType[$key][$id];
$stepData->parent = ($stepData->type == 'item') ? $parentStepID : 0;
$stepData->case = $caseID;
$stepData->version = 1;
$stepData->type = $isGroup ? 'group' : 'item';
$stepData->desc = htmlspecialchars($desc);
$stepData->expect = htmlspecialchars($data->expect[$key][$id]);
$this->dao->insert(TABLE_CASESTEP)->data($stepData)->autoCheck()->exec();
if($isGroup) $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'group') $parentStepID = $this->dao->lastInsertID();
if($stepData->type == 'step') $parentStepID = 0;
}
$this->action->create('case', $caseID, 'Opened');
}
+4 -3
View File
@@ -21,6 +21,9 @@
</div>
</div>
</div>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo;?></div>
<?php else:?>
<?php
$visibleFields = array();
foreach(explode(',', $showFields) as $field)
@@ -64,15 +67,13 @@ foreach(explode(',', $showFields) as $field)
<td class='text-left<?php echo zget($visibleFields, 'stage', ' hidden')?>' style='overflow:visible'><?php echo html::select("stages[$caseID][]", $lang->testcase->stageList, $cases[$caseID]->stage, "class='form-control chosen' multiple data-placeholder='{$lang->testcase->stage}'");?></td>
</tr>
<?php endforeach;?>
<?php if(isset($suhosinInfo)):?>
<tr><td colspan='<?php echo count($visibleFields) + 3;?>'><div class='alert alert-info'><?php echo $suhosinInfo;?></div></td></tr>
<?php endif;?>
</tbody>
<tfoot>
<tr><td colspan='<?php echo count($visibleFields) + 3;?>' class='text-center'><?php echo html::submitButton();?></td></tr>
</tfoot>
</table>
</form>
<?php endif;?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=testcase&section=custom&key=batchEditFields')?>
<?php include '../../common/view/customfield.html.php';?>
<?php include '../../common/view/footer.html.php';?>
+2 -2
View File
@@ -175,8 +175,8 @@
<span class='input-group-addon step-item-id'></span>
<?php echo html::textarea('steps[]', $step->desc, "rows='1' class='form-control autosize step-steps'") ?>
<span class='input-group-addon step-type-toggle'>
<?php if(!isset($step->type)) $step->type = 'item';?>
<input type='hidden' name='stepType[]' value='<?php echo $step->type ?>' class='step-type'>
<?php if(!isset($step->type)) $step->type = 'step';?>
<input type='hidden' name='stepType[]' value='<?php echo $step->type;?>' class='step-type'>
<div class='step-type-menu-box'>
<div class='step-type-current'><span></span> <i class='caret'></i></div>
<div class='step-type-menu'>
+1 -1
View File
@@ -88,7 +88,7 @@
<span class='input-group-addon step-item-id'></span>
<?php echo html::textarea('steps[]', $step->desc, "rows='1' class='form-control autosize step-steps'") ?>
<span class='input-group-addon step-type-toggle'>
<?php if(!isset($step->type)) $step->type = 'item';?>
<?php if(!isset($step->type)) $step->type = 'step';?>
<input type='hidden' name='stepType[]' value='<?php echo $step->type ?>' class='step-type'>
<div class='step-type-menu-box'>
<div class='step-type-current'><span></span> <i class='caret'></i></div>
+6 -10
View File
@@ -2,6 +2,9 @@
<style>
.affix {position:fixed; top:0px; width:95.6%;z-index:10000;}
</style>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo?></div>
<?php else:?>
<form target='hiddenwin' method='post' class='form-condensed'>
<table class='table table-fixed active-disabled table-custom'>
<thead>
@@ -30,7 +33,7 @@
</tr>
</thead>
<tbody>
<?php $insert = true; $inputVars = 0;?>
<?php $insert = true;?>
<?php foreach($caseData as $key => $case):?>
<?php if(empty($case->title)) continue;?>
<tr valign='top' align='center'>
@@ -67,15 +70,13 @@
<tr class='step'>
<td><?php echo $id . html::hidden("stepType[$key][$id]", $desc['type'])?></td>
<td><?php echo html::textarea("desc[$key][$id]", htmlspecialchars($desc['content']), "class='form-control'")?></td>
<td><?php if($desc['type'] == 'item') echo html::textarea("expect[$key][$id]", isset($stepData[$key]['expect'][$id]['content']) ? htmlspecialchars($stepData[$key]['expect'][$id]['content']) : '', "class='form-control'")?></td>
<td><?php if($desc['type'] != 'group') echo html::textarea("expect[$key][$id]", isset($stepData[$key]['expect'][$id]['content']) ? htmlspecialchars($stepData[$key]['expect'][$id]['content']) : '', "class='form-control'")?></td>
</tr>
<?php $inputVars += $desc['type'] == 'item' ? 3 : 2;?>
<?php endforeach;?>
</table>
<?php endif;?>
</td>
</tr>
<?php $inputVars += 12;?>
<?php endforeach;?>
</tbody>
<tfoot>
@@ -98,13 +99,8 @@
</tfoot>
</table>
</form>
<script>
<?php
$maxInputVars = ini_get('max_input_vars');
if($maxInputVars and (int)$maxInputVars < $inputVars):
?>
$(function(){$('.outer form table:first').before("<div class='alert alert-warning'><?php echo $lang->maxVarsInfo . " ($inputVars)"?></div>")})
<?php endif;?>
<script>
$(function(){affix('thead')})
function affix(obj)
{
+5 -1
View File
@@ -591,7 +591,11 @@ class testsuite extends control
$this->view->module = $module;
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->libraries = $this->testsuite->getLibraries();
$libraries = $this->testsuite->getLibraries();
$this->view->libraries = $libraries;
$this->view->librariesPinyin = common::convert2Pinyin($libraries);
$this->display();
}
+12
View File
@@ -8,6 +8,7 @@
#steps .step-group .step-expects {display: none;}
#steps .step-item .step-item-id {display: table-cell; min-width: 40px;}
#steps .step-item .step-id {color: transparent}
#steps .step-group .step-id {font-weight: bold}
#steps .step-actions {width: 90px; text-align: center;}
#steps .btn-step-move {cursor: move}
@@ -18,6 +19,17 @@
#steps.sortable-sorting > tr.drag-row + tr > td {box-shadow: inset 0 4px 2px rgba(0,0,0,.2)}
#steps.sortable-sorting > tr.drag-row > td {background-color: #edf3fe!important}
#steps.sortable > tr.drop-success > td {background-color: #cfe0ff; transition: background-color 2s;}
#steps .step-type-toggle {padding: 0}
#steps .step-type-menu-box {position: relative;}
#steps .step-type-menu {position: absolute; top: 25px; right: 0; z-index: 10; box-shadow: 0 6px 12px rgba(0,0,0,.175); background-color: #fff; display: none; border: 1px solid #bbb; min-width: 60px;}
#steps .step-step[data-type="item"] .step-type-menu > a[data-value="item"] {display: none}
#steps .step-type-current {display: block; padding: 5px 10px; position: relative; line-height: 20px;}
#steps .step-type-toggle:hover .step-type-current {background-color: #edf3fe; color: #03c}
#steps .step-type-menu:hover,
#steps .step-type-toggle:hover .step-type-menu {display: table; padding: 2px}
#steps .step-type-menu > a {display: table-cell; padding: 8px 10px; color: #666;}
#steps .step-type-menu > a:hover {color: #333; background-color: #e5e5e5;}
#steps .step-type-menu > a.active {color: #fff; background-color: #1a4f85;}
.table-bordered .step-actions {width: 98px;}
.table-bordered > #steps > tr > td {padding: 0; background-color: #fafafa; border: 1px solid #ddd!important; border-left-style: dotted!important; border-right-style: dotted!important;}
+42 -20
View File
@@ -31,7 +31,7 @@ function initSteps(selector)
var $stepTemplate = $('#stepTemplate').detach().removeClass('template').attr('id', null);
var initSortableCallTask = null;
var groupNameText = $steps.data('groupName');
var insertStepRow = function($row, count)
var insertStepRow = function($row, count, type)
{
if(count === undefined) count = 1;
for(var i = 0; i < count; ++i)
@@ -41,38 +41,59 @@ function initSteps(selector)
else $steps.append($step);
$step.addClass('step-new');
setTimeout(function(){$step.find('.step-steps').focus();}, 10);
}
};
var toggleStepRowType = function($row, toggleisGroup)
var updateStepType = function($step, type)
{
if(toggleisGroup === undefined) targetIsGroup = $row.find('.step-type').is(':checked');
$row.toggleClass('step-group', targetIsGroup);
$row.find('.step-steps').toggleClass('autosize', !targetIsGroup).attr('placeholder', targetIsGroup ? groupNameText : null).focus();
var targetIsGroup = type =='group';
$step.attr('data-type', type).find('.step-steps').toggleClass('autosize', !targetIsGroup).attr('placeholder', targetIsGroup ? groupNameText : null).focus();
var displayType = (type =='item' && $step.hasClass('step-step')) ? 'step' : type;
var activeTypeText = $step.find('.step-type-menu > a').removeClass('active').filter('[data-value="' + displayType + '"]').addClass('active').text();
$step.find('.step-type-current > span').text(activeTypeText);
};
var refreshStepsID = function()
var refreshSteps = function()
{
var parentId = 1, childId = 0;
$steps.children('.step:not(.drag-shadow)').each(function(idx)
{
var $step = $(this);
var isGroup = $step.find('.step-type').is(':checked');
var type = $step.find('.step-type').val();
var stepID;
if(isGroup || !childId)
if(type == 'group')
{
$step.removeClass('step-item');
$step.removeClass('step-item step-step').addClass('step-group');
stepID = parentId++;
$step.find('.step-id').text(stepID);
if(isGroup) childId = 1;
childId = 1;
}
else if(type == 'step')
{
$step.removeClass('step-item step-group').addClass('step-step');
stepID = parentId++;
$step.find('.step-id').text(stepID);
childId = 0;
}
else
{
stepID = (parentId - 1) + '.' + (childId++);
$step.addClass('step-item').find('.step-item-id').text(stepID);
if(childId) // as child
{
stepID = (parentId - 1) + '.' + (childId++);
$step.removeClass('step-step step-group').addClass('step-item').find('.step-item-id').text(stepID);
}
else
{
$step.removeClass('step-item step-group').addClass('step-step');
stepID = parentId++;
$step.find('.step-id').text(stepID);
}
}
$step.find('[name^="steps["]').attr('name', "steps[" +stepID + ']');
$step.find('[name^="stepType["]').attr('name', "stepType[" +stepID + ']');
$step.find('[name^="expects["]').attr('name', "expects[" +stepID + ']');
updateStepType($step, type);
});
};
var initSortable = function()
@@ -90,6 +111,7 @@ function initSteps(selector)
$moveStep.removeClass('drag-row');
$steps.removeClass('sortable-sorting');
$moveStep = null;
refreshSteps();
});
$steps.addClass('sortable-sorting');
}).on('mouseenter', '.step:not(.drag-row)', function()
@@ -111,25 +133,25 @@ function initSteps(selector)
{
$targetStep.before($moveStep);
}
refreshStepsID();
});
}
$steps.on('click', '.btn-step-add', function()
{
insertStepRow($(this).closest('.step'));
refreshStepsID();
refreshSteps();
}).on('click', '.btn-step-delete', function()
{
if($('tbody#steps tr.step').size() == 1) return false;
$(this).closest('.step').remove();
refreshStepsID();
}).on('change', '.step-type', function()
refreshSteps();
}).on('click', '.step-type-menu a', function()
{
toggleStepRowType($(this).closest('.step'));
refreshStepsID();
var $a = $(this);
$a.closest('.step').find('.step-type').val($a.data('value'));
refreshSteps();
});
initSortable();
refreshStepsID();
refreshSteps();
}
/**
+1 -1
View File
@@ -75,7 +75,7 @@ class testsuiteModel extends model
public function setLibMenu($libraries, $libID)
{
$currentLibName = zget($libraries, $libID, '');
$selectHtml = empty($libraries) ? '' : "<a id='currentItem' href=\"javascript:showDropMenu('testsuite', '$libID', 'testsuite', 'library', '')\">{$currentLibName} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
$selectHtml = empty($libraries) ? '' : "<a id='currentItem' href=\"javascript:showSearchMenu('testsuite', '$libID', 'testsuite', 'library', '')\">{$currentLibName} <span class='icon-caret-down'></span></a><div id='dropMenu'><i class='icon icon-spin icon-spinner'></i></div>";
setCookie("lastCaseLib", $libID, $this->config->cookieLife, $this->config->webRoot);
foreach($this->lang->caselib->menu as $key => $value)
{
@@ -5,7 +5,7 @@
<?php
foreach($libraries as $libID => $libName)
{
echo "<li>" . html::a(sprintf($link, $libID), "<i class='icon-cube'></i> " . $libName). "</li>";
echo "<li data-key='{$librariesPinyin[$libName]}'>" . html::a(sprintf($link, $libID), "<i class='icon-cube'></i> " . $libName). "</li>";
}
?>
</ul>
@@ -1,11 +0,0 @@
<div class='search-list'>
<ul>
<?php if(!$libraries) echo "<li class='no-result-tip'>" . sprintf($lang->product->noMatched, $keywords) . '</li>';?>
<?php
foreach($libraries as $lib)
{
echo "<li>" . html::a(sprintf($link, $lib->id), "<i class='icon-cube'></i> " . $lib->name) . "</li>";
}
?>
</ul>
</div>
+22 -9
View File
@@ -108,7 +108,7 @@
<table class='table table-form mg-0 table-bordered' style='border: 1px solid #ddd'>
<thead>
<tr>
<th class='w-40px'><?php echo $lang->testcase->stepID;?></th>
<th class='w-40px text-right'><?php echo $lang->testcase->stepID;?></th>
<th width="45%"><?php echo $lang->testcase->stepDesc;?></th>
<th><?php echo $lang->testcase->stepExpect;?></th>
<th class='step-actions'><?php echo $lang->actions;?></th>
@@ -121,10 +121,16 @@
<div class='input-group'>
<span class='input-group-addon step-item-id'></span>
<textarea rows='1' class='form-control autosize step-steps' name='steps[]'></textarea>
<span class="input-group-addon">
<label class="checkbox-inline">
<input type='checkbox' name='stepType[]' value='parent' class='step-type'> <?php echo $lang->testcase->group ?>
</label>
<span class="input-group-addon step-type-toggle">
<input type='hidden' name='stepType[]' value='item' class='step-type'>
<div class='step-type-menu-box'>
<div class='step-type-current'><span></span> <i class='caret'></i></div>
<div class='step-type-menu'>
<a href='javascript:;' href='step-type-option' data-value='step'><?php echo $lang->testcase->step ?></a>
<a href='javascript:;' href='step-type-option' data-value='group'><?php echo $lang->testcase->group ?></a>
<a href='javascript:;' href='step-type-option' data-value='item'><?php echo $lang->testcase->stepChild ?></a>
</div>
</div>
</span>
</div>
</td>
@@ -144,10 +150,17 @@
<div class='input-group'>
<span class='input-group-addon step-item-id'></span>
<?php echo html::textarea('steps[]', $step->desc, "rows='1' class='form-control autosize step-steps'") ?>
<span class="input-group-addon">
<label class="checkbox-inline">
<input type='checkbox' name='stepType[]' value='parent' class='step-type' <?php if($step->type == 'group') echo 'checked'?>> <?php echo $lang->testcase->group ?>
</label>
<span class='input-group-addon step-type-toggle'>
<?php if(!isset($step->type)) $step->type = 'step';?>
<input type='hidden' name='stepType[]' value='<?php echo $step->type ?>' class='step-type'>
<div class='step-type-menu-box'>
<div class='step-type-current'><span></span> <i class='caret'></i></div>
<div class='step-type-menu'>
<a href='javascript:;' href='step-type-option' data-value='step'><?php echo $lang->testcase->step ?></a>
<a href='javascript:;' href='step-type-option' data-value='group'><?php echo $lang->testcase->group ?></a>
<a href='javascript:;' href='step-type-option' data-value='item'><?php echo $lang->testcase->stepChild ?></a>
</div>
</div>
</span>
</div>
</td>
+1 -5
View File
@@ -273,10 +273,6 @@ class testtask extends control
/* Append bugs and results. */
$runs = $this->testcase->appendData($runs, 'run');
$moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
$libModuleTree = $this->tree->getCaseLibTreeInCase('testtask', $taskID, array('treeModel', 'createTestTaskLink'));
if($libModuleTree) $moduleTree = substr($moduleTree, 0, strrpos($moduleTree, '</ul>')) . $libModuleTree . '</ul>';
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases;
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
$this->view->position[] = $this->lang->testtask->common;
@@ -288,7 +284,7 @@ class testtask extends control
$this->view->runs = $runs;
$this->view->users = $this->loadModel('user')->getPairs('noclosed,qafirst');
$this->view->assignedTos = $this->loadModel('user')->getPairs('noclosed,nodeleted,qafirst');
$this->view->moduleTree = $moduleTree;
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
+1 -1
View File
@@ -67,7 +67,7 @@
foreach($result->stepResults as $key => $stepResult):
?>
<?php
if(empty($stepResult['type'])) $stepResult['type'] = 'item';
if(empty($stepResult['type'])) $stepResult['type'] = 'step';
if(empty($stepResult['parent'])) $stepResult['parent'] = 0;
if($stepResult['type'] == 'group' or $stepResult['type'] == 'step')
{
-1
View File
@@ -57,7 +57,6 @@
$stepId++;
$childId = 0;
}
if($step->type == 'item' and $step->parent == 0) $stepClass = 'step-group';
?>
<tr class='step <?php echo $stepClass?>'>
<th class='step-id'><?php echo $stepId;?></th>
+3 -6
View File
@@ -162,7 +162,6 @@ class todo extends control
$editedTodos = array();
$todoIDList = array();
$columns = 7;
$showSuhosinInfo = false;
if($account == '') $account = $this->app->user->account;
$bugs = $this->bug->getUserBugPairs($account);
@@ -187,10 +186,8 @@ class todo extends control
}
/* Judge whether the edited todos is too large. */
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($editedTodos), $columns);
/* Set the sessions. */
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
$countInputVars = count($editedTodos) * $columns;
$showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting($countInputVars);
/* Set Custom*/
foreach(explode(',', $this->config->todo->list->customBatchEditFields) as $field) $customFields[$field] = $this->lang->todo->$field;
@@ -203,7 +200,7 @@ class todo extends control
$position[] = $this->lang->todo->common;
$position[] = $this->lang->todo->batchEdit;
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? $this->lang->suhosinInfo : $this->lang->maxVarsInfo;
if($showSuhosinInfo) $this->view->suhosinInfo = extension_loaded('suhosin') ? sprintf($this->lang->suhosinInfo, $countInputVars) : sprintf($this->lang->maxVarsInfo, $countInputVars);
$this->view->bugs = $bugs;
$this->view->tasks = $tasks;
$this->view->editedTodos = $editedTodos;
-3
View File
@@ -152,9 +152,6 @@ class todoModel extends model
$data = fixer::input('post')->get();
$todoIDList = $this->post->todoIDList ? $this->post->todoIDList : array();
/* Adjust whether the post data is complete, if not, remove the last element of $todoIDList. */
if($this->session->showSuhosinInfo) array_pop($taskIDList);
if(!empty($todoIDList))
{
/* Initialize todos from the post data. */
+6 -3
View File
@@ -21,6 +21,9 @@
</div>
</div>
</div>
<?php if(isset($suhosinInfo)):?>
<div class='alert alert-info'><?php echo $suhosinInfo;?></div>
<?php else:?>
<?php
$visibleFields = array();
foreach(explode(',', $showFields) as $field)
@@ -43,6 +46,7 @@ $columns = count($visibleFields) + 3;
<th class='w-100px<?php echo zget($visibleFields, 'status', ' hidden')?>'> <?php echo $lang->todo->status;?></th>
</tr>
</thead>
<tbody>
<?php foreach($editedTodos as $todo):?>
<tr class='text-center'>
<td><?php echo $todo->id . html::hidden("todoIDList[$todo->id]", $todo->id);?></td>
@@ -77,14 +81,13 @@ $columns = count($visibleFields) + 3;
<td <?php echo zget($visibleFields, 'status', "class='hidden'")?>><?php echo html::select("status[$todo->id]", $lang->todo->statusList, $todo->status, "class='form-control'");?></td>
</tr>
<?php endforeach;?>
<?php if(isset($suhosinInfo)):?>
<tr><td colspan='7'><div class='text-left text-info'><?php echo $suhosinInfo;?>fdsafsdf</div></td></tr>
<?php endif;?>
</tbody>
<tfoot>
<tr><td colspan='<?php echo $columns?>'><?php echo html::submitButton();?></td></tr>
</tfoot>
</table>
</form>
<?php endif;?>
<?php $customLink = $this->createLink('custom', 'ajaxSaveCustomFields', 'module=todo&section=custom&key=batchEditFields')?>
<?php include '../../common/view/customfield.html.php';?>
<?php include './footer.html.php';?>
-100
View File
@@ -153,10 +153,6 @@ class treeModel extends model
{
/* When case with libIdList then append lib modules. */
$modules = array();
if($viewType == 'case' and $extra)
{
$modules += $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->in($extra)->andWhere('type')->eq('caselib')->andWhere('deleted')->eq(0)->fetchAll('id');
}
if($this->isMergeModule($rootID, $viewType)) $viewType .= ',story';
$modules += $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->andWhere('deleted')->eq(0)->fetchAll('id');
}
@@ -1514,100 +1510,4 @@ class treeModel extends model
}
return $tree;
}
/**
* Get caselib tree in case view.
*
* @param string $objectType
* @param int $objectID
* @param array $userFunc
* @access public
* @return string
*/
public function getCaseLibTreeInCase($objectType, $objectID, $userFunc)
{
if($objectType == 'case')
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where('product')->eq($objectID)->andWhere('deleted')->eq(0)->fetchAll();
}
elseif($objectType == 'testtask')
{
$cases = $this->dao->select('t2.*')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
->where('t1.task')->eq($objectID)
->andWhere('t2.deleted')->eq(0)
->fetchAll();
}
$existModules = array();
$libs = array();
foreach($cases as $case)
{
$existModules[$case->module] = $case->module;
if($case->lib and $case->fromCaseID) $libs[$case->lib] = $case->lib;
}
if(empty($libs)) return null;
$libs = $this->dao->select('*')->from(TABLE_TESTSUITE)->where('type')->eq('library')->andWhere('id')->in($libs)->andWhere('deleted')->eq(0)->fetchAll('id');
$moduleGroup = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->in(array_keys($libs))->andWhere('type')->eq('caselib')->andWhere('deleted')->eq(0)->orderBy('grade desc, `order`')->fetchGroup('root');
$lastMenu = '';
$keepModules = array();
foreach($libs as $lib)
{
if(!isset($moduleGroup[$lib->id])) continue;
$modules = $moduleGroup[$lib->id];
$treeMenu = array();
foreach($modules as $module)
{
$module->root = $objectID;
if(!isset($existModules[$module->id]) and !isset($keepModules[$module->id])) continue;
$keepModules[$module->parent] = true;
$linkHtml = call_user_func($userFunc, 'case', $module, $objectType == 'testtask' ? $objectID : '');
if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id]))
{
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = '';
$treeMenu[$module->parent] .= "<li class='closed'>$linkHtml";
$treeMenu[$module->parent] .= "<ul>" . $treeMenu[$module->id] . "</ul>\n";
}
else
{
if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = "";
$treeMenu[$module->parent] .= "<li>$linkHtml\n";
}
$treeMenu[$module->parent] .= "</li>\n";
}
if(empty($treeMenu)) continue;
ksort($treeMenu);
$lastMenu .= "<li>{$lib->name}<ul>" . @array_shift($treeMenu) . "</ul></li>\n";
}
return $lastMenu;
}
/**
* Get exist lib modules
*
* @param array $libs
* @param array $modules
* @access public
* @return array
*/
public function getExistLibModules($libs, $modules)
{
$libs = $this->dao->select('*')->from(TABLE_TESTSUITE)->where('type')->eq('library')->andWhere('id')->in($libs)->andWhere('deleted')->eq(0)->fetchAll('id');
$libModules = $this->dao->select('*')->from(TABLE_MODULE)->where('root')->in(array_keys($libs))->andWhere('type')->eq('caselib')->andWhere('deleted')->eq(0)->andWhere('id')->in($modules)->orderBy('grade,`order`')->fetchAll();
$modulePath = array();
foreach($libModules as $module)
{
foreach(explode(',', trim($module->path, ',')) as $moduleID)$modulePath[$moduleID] = $moduleID;
}
$allModules = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->in($modulePath)->fetchPairs('id', 'name');
$modulePairs = array();
foreach($libModules as $module)
{
$moduleName = $libs[$module->root]->name;
foreach(explode(',', trim($module->path, ',')) as $moduleID) $moduleName .= '/' . $allModules[$moduleID];
$modulePairs[$module->id] = $moduleName;
}
return $modulePairs;
}
}