* Add upgrade repo logic.
This commit is contained in:
@@ -334,7 +334,7 @@ class productModel extends model
|
||||
->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
|
||||
->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
|
||||
->orderBy('t2.order desc')
|
||||
->fetchAll('id');
|
||||
->printsql('id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ class repo extends control
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($this->projectID);
|
||||
$this->view->products = $this->projectID ? $this->loadModel('product')->getProductPairsByProject($this->projectID) : $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -101,7 +101,7 @@ class repo extends control
|
||||
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($this->projectID);
|
||||
$this->view->products = $this->projectID ? $this->loadModel('product')->getProductPairsByProject($this->projectID) : $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->create;
|
||||
$this->view->position[] = $this->lang->repo->create;
|
||||
@@ -140,7 +140,7 @@ class repo extends control
|
||||
$this->view->repoID = $repoID;
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter|noempty|nodeleted');
|
||||
$this->view->products = $this->loadModel('product')->getProductPairsByProject($this->projectID);
|
||||
$this->view->products = $this->projectID ? $this->loadModel('product')->getProductPairsByProject($this->projectID) : $this->loadModel('product')->getPairs();
|
||||
|
||||
$this->view->title = $this->lang->repo->common . $this->lang->colon . $this->lang->repo->edit;
|
||||
$this->view->position[] = html::a(inlink('maintain'), $this->lang->repo->common);
|
||||
|
||||
@@ -286,9 +286,8 @@ class upgrade extends control
|
||||
{
|
||||
$this->upgrade->initUserView();
|
||||
$this->upgrade->setDefaultPriv();
|
||||
$this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=upgradeStep');
|
||||
$this->dao->update(TABLE_CONFIG)->set('value')->eq('0_0')->where('`key`')->eq('productProject')->exec();
|
||||
die(js::locate($this->createLink('upgrade', 'afterExec', "fromVersion=&processed=no")));
|
||||
die(js::locate($this->createLink('upgrade', 'mergeRepo')));
|
||||
}
|
||||
|
||||
$this->view->noMergedProductCount = $noMergedProductCount;
|
||||
@@ -435,6 +434,34 @@ class upgrade extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge Repos.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function mergeRepo()
|
||||
{
|
||||
if($_POST)
|
||||
{
|
||||
$this->upgrade->mergeRepo();
|
||||
die(js::locate($this->createLink('upgrade', 'mergeRepo'), 'parent'));
|
||||
}
|
||||
|
||||
$repos = $this->dao->select('id, name')->from(TABLE_REPO)->where('deleted')->eq(0)->andWhere('product')->eq('')->fetchPairs();
|
||||
|
||||
if(empty($repos))
|
||||
{
|
||||
$this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=upgradeStep');
|
||||
die(js::locate($this->createLink('upgrade', 'afterExec', "fromVersion=&processed=no")));
|
||||
}
|
||||
|
||||
$this->view->repos = $repos;
|
||||
$this->view->products = $this->dao->select('id, name')->from(TABLE_PRODUCT)->where('deleted')->eq(0)->fetchPairs();
|
||||
$this->view->programs = $this->dao->select('id, name')->from(TABLE_PROGRAM)->where('deleted')->eq(0)->andWhere('type')->eq('program')->fetchPairs();
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the project of the program it belongs to.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
.container {margin: 0 auto;}
|
||||
|
||||
.modal-dialog{width:100%;}
|
||||
.checkbox-primary{overflow:hidden;}
|
||||
.pgmWidth{width:48% !important;}
|
||||
#whitelistBox .checkbox-inline {display: inline-block !important; padding-left: 0px !important;}
|
||||
#whitelistBox .checkbox-inline:first-child {margin-left: 10px !important;}
|
||||
#budget {border-right:0px;}
|
||||
.divider{background:#f1f1f1 !important; width:20px !important; padding:1px !important;}
|
||||
.gray{background:#f1f1f1 !important}
|
||||
|
||||
.side-col{padding-right: 0px}
|
||||
div.divider{vertical-align: middle;}
|
||||
|
||||
.main-row{margin-top: 20px; padding: 20px; background: #f1f1f1}
|
||||
.main-row .side-col .nav li.active a{background: #006af1;color: #fff; border-radius: 4px}
|
||||
#source .lineGroup-body{padding: 10px}
|
||||
@@ -77,12 +77,14 @@ $lang->upgrade->mergeProgramDesc = <<<EOD
|
||||
<p>可以选择这些迭代归属于某个新项目下。</p>
|
||||
EOD;
|
||||
|
||||
$lang->upgrade->line = '产品线';
|
||||
$lang->upgrade->program = '目标项目集和项目';
|
||||
$lang->upgrade->existPGM = '已有项目集';
|
||||
$lang->upgrade->existPRJ = '已有项目';
|
||||
$lang->upgrade->product = $lang->productCommon;
|
||||
$lang->upgrade->project = '迭代';
|
||||
$lang->upgrade->line = '产品线';
|
||||
$lang->upgrade->program = '目标项目集和项目';
|
||||
$lang->upgrade->existPGM = '已有项目集';
|
||||
$lang->upgrade->existPRJ = '已有项目';
|
||||
$lang->upgrade->product = $lang->productCommon;
|
||||
$lang->upgrade->project = '迭代';
|
||||
$lang->upgrade->repo = '版本库';
|
||||
$lang->upgrade->mergeRepo = '归并版本库';
|
||||
|
||||
$lang->upgrade->newProgram = '新建';
|
||||
$lang->upgrade->mergeSummary = "尊敬的用户,您的系统中共有%s个产品,%s个迭代等待迁移。";
|
||||
@@ -90,5 +92,6 @@ $lang->upgrade->mergeByProductLine = "以产品线组织的产品和迭代:将
|
||||
$lang->upgrade->mergeByProduct = "以产品组织的迭代:可以选择多个产品及其下面的迭代归并到一个项目集和项目中,也可以选择某一个产品将其下面所属的迭代归并到项目集和项目中。";
|
||||
$lang->upgrade->mergeByProject = "独立的迭代:可以选择若干迭代归并到一个项目中,也可以独立归并。";
|
||||
$lang->upgrade->mergeByMoreLink = "关联多个产品的迭代:选择这个迭代归属于哪一个产品。";
|
||||
$lang->upgrade->mergeRepoTips = "将选中的版本库归并到所选产品下。";
|
||||
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -4246,6 +4246,38 @@ class upgradeModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
public function mergeRepo()
|
||||
{
|
||||
$data = fixer::input('post')
|
||||
->join('products', ',')
|
||||
->get();
|
||||
|
||||
foreach($data->repos as $repoID)
|
||||
{
|
||||
/* If have no products, add it. */
|
||||
if(isset($data->name))
|
||||
{
|
||||
$product = new stdclass();
|
||||
$product->program = $data->program;
|
||||
$product->name = $data->name;
|
||||
$product->acl = 'open';
|
||||
$product->PO = isset($this->app->user->account) ? $this->app->user->account : '';
|
||||
$product->createdBy = isset($this->app->user->account) ? $this->app->user->account : '';
|
||||
$product->createdDate = helper::now();
|
||||
$product->status = 'normal';
|
||||
|
||||
$this->dao->insert(TABLE_PRODUCT)->data($product)->exec();
|
||||
$productID = $this->dao->lastInsertID();
|
||||
|
||||
$this->dao->update(TABLE_REPO)->set('product')->eq($productID)->where('id')->eq($repoID)->exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->dao->update(TABLE_REPO)->set('product')->eq($data->products)->where('id')->eq($repoID)->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set program default priv.
|
||||
*
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* The mergerepo view file of upgrade module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Yidong Wang <yidong@cnezsoft.com>
|
||||
* @package upgrade
|
||||
* @version $Id$
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<div class='container'>
|
||||
<form method='post' target='hiddenwin'>
|
||||
<div class='modal-dialog'>
|
||||
<div class='modal-header'>
|
||||
<strong><?php echo $lang->upgrade->mergeRepo;?></strong>
|
||||
</div>
|
||||
<div class='modal-body'>
|
||||
<div class='alert alert-info'>
|
||||
<?php echo $lang->upgrade->mergeRepoTips;?>
|
||||
</div>
|
||||
<div class='main-row'>
|
||||
<div class='table-col' id='source'>
|
||||
<div class='cell'>
|
||||
<div class='lineGroup-title'>
|
||||
<div class='item'><strong><?php echo $lang->upgrade->repo;?></strong></div>
|
||||
</div>
|
||||
<div class='lineGroup-body'>
|
||||
<?php echo html::checkBox("repos", $repos, "class='form-control'");?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='table-col divider strong'></div>
|
||||
<div class='table-col pgmWidth' id='programBox'>
|
||||
<div class='cell'>
|
||||
<table class='table table-form'>
|
||||
<?php if($products):?>
|
||||
<tr>
|
||||
<th class='w-70px'><?php echo $lang->upgrade->product;?></th>
|
||||
<td><?php echo html::select("products[]", $products, '', "class='form-control chosen' multiple");?></td>
|
||||
</tr>
|
||||
<?php else:?>
|
||||
<tr>
|
||||
<th class='w-100px'><?php echo $lang->upgrade->existPGM;?></th>
|
||||
<td><?php echo html::select("program", $programs, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->upgrade->product;?></th>
|
||||
<td><?php echo html::input("name", '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<?php endif;?>
|
||||
<tr>
|
||||
<td colspan='2' class='text-center form-actions'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
Reference in New Issue
Block a user