* Finisht task #8497.

This commit is contained in:
holan20180123
2020-11-27 10:27:08 +08:00
parent c79bd18b68
commit 2fdf26bc21
12 changed files with 195 additions and 72 deletions
+22 -13
View File
@@ -44,13 +44,17 @@ class projectrelease extends control
$this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID);
$this->loadModel('product');
$this->loadModel('project');
$products = $this->product->getProductPairsByProject($this->session->PRJ);
if(empty($products)) $this->locate($this->createLink('product', 'create'));
$product = $this->product->getById($productID);
if(empty($product)) $this->locate($this->createLink('product', 'create'));
$this->view->product = $product;
$this->view->branches = (isset($product->type) and $product->type) == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$this->view->branch = $branch;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($product->id);
$this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$this->view->product->id}&branch=$branch"), $this->view->product->name);
$this->product->setMenu($this->product->getPairs(), $productID, $branch);
$this->view->project = $this->loadModel('project')->getById($this->session->PRJ);
$this->view->products = $products;
$this->product->setMenu($this->product->getPairs(), $productID ? $productID : key($products), $branch);
}
/**
@@ -62,14 +66,15 @@ class projectrelease extends control
* @access public
* @return void
*/
public function browse($productID, $branch = 0, $type = 'all')
public function browse($productID = 0, $branch = 0, $type = 'all')
{
$this->commonAction($productID, $branch);
$this->session->set('releaseList', $this->app->getURI(true));
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->browse;
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->browse;
$this->view->position[] = $this->lang->release->browse;
$this->view->releases = $this->projectrelease->getList($productID, $branch, $type);
$this->view->releases = $this->projectrelease->getList($productID, $branch, $type, $this->session->PRJ);
$this->view->productID = $productID;
$this->view->type = $type;
$this->display();
}
@@ -86,7 +91,7 @@ class projectrelease extends control
{
if(!empty($_POST))
{
$releaseID = $this->projectrelease->create($productID, $branch);
$releaseID = $this->projectrelease->create();
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->loadModel('action')->create('release', $releaseID, 'opened');
@@ -96,16 +101,20 @@ class projectrelease extends control
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
}
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'notrunk|withbranch', false);
$builds = $this->loadModel('build')->getProjectBuildPairs($this->session->PRJ, $productID, $branch, 'notrunk|withbranch');
$releaseBuilds = $this->projectrelease->getReleaseBuilds($productID, $branch);
foreach($releaseBuilds as $build) unset($builds[$build]);
unset($builds['trunk']);
$this->commonAction($productID, $branch);
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->create;
$productID = !empty($productID) ? $productID : key($this->view->products);
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->create;
$this->view->position[] = $this->lang->release->create;
$this->view->builds = $builds;
$this->view->productID = $productID;
$this->view->product = $this->product->getById($productID);
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->lastRelease = $this->projectrelease->getLast($productID, $branch);
$this->display();
}
@@ -147,7 +156,7 @@ class projectrelease extends control
$this->view->position[] = $this->lang->release->edit;
$this->view->release = $release;
$this->view->build = $build;
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($release->product, $release->branch, 'notrunk|withbranch', false);
$this->view->builds = $this->loadModel('build')->getProjectBuildPairs($this->session->PRJ, $release->product, $release->branch, 'notrunk|withbranch');
$this->display();
}
@@ -418,7 +427,7 @@ class projectrelease extends control
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
unset($this->config->product->search['fields']['product']);
unset($this->config->product->search['fields']['project']);
$this->config->product->search['actionURL'] = $this->createLink('release', 'view', "releaseID=$releaseID&type=story&link=true&param=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
$this->config->product->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=story&link=true&param=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
$this->config->product->search['queryID'] = $queryID;
$this->config->product->search['style'] = 'simple';
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));
@@ -535,7 +544,7 @@ class projectrelease extends control
$this->loadModel('bug');
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
unset($this->config->bug->search['fields']['product']);
$this->config->bug->search['actionURL'] = $this->createLink('release', 'view', "releaseID=$releaseID&type=$type&link=true&param=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
$this->config->bug->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=$type&link=true&param=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID'));
$this->config->bug->search['queryID'] = $queryID;
$this->config->bug->search['style'] = 'simple';
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));