Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
chenfeiCF
2015-11-02 10:48:39 +08:00
11 changed files with 64 additions and 47 deletions

View File

@@ -8,13 +8,10 @@ class sendcloud
public $secretKey = '';
public $from = '';
public $fromname = '';
public $to = '';
public $cc = '';
public $subject = '';
public $content = '';
public $files = '';
public $headers = '';
public $replyto = '';
public $Subject = ''; //Compatible phpmailer.
public $nickNames = '';
@@ -219,9 +216,7 @@ class sendcloud
*/
public function clearAllRecipients()
{
$this->to = '';
$this->cc = '';
$this->replyto = '';
$this->nickNames = '';
}
/**

View File

@@ -377,7 +377,9 @@ function notice()
var html = '';
if($('#project').val() == '')
{
html += '<a href="' + createLink('release', 'create', 'productID=' + $('#product').val()) + '" target="_blank" style="padding-right:5px">' + createRelease + '</a> ';
branch = $('#branch').val();
if(typeof(branch) == 'undefined') branch = 0;
html += '<a href="' + createLink('release', 'create', 'productID=' + $('#product').val() + '&branch=' + branch) + '" target="_blank" style="padding-right:5px">' + createRelease + '</a> ';
html += '<a href="javascript:loadProductBuilds(' + $('#product').val() + ')">' + refresh + '</a>';
}
else

View File

@@ -285,7 +285,7 @@ class build extends control
public function ajaxGetBranchBuilds($productID, $branchID, $operation, $build = '')
{
$builds = $this->build->getProductBuildPairs($productID, $branchID);
$releasedBuilds = $this->loadModel('release')->getReleaseBuilds($productID);
$releasedBuilds = $this->loadModel('release')->getReleaseBuilds($productID, $branchID);
if($operation == 'editRelease')
{

View File

@@ -420,9 +420,9 @@ class product extends control
* @access public
* @return void
*/
public function roadmap($productID)
public function roadmap($productID, $branch = 0)
{
$this->product->setMenu($this->products, $productID);
$this->product->setMenu($this->products, $productID, $branch);
$this->session->set('releaseList', $this->app->getURI(true));
$this->session->set('productPlanList', $this->app->getURI(true));
@@ -432,7 +432,8 @@ class product extends control
$this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name);
$this->view->position[] = $this->lang->product->roadmap;
$this->view->product = $product;
$this->view->roadmaps = $this->product->getRoadmap($productID);
$this->view->roadmaps = $this->product->getRoadmap($productID, $branch);
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID);
$this->display();
}

View File

@@ -378,23 +378,23 @@ class productModel extends model
* @access public
* @return array
*/
public function getRoadmap($productID)
public function getRoadmap($productID, $branch = 0)
{
$plans = $this->loadModel('productplan')->getList($productID);
$releases = $this->loadModel('release')->getList($productID);
$plans = $this->loadModel('productplan')->getList($productID, $branch);
$releases = $this->loadModel('release')->getList($productID, $branch);
$roadmap = array();
if(is_array($releases)) $releases = array_reverse($releases);
if(is_array($plans)) $plans = array_reverse($plans);
foreach($releases as $release)
{
$year = substr($release->date, 0, 4);
$roadmap[$year][] = $release;
$roadmap[$year][$release->branch][] = $release;
}
foreach($plans as $plan)
{
if($plan->end != '0000-00-00' and strtotime($plan->end) - time() <= 0) continue;
$year = substr($plan->end, 0, 4);
$roadmap[$year][] = $plan;
$roadmap[$year][$plan->branch][] = $plan;
}
ksort($roadmap);
@@ -689,7 +689,7 @@ class productModel extends model
{
$link = helper::createLink($module, $method, "status=all&productID=%s" . ($branch ? "&branch=%s" : ''));
}
elseif($module == 'product' && ($method == 'dynamic' or $method == 'roadmap' or $method == 'doc' or $method == 'view'))
elseif($module == 'product' && ($method == 'dynamic' or $method == 'doc' or $method == 'view'))
{
$link = helper::createLink($module, $method, "productID=%s");
}

View File

@@ -19,30 +19,35 @@
echo '<tr class="text-center">';
foreach($years as $year)
{
$colspans = count($roadmaps[$year]);
$year = $year == '0000' ? $lang->future : $year . $lang->year;
echo "<th><h4>$year</h4></th>";
echo "<th" . (empty($branches) ? '' : " colspan='$colspans'") . "><h4>$year</h4></th>";
}
echo '</tr>';
echo '<tr class="text-center text-top">';
foreach($years as $year)
{
echo '<td>';
foreach($roadmaps[$year] as $key => $roadmap)
foreach($roadmaps[$year] as $branch => $roadmapData)
{
if(isset($roadmap->build))
echo '<td>';
if(!empty($branches)) echo "<div class='roadmap branch'>{$branches[$branch]}</div>";
foreach($roadmapData as $key => $roadmap)
{
echo "<div class='roadmap release'>";
echo "<h5>" . html::a($this->createLink('release', 'view', "releaseID=$roadmap->id"), $roadmap->name, '_blank') . '</h5>' . $roadmap->date;
if(isset($roadmap->build))
{
echo "<div class='roadmap release'>";
echo "<h5>" . html::a($this->createLink('release', 'view', "releaseID=$roadmap->id"), $roadmap->name, '_blank') . '</h5>' . $roadmap->date;
}
else
{
echo "<div class='roadmap plan'>";
echo "<h5>" . html::a($this->createLink('productplan', 'view', "planID=$roadmap->id"), $roadmap->title, '_blank') . '</h5>' . $roadmap->begin . ' ~ ' . $roadmap->end;
}
echo "</div>";
if(isset($roadmaps[$year][$branch][$key + 1])) echo "<h5>{$lang->downArrow}</h5>";
}
else
{
echo "<div class='roadmap plan'>";
echo "<h5>" . html::a($this->createLink('productplan', 'view', "planID=$roadmap->id"), $roadmap->title, '_blank') . '</h5>' . $roadmap->begin . ' ~ ' . $roadmap->end;
}
echo "</div>";
if(isset($roadmaps[$year][$key + 1])) echo "<h5>{$lang->downArrow}</h5>";
echo '</td>';
}
echo '</td>';
}
echo '</tr>';
?>

View File

@@ -204,7 +204,15 @@ class productplanModel extends model
$this->loadModel('action');
foreach($this->post->stories as $storyID)
{
$this->dao->update(TABLE_STORY)->set("plan=CONCAT(plan, ',', $planID)")->where('id')->eq((int)$storyID)->exec();
if($this->session->currentProductType == 'normal')
{
$this->dao->update(TABLE_STORY)->set("plan")->eq($planID)->where('id')->eq((int)$storyID)->exec();
}
else
{
$this->dao->update(TABLE_STORY)->set("plan")->eq($planID)->where('id')->eq((int)$storyID)->andWhere('branch')->ne('0')->exec();
$this->dao->update(TABLE_STORY)->set("plan=CONCAT(plan, ',', $planID)")->where('id')->eq((int)$storyID)->andWhere('branch')->eq('0')->exec();
}
$this->action->create('story', $storyID, 'linked2plan', '', $planID);
$this->story->setStage($storyID);
}

View File

@@ -26,7 +26,7 @@ class release extends control
$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);
$this->product->setMenu($this->product->getPairs(), $productID, $branch);
}
/**
@@ -36,14 +36,14 @@ class release extends control
* @access public
* @return void
*/
public function browse($productID)
public function browse($productID, $branch = 0)
{
$this->commonAction($productID);
$this->commonAction($productID, $branch);
$products = $this->product->getPairs();
$this->session->set('releaseList', $this->app->getURI(true));
$this->view->title = $products[$productID] . $this->lang->colon . $this->lang->release->browse;
$this->view->position[] = $this->lang->release->browse;
$this->view->releases = $this->release->getList($productID);
$this->view->releases = $this->release->getList($productID, $branch);
$this->display();
}
@@ -54,7 +54,7 @@ class release extends control
* @access public
* @return void
*/
public function create($productID)
public function create($productID, $branch = 0)
{
if(!empty($_POST))
{
@@ -64,17 +64,17 @@ class release extends control
die(js::locate(inlink('view', "releaseID=$releaseID"), 'parent'));
}
$builds = $this->loadModel('build')->getProductBuildPairs($productID);
$releaseBuilds = $this->release->getReleaseBuilds($productID);
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch);
$releaseBuilds = $this->release->getReleaseBuilds($productID, $branch);
foreach($releaseBuilds as $build) unset($builds[$build]);
unset($builds['trunk']);
$this->commonAction($productID);
$this->commonAction($productID, $branch);
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->edit;
$this->view->position[] = $this->lang->release->create;
$this->view->builds = $builds;
$this->view->productID = $productID;
$this->view->lastRelease = $this->release->getLast($productID);
$this->view->lastRelease = $this->release->getLast($productID, $branch);
$this->display();
}

View File

@@ -46,13 +46,14 @@ class releaseModel extends model
* @access public
* @return array
*/
public function getList($productID)
public function getList($productID, $branch = 0)
{
return $this->dao->select('t1.*, t2.name as productName, t3.name as buildName')
->from(TABLE_RELEASE)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = t3.id')
->where('t1.product')->eq((int)$productID)
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date DESC')
->fetchAll();
@@ -65,10 +66,11 @@ class releaseModel extends model
* @access public
* @return bool | object
*/
public function getLast($productID)
public function getLast($productID, $branch = 0)
{
return $this->dao->select('id, name')->from(TABLE_RELEASE)
->where('product')->eq((int)$productID)
->beginIF($branch)->andWhere('branch')->eq($branch)->fi()
->orderBy('date DESC')
->limit(1)
->fetch();
@@ -81,9 +83,13 @@ class releaseModel extends model
* @access public
* @return void
*/
public function getReleaseBuilds($productID)
public function getReleaseBuilds($productID, $branch = 0)
{
$releases = $this->dao->select('build')->from(TABLE_RELEASE)->where('deleted')->eq(0)->andWhere('product')->eq($productID)->fetchAll('build');
$releases = $this->dao->select('build')->from(TABLE_RELEASE)
->where('deleted')->eq(0)
->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->eq($branch)->fi()
->fetchAll('build');
return array_keys($releases);
}

View File

@@ -17,7 +17,7 @@
<div id='titlebar'>
<div class='heading'><i class='icon-tags'></i> <?php echo $lang->release->browse;?> </div>
<div class='actions'>
<?php common::printIcon('release', 'create', "product=$product->id");?>
<?php common::printIcon('release', 'create', "product=$product->id&branch=$branch");?>
</div>
</div>
<table class='table tablesorter' id='releaseList'>

View File

@@ -29,7 +29,7 @@ js::set('page' , 'create');
<?php if($product->type != 'normal'):?>
<tr>
<th class='w-110px'><?php echo $lang->release->branch;?></th>
<td><?php echo html::select('branch', $branches, '', "onchange='loadBranchBuilds(this.value)' class='form-control chosen'");?></td>
<td><?php echo html::select('branch', $branches, $branch, "onchange='loadBranchBuilds(this.value)' class='form-control chosen'");?></td>
</tr>
<?php endif;?>
<tr>