* Change project build search form data.
This commit is contained in:
+31
-36
@@ -862,6 +862,7 @@ class project extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目下测试单列表。
|
||||
* Project test task list.
|
||||
*
|
||||
* @param int $projectID
|
||||
@@ -874,9 +875,6 @@ class project extends control
|
||||
*/
|
||||
public function testtask(int $projectID = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
|
||||
{
|
||||
$this->loadModel('testtask');
|
||||
$this->app->loadLang('testreport');
|
||||
|
||||
$this->project->setMenu($projectID);
|
||||
|
||||
/* Load pager. */
|
||||
@@ -884,19 +882,16 @@ class project extends control
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
|
||||
$project = $this->project->getByID($projectID);
|
||||
$tasks = $this->testtask->getProjectTasks($projectID, $orderBy, $pager);
|
||||
$tasks = $this->loadModel('testtask')->getProjectTasks($projectID, $orderBy, $pager);
|
||||
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->project->common;
|
||||
$this->view->project = $project;
|
||||
$this->view->projectID = $projectID;
|
||||
$this->view->projectName = $project->name;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->tasks = $tasks;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
|
||||
$this->view->products = $this->loadModel('product')->getPairs('', 0);
|
||||
$this->view->canBeChanged = common::canModify('project', $project); // Determines whether an object is editable.
|
||||
$this->view->actions = $this->loadModel('action')->getList('testtask', $projectID);
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->project->common;
|
||||
$this->view->project = $project;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->tasks = $tasks;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
|
||||
$this->view->products = $this->loadModel('product')->getPairs('', 0);
|
||||
$this->view->actions = $this->loadModel('action')->getList('testtask', $projectID);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -916,20 +911,21 @@ class project extends control
|
||||
*/
|
||||
public function build(int $projectID = 0, string $type = 'all', int $param = 0, string $orderBy = 't1.date_desc,t1.id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
|
||||
{
|
||||
$this->loadModel('build');
|
||||
$this->loadModel('product');
|
||||
|
||||
/* Set menu lang. */
|
||||
$this->project->setMenu($projectID);
|
||||
$project = $this->project->getByID($projectID);
|
||||
|
||||
/* Get project and product. */
|
||||
$project = $this->project->getByID($projectID);
|
||||
$product = $param ? $this->product->getById((int)$param) : '';
|
||||
$products = $this->product->getProducts($projectID, 'all', '', false);
|
||||
|
||||
$this->projectZen->processBuildSearchParams($project, (object)$product, $products, $type, $param);
|
||||
/* Build the search form. */
|
||||
$type = strtolower($type);
|
||||
$products = $this->loadModel('product')->getProducts($projectID, 'all', '', false);
|
||||
$this->project->buildProjectBuildSearchForm($products, $type == 'bysearch' ? (int)$param : 0, $projectID, $param, 'project');
|
||||
|
||||
/* Build the search form. */
|
||||
$this->app->loadClass('pager', true);
|
||||
$pager = new pager($recTotal, $recPerPage, $pageID);
|
||||
|
||||
/* Get builds. */
|
||||
$this->loadModel('build');
|
||||
if($type == 'bysearch')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildsBySearch((int)$projectID, (int)$param, $orderBy, $pager);
|
||||
@@ -939,18 +935,17 @@ class project extends control
|
||||
$builds = $this->build->getProjectBuilds((int)$projectID, $type, $param, $orderBy, $pager);
|
||||
}
|
||||
|
||||
/* Header and position. */
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->execution->build;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->builds = $this->projectZen->processBuildListData($builds, $projectID);
|
||||
$this->view->productID = $type == 'product' ? $param : 'all';
|
||||
$this->view->project = $project;
|
||||
$this->view->products = $products;
|
||||
$this->view->buildPairs = $this->loadModel('build')->getBuildPairs(0);
|
||||
$this->view->type = $type;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->param = $param;
|
||||
$this->view->pager = $pager;
|
||||
/* Set view data. */
|
||||
$this->view->title = $project->name . $this->lang->colon . $this->lang->execution->build;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->builds = $this->projectZen->processBuildListData($builds, $projectID);
|
||||
$this->view->productID = $type == 'product' ? $param : 'all';
|
||||
$this->view->project = $project;
|
||||
$this->view->products = $products;
|
||||
$this->view->type = $type;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->param = $param;
|
||||
$this->view->pager = $pager;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -876,19 +876,39 @@ class projectModel extends model
|
||||
*
|
||||
* @param array $products
|
||||
* @param int $queryID
|
||||
* @param string $actionURL
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param string $type project|execution
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buildProjectBuildSearchForm($products, $queryID, $actionURL, $type = 'project')
|
||||
public function buildProjectBuildSearchForm(array $products, int $queryID, int $projectID, int $productID, string $type = 'project')
|
||||
{
|
||||
$this->loadModel('build');
|
||||
|
||||
/* Set search param. */
|
||||
if($type == 'execution') $this->config->build->search['module'] = 'executionBuild';
|
||||
if($type == 'project') $this->config->build->search['module'] = 'projectBuild';
|
||||
$this->config->build->search['actionURL'] = $actionURL;
|
||||
$project = $this->projectTao->fetchProjectInfo($projectID);
|
||||
if(!$project->hasProduct) unset($this->config->build->search['fields']['product']);
|
||||
|
||||
$product = $productID ? $this->loadModel('product')->getByID($productID) : '';
|
||||
if($product and $product->type != 'normal')
|
||||
{
|
||||
$this->loadModel('branch');
|
||||
$branches = array(BRANCH_MAIN => $this->lang->branch->main) + $this->branch->getPairs($product->id, '', $executionID);
|
||||
$this->config->build->search['fields']['branch'] = sprintf($this->lang->build->branchName, $this->lang->product->branchName[$product->type]);
|
||||
$this->config->build->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => $branches);
|
||||
}
|
||||
|
||||
/* If there is an execution, set the execution filter item. */
|
||||
if($type == 'project' && $project->multiple)
|
||||
{
|
||||
$executionPairs = $this->loadModel('execution')->getByProject($project->id, 'all', '', true, $project->model == 'waterfall');
|
||||
$this->config->build->search['fields']['execution'] = zget($this->lang->project->executionList, $project->model);
|
||||
$this->config->build->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => $executionPairs);
|
||||
}
|
||||
|
||||
$this->config->build->search['module'] = $type == 'project' ? 'projectBuild' : 'executionBuild';
|
||||
$this->config->build->search['actionURL'] = $this->createLink($this->app->rawModule, $this->app->rawMethod, "projectID=$projectID&type=bysearch&queryID=myQueryID");
|
||||
$this->config->build->search['queryID'] = $queryID;
|
||||
$this->config->build->search['params']['product']['values'] = $products;
|
||||
|
||||
|
||||
+5
-42
@@ -464,7 +464,7 @@ class projectZen extends project
|
||||
/**
|
||||
* 为项目的bug列表准备分支数据。
|
||||
* Prepare branches for project bug list.
|
||||
*
|
||||
*
|
||||
* @param object $product
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
@@ -493,7 +493,7 @@ class projectZen extends project
|
||||
/**
|
||||
* 为项目bug列表准备模块数据。
|
||||
* Prepare modules for project bug list.
|
||||
*
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param string $type
|
||||
@@ -539,8 +539,8 @@ class projectZen extends project
|
||||
|
||||
/**
|
||||
* 处理项目bug列表的搜索表单。
|
||||
* Process search form for project bug list.
|
||||
*
|
||||
* Process search form for project bug list.
|
||||
*
|
||||
* @param object $project
|
||||
* @param string $type
|
||||
* @param int $param
|
||||
@@ -571,45 +571,8 @@ class projectZen extends project
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理项目版本列表的搜索表单。
|
||||
* Process search form for project build list.
|
||||
* 为bug列表视图构造必要的变量。
|
||||
*
|
||||
* @param object $project
|
||||
* @param object $product
|
||||
* @param array $products
|
||||
* @param string $type
|
||||
* @param int $param
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function processBuildSearchParams(object $project, object $product, array $products, string $type, int $param)
|
||||
{
|
||||
/* 为无迭代项目和多分支产品处理搜索表单的参数。 */
|
||||
if($project->multiple)
|
||||
{
|
||||
$executionPairs = $this->loadModel('execution')->getByProject($project->id, 'all', '', true, $project->model == 'waterfall');
|
||||
$this->config->build->search['fields']['execution'] = zget($this->lang->project->executionList, $project->model);
|
||||
$this->config->build->search['params']['execution'] = array('operator' => '=', 'control' => 'select', 'values' => $executionPairs);
|
||||
}
|
||||
if(!$project->hasProduct) unset($this->config->build->search['fields']['product']);
|
||||
|
||||
if(!empty($product->type) && $product->type != 'normal')
|
||||
{
|
||||
$branches = array(BRANCH_MAIN => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($product->id, '', $projectID);
|
||||
$this->config->build->search['fields']['branch'] = sprintf($this->lang->build->branchName, $this->lang->product->branchName[$product->type]);
|
||||
$this->config->build->search['params']['branch'] = array('operator' => '=', 'control' => 'select', 'values' => $branches);
|
||||
}
|
||||
|
||||
/* Build the search form. */
|
||||
$type = strtolower($type);
|
||||
$queryID = $type == 'bysearch' ? (int)$param : 0;
|
||||
$actionURL = $this->createLink($this->app->rawModule, $this->app->rawMethod, "projectID={$project->id}&type=bysearch&queryID=myQueryID");
|
||||
$this->project->buildProjectBuildSearchForm($products, $queryID, $actionURL, 'project', $project);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为bug列表视图构造必要的变量。
|
||||
*
|
||||
* @param int $productID
|
||||
* @param int $projectID
|
||||
* @param object $project
|
||||
|
||||
Reference in New Issue
Block a user