Merge branch 'master' of github.com:easysoft/zentaopms
This commit is contained in:
@@ -330,10 +330,10 @@ class bug extends control
|
||||
}
|
||||
|
||||
/* Set team members of the latest project as assignedTo list. */
|
||||
$latestProjectID = $this->product->getLatestProject($productID);
|
||||
if(!empty($latestProjectID))
|
||||
$latestProject = $this->product->getLatestProject($productID);
|
||||
if(!empty($latestProject))
|
||||
{
|
||||
$projectMembers = $this->loadModel('project')->getTeamMemberPairs($latestProjectID, 'nodeleted');
|
||||
$projectMembers = $this->loadModel('project')->getTeamMemberPairs($latestProject->id, 'nodeleted');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -551,15 +551,14 @@ class bug extends control
|
||||
$this->view->position[] = $this->lang->bug->edit;
|
||||
|
||||
/* Assign. */
|
||||
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, 'noempty');
|
||||
if($projectID)
|
||||
{
|
||||
$openedBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
$allBuilds = $this->loadModel('build')->getProjectBuildPairs($projectID, $productID, $branch = 0, 'noempty');
|
||||
$openedBuilds = $this->build->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
}
|
||||
else
|
||||
{
|
||||
$openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, 'noempty');
|
||||
$openedBuilds = $this->build->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
}
|
||||
|
||||
/* Set the openedBuilds list. */
|
||||
@@ -573,10 +572,7 @@ class bug extends control
|
||||
|
||||
/* Set the resolvedBuilds list. */
|
||||
$oldResolvedBuild = array();
|
||||
if($bug->resolvedBuild)
|
||||
{
|
||||
if(isset($allBuilds[$bug->resolvedBuild])) $oldResolvedBuild[$bug->resolvedBuild] = $allBuilds[$bug->resolvedBuild];
|
||||
}
|
||||
if(($bug->resolvedBuild) and isset($allBuilds[$bug->resolvedBuild])) $oldResolvedBuild[$bug->resolvedBuild] = $allBuilds[$bug->resolvedBuild];
|
||||
|
||||
$this->view->bug = $bug;
|
||||
$this->view->productID = $productID;
|
||||
@@ -1102,10 +1098,10 @@ class bug extends control
|
||||
*/
|
||||
public function ajaxLoadProjectTeamMembers($productID, $selectedUser = '')
|
||||
{
|
||||
$latestProjectID = $this->product->getLatestProject($productID);
|
||||
if(!empty($latestProjectID))
|
||||
$latestProject = $this->product->getLatestProject($productID);
|
||||
if(!empty($latestProject))
|
||||
{
|
||||
$projectMembers = $this->loadModel('project')->getTeamMemberPairs($latestProjectID, 'nodeleted');
|
||||
$projectMembers = $this->loadModel('project')->getTeamMemberPairs($latestProject->id, 'nodeleted');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,12 +5,7 @@
|
||||
.confirm1 {color:green; font-size:9px}
|
||||
.red{color:red;}
|
||||
|
||||
.assign-menu {min-width: 150px; overflow: hidden; max-height: 305px}
|
||||
.assign-menu.with-search {padding-bottom: 34px;}
|
||||
.assign-menu > .assign-search {padding: 0; position: absolute; z-index: 0; bottom: 0; left: 0; right: 0}
|
||||
.assign-menu > .assign-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666}
|
||||
|
||||
.fix-menu {min-width: 150px; overflow: hidden}
|
||||
.fix-menu.with-search {padding-bottom: 35px;}
|
||||
.fix-menu > .fix-search {padding: 0; position: absolute; z-index: 0; bottom: 0; left: 0; right: 0}
|
||||
.fix-menu > .fix-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666}
|
||||
.dropdown-menu.with-search {padding-bottom: 34px; min-width: 150px; overflow: hidden; max-height: 305px}
|
||||
.dropdown-menu > .menu-search {padding: 0; position: absolute; z-index: 0; bottom: 0; left: 0; right: 0}
|
||||
.dropdown-menu > .menu-search .input-group {width:100%;}
|
||||
.dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666}
|
||||
|
||||
@@ -4,30 +4,16 @@ $(document).ready(function()
|
||||
$('#module' + moduleID).addClass('active');
|
||||
if(browseType == 'bysearch') ajaxGetSearchForm();
|
||||
|
||||
$('.assign-search').click(function(e)
|
||||
$('.dropdown-menu .with-search .menu-search').click(function(e)
|
||||
{
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}).on('keyup change paste', 'input', function()
|
||||
{
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == '') return $('.assign-menu > .option').removeClass('hide');
|
||||
$('.assign-menu > .option').each(function()
|
||||
{
|
||||
var $option = $(this);
|
||||
$option.toggleClass('hide', $option.text().toString().toLowerCase().indexOf(val) < 0 && $option.data('key').toString().toLowerCase().indexOf(val) < 0);
|
||||
});
|
||||
});
|
||||
|
||||
$('.fix-search').click(function(e)
|
||||
{
|
||||
e.stopPropagation();
|
||||
return false;
|
||||
}).on('keyup change paste', 'input', function()
|
||||
{
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == '') return $('.fix-menu > .option').removeClass('hide');
|
||||
$('.fix-menu > .option').each(function()
|
||||
var $options = $(this).parents('ul.dropdown-menu.with-search').find('.option');
|
||||
if(val == '') return $options.removeClass('hide');
|
||||
$options.each(function()
|
||||
{
|
||||
var $option = $(this);
|
||||
$option.toggleClass('hide', $option.text().toString().toLowerCase().indexOf(val) < 0 && $option.data('key').toString().toLowerCase().indexOf(val) < 0);
|
||||
|
||||
@@ -84,7 +84,8 @@ function loadAllBuilds(that)
|
||||
{
|
||||
if(page == 'resolve')
|
||||
{
|
||||
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build');
|
||||
oldResolvedBuild = $('#resolvedBuild').val() ? $('#resolvedBuild').val() : 0;
|
||||
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=0&index=0&type=all');
|
||||
$('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
}
|
||||
else
|
||||
@@ -119,20 +120,20 @@ function loadAllProjectBuilds(projectID, productID)
|
||||
if(page == 'create')
|
||||
{
|
||||
oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
|
||||
link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
|
||||
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&needCreate=true&type=all');
|
||||
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
|
||||
}
|
||||
if(page == 'edit')
|
||||
{
|
||||
if(buildBox == 'openedBuildBox')
|
||||
{
|
||||
link = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
|
||||
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&needCreate=true&type=all');
|
||||
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
}
|
||||
if(buildBox == 'resolvedBuildBox')
|
||||
{
|
||||
buildLink = createLink('build', 'ajaxGetAllProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
|
||||
$('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=0&index=0&needCreate=true&type=all');
|
||||
$('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,20 +151,20 @@ function loadAllProductBuilds(productID)
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
if(page == 'create')
|
||||
{
|
||||
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
|
||||
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&type=all');
|
||||
$('#buildBox').load(link, function(){ notice(); $('#openedBuild').chosen(defaultChosenOptions);});
|
||||
}
|
||||
if(page == 'edit')
|
||||
{
|
||||
if(buildBox == 'openedBuildBox')
|
||||
{
|
||||
link = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
|
||||
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&type=all');
|
||||
$('#openedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
}
|
||||
if(buildBox == 'resolvedBuildBox')
|
||||
{
|
||||
buildLink = createLink('build', 'ajaxGetAllProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild);
|
||||
$('#resolvedBuildBox').load(buildLink, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=0&index=0&type=all');
|
||||
$('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen(defaultChosenOptions)});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ js::set('moduleID', $moduleID);
|
||||
$withSearch = count($builds) > 4;
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript:;', $resolution, '', "id='fixedItem'");
|
||||
echo "<ul class='dropdown-menu fix-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
unset($builds['']);
|
||||
foreach($builds as $key => $build)
|
||||
{
|
||||
@@ -216,7 +216,7 @@ js::set('moduleID', $moduleID);
|
||||
echo html::a('javascript:;', $build, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\"");
|
||||
echo "</li>";
|
||||
}
|
||||
if($withSearch) echo "<li class='fix-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo '</ul></li>';
|
||||
}
|
||||
else
|
||||
@@ -239,13 +239,13 @@ js::set('moduleID', $moduleID);
|
||||
echo html::select('assignedTo', $memberPairs, '', 'class="hidden"');
|
||||
echo "<li class='dropdown-submenu'>";
|
||||
echo html::a('javascript::', $lang->bug->assignedTo, 'id="assignItem"');
|
||||
echo "<ul class='dropdown-menu assign-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
echo "<ul class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
|
||||
foreach ($memberPairs as $key => $value)
|
||||
{
|
||||
if(empty($key)) continue;
|
||||
echo "<li class='option' data-key='$key'>" . html::a("javascript:$(\".table-actions #assignedTo\").val(\"$key\");setFormAction(\"$actionLink\")", $value, '', '') . '</li>';
|
||||
}
|
||||
if($withSearch) echo "<li class='assign-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
if($withSearch) echo "<li class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></li>";
|
||||
echo "</ul>";
|
||||
echo "</li>";
|
||||
}
|
||||
|
||||
@@ -201,15 +201,25 @@ class build extends control
|
||||
* @param int $productID
|
||||
* @param string $varName the name of the select object to create
|
||||
* @param string $build build to selected
|
||||
* @param int $branch
|
||||
* @param int $index the index of batch create bug.
|
||||
* @param string $type get all builds or some builds belong to normal releases and projects are not done.
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 0, $index = 0)
|
||||
public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 0, $index = 0, $type = 'normal')
|
||||
{
|
||||
if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, $branch, 'noempty,release,noterminate,nodone'), $build, 'size=4 class=form-control multiple'));
|
||||
if($varName == 'openedBuilds' ) die(html::select($varName . "[$index][]", $this->build->getProductBuildPairs($productID, $branch, 'noempty,release'), $build, 'size=4 class=form-control multiple'));
|
||||
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, $branch, 'noempty,release,noterminate,nodone'), $build, "class='form-control'"));
|
||||
if($varName == 'openedBuild' )
|
||||
{
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, $branch, $params), $build, 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'openedBuilds' ) die(html::select($varName . "[$index][]", $this->build->getProductBuildPairs($productID, $branch, 'noempty'), $build, 'size=4 class=form-control multiple'));
|
||||
if($varName == 'resolvedBuild')
|
||||
{
|
||||
$params = ($type == 'all') ? '' : 'noempty, noterminate, nodone';
|
||||
die(html::select($varName, $this->build->getProductBuildPairs($productID, $branch, $params), $build, "class='form-control'"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,61 +228,31 @@ class build extends control
|
||||
* @param int $projectID
|
||||
* @param string $varName the name of the select object to create
|
||||
* @param string $build build to selected
|
||||
* @param int $branch
|
||||
* @param int $index the index of batch create bug.
|
||||
* @param bool $needCreate if need to append the link of create build
|
||||
* @param string $type get all builds or some builds belong to normal releases and projects are not done.
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 0, $index = 0, $needCreate = false)
|
||||
public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 0, $index = 0, $needCreate = false, $type = 'normal')
|
||||
{
|
||||
if($varName == 'openedBuild')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,release,noterminate,nodone');
|
||||
$output = html::select($varName . '[]', $builds , $build, 'size=4 class=form-control multiple');
|
||||
die($output);
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params);
|
||||
die(html::select($varName . '[]', $builds , $build, 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'openedBuilds') die(html::select($varName . "[$index][]", $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'), $build, 'size=4 class=form-control multiple'));
|
||||
if($varName == 'resolvedBuild')
|
||||
{
|
||||
$params = ($type == 'all') ? '' : 'noempty, noterminate, nodone';
|
||||
die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params), $build, "class='form-control'"));
|
||||
}
|
||||
if($varName == 'openedBuilds') die(html::select($varName . "[$index][]", $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'), $build, 'size=4 class=form-control multiple'));
|
||||
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty,noterminate,nodone'), $build, "class='form-control'"));
|
||||
if($varName == 'testTaskBuild') die(html::select('build', $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty'), $build, "class='form-control'"));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get all builds of a product in html select.
|
||||
*
|
||||
* @param int $productID
|
||||
* @param string $varName the name of the select object to create
|
||||
* @param string $build build to selected
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetAllProductBuilds($productID, $varName, $build = '', $branch = 0)
|
||||
{
|
||||
if($varName == 'openedBuild' ) die(html::select($varName . '[]', $this->build->getProductBuildPairs($productID, $branch, 'noempty'), $build, 'size=4 class=form-control multiple'));
|
||||
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProductBuildPairs($productID, $branch), $build, "class='form-control'"));
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get all builds of a project in html select.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param string $varName the name of the select object to create
|
||||
* @param string $build build to selected
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetAllProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 0)
|
||||
{
|
||||
if($varName == 'openedBuild')
|
||||
{
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, 'noempty');
|
||||
$output = html::select($varName . '[]', $builds , $build, 'size=4 class=form-control multiple');
|
||||
die($output);
|
||||
}
|
||||
if($varName == 'resolvedBuild') die(html::select($varName, $this->build->getProjectBuildPairs($projectID, $productID, $branch), $build, "class='form-control'"));
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* AJAX: get builds of a branch in html select.
|
||||
*
|
||||
* @param int $productID
|
||||
|
||||
@@ -742,19 +742,16 @@ class productModel extends model
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return int
|
||||
* @return object
|
||||
*/
|
||||
public function getLatestProject($productID)
|
||||
{
|
||||
$projectList = array_keys($this->loadModel('project')->getPairs('noclosed'));
|
||||
$projects = $this->dao->select('t2.id, t2.name, t2.begin')
|
||||
->from(TABLE_PROJECTPRODUCT)->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
return $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->where('t1.product')->eq((int)$productID)
|
||||
->andWhere('t2.id')->in($projectList)
|
||||
->andWhere('t2.status')->ne('done')
|
||||
->orderBy('t2.begin desc')
|
||||
->fetchAll('id');
|
||||
|
||||
return key($projects);
|
||||
->limit(1)
|
||||
->fetch();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,9 +128,11 @@ class report extends control
|
||||
$begin = $begin ? date('Y-m-d', strtotime($begin)) : date('Y-m-d', strtotime('now'));
|
||||
$end = $end ? date('Y-m-d', strtotime($end)) : date('Y-m-d', strtotime('+1 week'));
|
||||
|
||||
$diffDays = helper::diffDate($end, $begin);
|
||||
$diffDays = round($diffDays - ($diffDays / 7 * 2));
|
||||
$days = $days ? $days : $diffDays;
|
||||
if(!$days)
|
||||
{
|
||||
$diffDays = helper::diffDate($end, $begin);
|
||||
$days = round($diffDays - ($diffDays / 7 * 2));
|
||||
}
|
||||
|
||||
$this->view->title = $this->lang->report->workload;
|
||||
$this->view->position[] = $this->lang->report->workload;
|
||||
|
||||
@@ -21,7 +21,7 @@ class sso extends control
|
||||
public function login($type = 'notify')
|
||||
{
|
||||
$referer = empty($_GET['referer']) ? '' : $this->get->referer;
|
||||
$locate = empty($referer) ? '/' : base64_decode($referer);
|
||||
$locate = empty($referer) ? getWebRoot() : base64_decode($referer);
|
||||
if($this->loadModel('user')->isLogon()) die($this->locate($locate));
|
||||
|
||||
$this->app->loadConfig('sso');
|
||||
|
||||
Reference in New Issue
Block a user