* change code and add notice.

This commit is contained in:
wangyidong
2015-11-03 16:05:40 +08:00
parent e0a24a8a09
commit b65a72e141
24 changed files with 188 additions and 55 deletions
+44
View File
@@ -11,6 +11,13 @@
*/
class branch extends control
{
/**
* Manage branch
*
* @param int $productID
* @access public
* @return void
*/
public function manage($productID)
{
if($_POST)
@@ -31,6 +38,16 @@ class branch extends control
$this->display();
}
/**
* Ajax get drop menu.
*
* @param int $productID
* @param string $module
* @param string $method
* @param string $extra
* @access public
* @return void
*/
public function ajaxGetDropMenu($productID, $module, $method, $extra)
{
$this->view->link = $this->loadModel('product')->getProductLink($module, $method, $extra, true);
@@ -42,6 +59,17 @@ class branch extends control
$this->display();
}
/**
* Ajax get matched items
*
* @param string $keywords
* @param string $module
* @param string $method
* @param string $extra
* @param int $objectID
* @access public
* @return void
*/
public function ajaxGetMatchedItems($keywords, $module, $method, $extra, $objectID)
{
$this->view->link = $this->loadModel('product')->getProductLink($module, $method, $extra, true);
@@ -51,6 +79,14 @@ class branch extends control
$this->display();
}
/**
* Delete branch
*
* @param int $branchID
* @param string $confirm
* @access public
* @return void
*/
public function delete($branchID, $confirm = 'no')
{
if($confirm == 'no') die(js::confirm($this->lang->branch->confirmDelete, inlink('delete', "branchID=$branchID&confirm=yes")));
@@ -59,6 +95,14 @@ class branch extends control
die(js::reload('parent'));
}
/**
* Ajax get branches.
*
* @param int $productID
* @param int $oldBranch
* @access public
* @return void
*/
public function ajaxGetBranches($productID, $oldBranch = 0)
{
$product = $this->loadModel('product')->getById($productID);
+30
View File
@@ -11,12 +11,27 @@
*/
class branchModel extends model
{
/**
* Get name by id.
*
* @param int $branchID
* @access public
* @return string
*/
public function getById($branchID)
{
if(empty($branchID)) return $this->lang->branch->all;
return $this->dao->select('*')->from(TABLE_BRANCH)->where('id')->eq($branchID)->fetch('name');
}
/**
* Get pairs.
*
* @param int $productID
* @param string $params
* @access public
* @return array
*/
public function getPairs($productID, $params = '')
{
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->eq($productID)->andWhere('deleted')->eq(0)->orderBy('id_asc')->fetchPairs('id', 'name');
@@ -24,6 +39,13 @@ class branchModel extends model
return $branches;
}
/**
* Manage branch
*
* @param int $productID
* @access public
* @return bool
*/
public function manage($productID)
{
$oldBranches = $this->getPairs($productID, 'noempty');
@@ -44,6 +66,14 @@ class branchModel extends model
return dao::isError();
}
/**
* Get branch group by products
*
* @param array $products
* @param string $params
* @access public
* @return array
*/
public function getByProducts($products, $params = '')
{
$branches = $this->dao->select('*')->from(TABLE_BRANCH)->where('product')->in($products)->andWhere('deleted')->eq(0)->fetchAll();
+1 -1
View File
@@ -16,7 +16,7 @@ function loadProjectBuilds(productID, projectID, index)
{
if(projectID)
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + "&varName=openedBuilds&build=&branch" + branch + "&index=" + index);
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + "&varName=openedBuilds&build=&branch=" + branch + "&index=" + index);
}
else
{
+26
View File
@@ -56,6 +56,12 @@ function loadAll(productID)
}
}
/**
* Load by branch.
*
* @access public
* @return void
*/
function loadBranch()
{
$('#taskIdBox').innerHTML = '<select id="task"></select>'; // Reset the task.
@@ -350,6 +356,13 @@ function setStories(moduleID, productID)
});
}
/**
* Load product branches.
*
* @param int $productID
* @access public
* @return void
*/
function loadProductBranches(productID)
{
$('#branch').remove();
@@ -363,6 +376,19 @@ function loadProductBranches(productID)
})
}
/**
* Load team members of the project as assignedTo list.
*
* @param int $projectID
* @access public
* @return void
*/
function loadAssignedTo(projectID)
{
link = createLink('bug', 'ajaxLoadAssignedTo', 'projectID=' + projectID + '&selectedUser=' + $('#assignedTo').val());
$('#assignedToBox').load(link, function(){$('#assignedTo').chosen(defaultChosenOptions);});
}
/**
* notice for create build.
*
+2 -13
View File
@@ -1,16 +1,3 @@
/**
* Load team members of the project as assignedTo list.
*
* @param int $projectID
* @access public
* @return void
*/
function loadAssignedTo(projectID)
{
link = createLink('bug', 'ajaxLoadAssignedTo', 'projectID=' + projectID + '&selectedUser=' + $('#assignedTo').val());
$('#assignedToBox').load(link, function(){$('#assignedTo').chosen(defaultChosenOptions);});
}
/**
* Load all users as assignedTo list.
*
@@ -58,6 +45,8 @@ function loadModuleRelated()
*/
function setAssignedTo(moduleID, productID)
{
if(typeof(productID) == 'undefined') productID = $('#product').val();
if(typeof(moduleID) == 'undefined') moduleID = $('#module').val();
link = createLink('bug', 'ajaxGetModuleOwner', 'moduleID=' + moduleID + '&productID=' + productID);
$.get(link, function(owner)
{
+3 -3
View File
@@ -215,7 +215,7 @@ class bugModel extends model
{
return $this->dao->select('*')->from(TABLE_BUG)
->where('product')->eq((int)$productID)
->beginIF(!empty($branch))->andWhere('branch')->in($branch)->fi()
->beginIF(!empty($branch))->andWhere('branch')->eq($branch)->fi()
->beginIF(!empty($moduleIds))->andWhere('module')->in($moduleIds)->fi()
->andWhere('project')->in(array_keys($projects))
->andWhere('deleted')->eq(0)
@@ -378,7 +378,7 @@ class bugModel extends model
}
$owner = $this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('QD');
return isset($users[$owner]) ? $users[$owner] : '';
return isset($users[$owner]) ? $owner : '';
}
/**
@@ -1365,7 +1365,7 @@ class bugModel extends model
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
->where('t1.product')->eq($productID)
->andWhere('t1.project')->in(array_keys($projects))
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
+1 -1
View File
@@ -31,7 +31,7 @@
<form method='post'>
<?php echo html::checkBox('charts', $lang->bug->report->charts, $checkedCharts, '', 'block');?>
<?php echo html::selectAll('', "button", false, 'btn-sm')?>
<?php echo html::submitButton($lang->bug->report->create);?>
<?php echo html::submitButton($lang->bug->report->create, '', "btn-primary btn-sm");?>
</form>
</div>
</div>
-1
View File
@@ -328,7 +328,6 @@ class build extends control
$this->loadModel('product');
/* Build search form. */
$product = $this->product->getByID($build->product);
$queryID = ($browseType == 'bySearch') ? (int)$param : 0;
unset($this->config->product->search['fields']['product']);
unset($this->config->product->search['fields']['project']);
+7
View File
@@ -3,6 +3,13 @@ $(document).ready(function()
$("a.preview").modalTrigger({width:1000, type:'iframe'});
})
/**
* Load branches
*
* @param int $productID
* @access public
* @return void
*/
function loadBranches(productID)
{
$('#branch').remove();
+4 -4
View File
@@ -76,7 +76,7 @@ class buildModel extends model
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->where('t1.project')->eq((int)$projectID)
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF(strpos($params, 'nodone') !== false)->andWhere('t2.status')->ne('done')->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
@@ -89,7 +89,7 @@ class buildModel extends model
$releases = $this->dao->select('build,name')->from(TABLE_RELEASE)
->where('build')->in(array_keys($builds))
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
->andWhere('deleted')->eq(0)
->fetchPairs();
foreach($releases as $buildID => $releaseName) $builds[$buildID] = $releaseName;
@@ -114,12 +114,12 @@ class buildModel extends model
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
->where('t1.product')->in($products)
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
$releases = $this->dao->select('build,name,deleted')->from(TABLE_RELEASE)
->where('product')->in($products)
->beginIF($branch)->andWhere('branch')->in($branch)->fi()
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
->fetchAll('build');
$builds = array();
+8
View File
@@ -796,6 +796,14 @@ class commonModel extends model
return strpos($orderBy, $append) === false ? $orderBy . ',' . $append . $sort : $orderBy;
}
/**
* Check field exists
*
* @param string $table
* @param string $field
* @access public
* @return bool
*/
public function checkField($table, $field)
{
$fields = $this->dao->query("DESC $table")->fetchAll();
+1
View File
@@ -16,6 +16,7 @@ $(function(){sortTable('.tablesorter');});
function sortTable(obj)
{
if(typeof(obj) == 'undefined') obj = '.tablesorter';
$(obj).tablesorter(
{
saveSort: true,
+1 -1
View File
@@ -38,7 +38,7 @@ class productModel extends model
if($currentModule == 'story' and $currentMethod != 'create' and $currentMethod != 'batchcreate') $currentModule = 'product';
if($currentMethod == 'report') $currentMethod = 'browse';
$selectHtml = $this->select($products, $productID, $currentModule, $currentMethod, $extra, $branch);
$selectHtml = $this->select($products, $productID, $currentModule, $currentMethod, $extra, $branch);
foreach($this->lang->product->menu as $key => $menu)
{
$replace = $key == 'list' ? $selectHtml : $productID;
+1 -1
View File
@@ -57,7 +57,7 @@ class productplan extends control
$begin = date('Y-m-d', strtotime("+$delta days", $timestamp));
}
$this->view->begin = $lastPlan ? $begin : '';
$this->view->begin = $lastPlan ? $begin : '';
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->create;
$this->view->position[] = $this->lang->productplan->common;
+1 -1
View File
@@ -261,7 +261,7 @@ class productplanModel extends model
* @access public
* @return void
*/
public function unlinkBug($bugID, $planID)
public function unlinkBug($bugID)
{
$planID = $this->dao->findByID($bugID)->from(TABLE_BUG)->fetch('plan');
$this->dao->update(TABLE_STORY)->set('plan')->eq(0)->where('id')->eq((int)$bugID)->exec();
+1 -1
View File
@@ -1702,7 +1702,7 @@ class project extends control
*/
public function ajaxGetProducts($projectID)
{
$products = $this->project->getProducts($projectID, false);
$products = $this->project->getProducts($projectID, false);
die(html::select('product', $products, '', 'class="form-control"'));
}
+27 -20
View File
@@ -109,29 +109,36 @@ function computeEndDate(delta)
computeWorkDays();
}
/**
* Load branches.
*
* @param int $product
* @access public
* @return void
*/
function loadBranches(product)
{
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-3">' + $('#productsBox .col-sm-3:last').html() + '</div>');
if($('#productsBox .input-group:last select').size() >= 2)$('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
$('#productsBox .input-group:last .chosen').chosen(defaultChosenOptions);
}
if($('#productsBox .input-group:last select:first').val() != 0)
{
var length = $('#productsBox .input-group').size();
$('#productsBox .row').append('<div class="col-sm-3">' + $('#productsBox .col-sm-3:last').html() + '</div>');
if($('#productsBox .input-group:last select').size() >= 2)$('#productsBox .input-group:last select:last').remove();
$('#productsBox .input-group:last .chosen-container').remove();
$('#productsBox .input-group:last select:first').attr('name', 'products[' + length + ']').attr('id', 'products' + length);
$('#productsBox .input-group:last .chosen').chosen(defaultChosenOptions);
}
var $inputgroup = $(product).closest('.input-group');
if($inputgroup.find('select').size() >= 2)$inputgroup.find('select:last').remove();
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val()), function(data)
{
if(data)
{
$inputgroup.append(data);
$inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).css('width', '80px');
}
})
var $inputgroup = $(product).closest('.input-group');
if($inputgroup.find('select').size() >= 2)$inputgroup.find('select:last').remove();
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val()), function(data)
{
if(data)
{
$inputgroup.append(data);
$inputgroup.find('select:last').attr('name', 'branch[' + index + ']').attr('id', 'branch' + index).css('width', '80px');
}
})
}
/* Auto compute the work days. */
+7
View File
@@ -3,6 +3,13 @@ $(document).ready(function()
$("a.preview").modalTrigger({width:1000, type:'iframe'});
})
/**
* Load branch builds.
*
* @param int $branchID
* @access public
* @return void
*/
function loadBranchBuilds(branchID)
{
if(page == 'create')
+3 -5
View File
@@ -243,10 +243,9 @@ class story extends control
$moduleOptionMenu['same'] = $this->lang->story->same;
$plans = $this->loadModel('productplan')->getPairs($productID, 'unexpired');
$plans['same'] = $this->lang->story->same;
$priList = (array)$this->lang->story->priList;
$priList['same'] = $this->lang->story->same;
$branches['same'] = $this->lang->story->same;
$plans['same'] = $this->lang->story->same;
$priList = (array)$this->lang->story->priList;
$priList['same'] = $this->lang->story->same;
$this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchCreate;
$this->view->productName = $product->name;
@@ -264,7 +263,6 @@ class story extends control
$this->view->estimate = $estimate;
$this->view->storyTitle = $title;
$this->view->spec = $spec;
$this->view->branches = $branches;
$this->view->branch = $branch;
$this->display();
-1
View File
@@ -1,7 +1,6 @@
#mailto {width:90.3%}
select {border:1px solid #ccc}
#module_chosen.chosen-container .chosen-drop {min-width: 400px; border-top: 1px solid #ddd!important}
#branch_chosen.chosen-container .chosen-choices{width:100px;}
.row .col-sm-8{width:76%}
.row .col-sm-2{padding-left:0px; padding-right:0px; width:12%}
+1 -1
View File
@@ -243,7 +243,6 @@ class storyModel extends model
$data->plan = $stories->plan[$i];
$data->title = $stories->title[$i];
$data->pri = $stories->pri[$i] != '' ? $stories->pri[$i] : 0;
$data->branch = $stories->branch[$i];
$data->estimate = $stories->estimate[$i] != '' ? $stories->estimate[$i] : 0;
$data->status = $stories->needReview[$i] == 0 ? 'active' : 'draft';
$data->product = $productID;
@@ -1816,6 +1815,7 @@ class storyModel extends model
*/
public function mergePlanTitle($productID, $stories, $branch = 0)
{
$query = $this->dao->get();
$plans = $this->dao->select('id,title')->from(TABLE_PRODUCTPLAN)
->where('product')->in($productID)
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
+1 -1
View File
@@ -183,7 +183,7 @@ class task extends control
die(js::locate($storyLink, 'parent'));
}
$stories = $this->story->getProjectStoryPairs($projectID, 0, 0, 'short');
$stories = $this->story->getProjectStoryPairs($projectID, 0, 0, 0, 'short');
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$modules = $this->loadModel('tree')->getTaskOptionMenu($projectID);
$title = $project->name . $this->lang->colon . $this->lang->task->batchCreate;
+5
View File
@@ -5,6 +5,11 @@ $(document).ready(function()
var select = $(this).prev('select');
var id = $(select).attr('id');
if(id.indexOf('story') != -1)
{
index = id.substring(5);
module = $('#module' + index).val();
if(module == 'same')
{
for(var i = index - 1; i >=0; i--)
{
if($('#module' + i).val() != 'same')
+13
View File
@@ -13,6 +13,12 @@ function loadAll(productID)
setStories();
}
/**
* Load by branch.
*
* @access public
* @return void
*/
function loadBranch()
{
var branch = $('#branch').val();
@@ -21,6 +27,13 @@ function loadBranch()
setStories();
}
/**
* Load product branches.
*
* @param int $productID
* @access public
* @return void
*/
function loadProductBranches(productID)
{
$('#branch').remove();