diff --git a/module/action/lang/en.php b/module/action/lang/en.php index b01cc025d3..3806faf4f3 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -432,7 +432,7 @@ $lang->action->label->product = $lang->productCommon . '|product|view|produc $lang->action->label->productplan = 'Plan|productplan|view|productID=%s'; $lang->action->label->release = 'Release|release|view|productID=%s'; $lang->action->label->story = 'Story|story|view|storyID=%s'; -$lang->action->label->program = "Program|program|pgmproduct|programID=%s"; +$lang->action->label->program = "Program|program|product|programID=%s"; $lang->action->label->project = "Project|project|index|projectID=%s"; if($config->systemMode == 'new') { diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 9966450460..79b3a7443b 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -432,7 +432,7 @@ $lang->action->label->product = $lang->productCommon . '|product|view|produc $lang->action->label->productplan = "计划|productplan|view|productID=%s"; $lang->action->label->release = '发布|release|view|productID=%s'; $lang->action->label->story = "{$lang->SRCommon}|story|view|storyID=%s"; -$lang->action->label->program = "项目集|program|pgmproduct|programID=%s"; +$lang->action->label->program = "项目集|program|product|programID=%s"; $lang->action->label->project = "项目|project|index|projectID=%s"; if($config->systemMode == 'new') { diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 2b8818b383..26329670a7 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -547,7 +547,9 @@ function notice() else { executionID = $('#execution').val(); - html += '' + createBuild + ' '; + link = createLink('build', 'create','executionID=' + executionID + '&productID=' + $('#product').val()); + link += config.requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes'; + html += '' + createBuild + ' '; html += '' + refresh + ''; } var $bba = $('#buildBoxActions'); diff --git a/module/build/control.php b/module/build/control.php index 37e541f99e..5bd2bad7a2 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -19,14 +19,23 @@ class build extends control * @access public * @return void */ - public function create($executionID, $productID = 0) + public function create($executionID = 0, $productID = 0, $projectID = 0) { - /* Create execution if no execution. */ - if($executionID == 0) die(js::locate($this->createLink('execution', 'create'), 'parent')); + /* Load these models. */ + $this->loadModel('execution'); + $this->loadModel('user'); + + if($this->app->openApp == 'project') + { + commonModel::setAppObjectID('project', $projectID); + $executions = $this->execution->getPairs($projectID); + $executionID = key($executions); + } if(!empty($_POST)) { - $buildID = $this->build->create($executionID); + $executionID = $this->post->execution; + $buildID = $this->build->create($executionID); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('build', $buildID, 'opened'); @@ -36,18 +45,18 @@ class build extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID"))); } - /* Load these models. */ - $this->loadModel('execution'); - $this->loadModel('user'); - - /* Set session and get execution by id. */ - $this->session->set('buildCreate', $this->app->getURI(true)); $execution = $this->execution->getByID($executionID); + if($this->app->openApp == 'execution') + { + /* Set session and get execution by id. */ + $this->session->set('buildCreate', $this->app->getURI(true)); + + /* Set menu. */ + $executions = $this->execution->getPairs($execution->project); + $this->execution->setMenu($executions, $executionID); + commonModel::setAppObjectID('execution', $executionID); + } - /* Set menu. */ - $executions = $this->execution->getPairs($execution->project); - $this->execution->setMenu($executions, $executionID); - commonModel::setAppObjectID('execution', $executionID); $productGroups = $this->execution->getProducts($executionID); $productID = $productID ? $productID : key($productGroups); @@ -55,13 +64,13 @@ class build extends control foreach($productGroups as $product) $products[$product->id] = $product->name; $this->view->title = $execution->name . $this->lang->colon . $this->lang->build->create; - $this->view->position[] = html::a($this->createLink('execution', 'task', "executionID=$executionID"), $execution->name); $this->view->position[] = $this->lang->build->create; $this->view->product = isset($productGroups[$productID]) ? $productGroups[$productID] : ''; $this->view->branches = (isset($productGroups[$productID]) and $productGroups[$productID]->type == 'normal') ? array() : $this->loadModel('branch')->getPairs($productID); $this->view->executionID = $executionID; $this->view->products = $products; + $this->view->executions = isset($executions) ? $executions : array(); $this->view->lastBuild = $this->build->getLast($executionID); $this->view->productGroups = $productGroups; $this->view->users = $this->user->getPairs('nodeleted|noclosed'); diff --git a/module/build/js/common.js b/module/build/js/common.js index 6e672a87da..96d639687b 100644 --- a/module/build/js/common.js +++ b/module/build/js/common.js @@ -1,7 +1,7 @@ /** - * Load branches - * - * @param int $productID + * Load branches + * + * @param int $productID * @access public * @return void */ @@ -9,7 +9,13 @@ function loadBranches(productID) { $('#branch').remove(); $('#branch_chosen').remove(); - $.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID + '&oldBranch=' + productGroups[productID]['branch']), function(data) + var oldBranch = 0; + if(typeof(productGroups[productID]) != "undefined") + { + oldBranch = productGroups[productID]['branch']; + } + + $.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID + '&oldBranch=' + oldBranch), function(data) { if(data) { diff --git a/module/build/js/create.js b/module/build/js/create.js index 3f64da6a53..88b5082cb7 100644 --- a/module/build/js/create.js +++ b/module/build/js/create.js @@ -4,4 +4,27 @@ $().ready(function() { $('#name').val($(this).text()).focus(); }); + }); +/** + * Load products. + * + * @param int $executionID + * @access public + * @return void + */ +function loadProducts(executionID) +{ + $('#product').remove(); + $('#product_chosen').remove(); + $('#branch').remove(); + $('#branch_chosen').remove(); + $.get(createLink('product', 'ajaxGetProducts', 'executionID=' + executionID), function(data) + { + if(data) + { + $('.input-group').append(data); + $('#product').chosen(); + } + }); +} diff --git a/module/build/model.php b/module/build/model.php index 4dd05b93e9..f18e6f96ad 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -60,9 +60,9 @@ class buildModel extends model */ public function getProjectBuilds($projectID = 0, $type = 'all', $param = 0) { - return $this->dao->select('t1.*, t2.name as projectName, t2.id as projectID, t3.name as productName, t4.name as branchName') + return $this->dao->select('t1.*, t2.name as executionName, t2.id as executionID, t3.name as productName, t4.name as branchName') ->from(TABLE_BUILD)->alias('t1') - ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id') ->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product = t3.id') ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') ->where('t1.project')->eq((int)$projectID) @@ -293,7 +293,6 @@ class buildModel extends model ->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build') ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') ->where('t1.product')->in($products) - ->beginIF($this->lang->navGroup->testtask != 'qa')->andWhere('t1.project')->eq($this->session->PRJ)->fi() ->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index cbd885034e..cac65c62b6 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -19,6 +19,12 @@