* Optimize bug batchEdit.
This commit is contained in:
+32
-6
@@ -1417,8 +1417,7 @@ class bug extends control
|
||||
$this->view->showFields = $this->config->bug->custom->batchEditFields;
|
||||
|
||||
/* Set users. */
|
||||
$users = $this->loadModel('user')->getPairs('devfirst', '', $this->config->batchMaxCount);
|
||||
$users = array('' => '', 'ditto' => $this->lang->bug->ditto) + $users;
|
||||
$users = $this->loadModel('user')->getPairs();
|
||||
|
||||
$branchIdList = array();
|
||||
$projectIdList = array();
|
||||
@@ -1444,12 +1443,37 @@ class bug extends control
|
||||
}
|
||||
}
|
||||
|
||||
$this->config->moreLinks["duplicateBugs[{$bug->id}]"] = inlink('ajaxGetProductBugs', "productID={$bug->product}&bugID={$bug->id}&type=json");
|
||||
if(!empty($this->config->user->moreLink))
|
||||
$bug->assignedToList = array();
|
||||
if($this->app->tab == 'project' or $this->app->tab == 'execution')
|
||||
{
|
||||
$this->config->moreLinks["resolvedBys[$bug->id]"] = $this->config->user->moreLink;
|
||||
$this->config->moreLinks["assignedTos[$bug->id]"] = $this->config->user->moreLink;
|
||||
if($bug->execution)
|
||||
{
|
||||
$bug->assignedToList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $executionMembers[$bug->execution];
|
||||
}
|
||||
elseif($bug->project)
|
||||
{
|
||||
$bug->assignedToList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $projectMembers[$bug->project];
|
||||
}
|
||||
else
|
||||
{
|
||||
$bug->assignedToList = $productMembers[$bug->product][$bug->branch];
|
||||
if(empty($bug->assignedToList))
|
||||
{
|
||||
$bug->assignedToList = $users;
|
||||
$this->config->moreLinks["assignedTos[$bug->id]"] = helper::createLink('user', 'ajaxGetMore');
|
||||
unset($bug->assignedToList['closed']);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$bug->assignedToList = $users;
|
||||
$this->config->moreLinks["assignedTos[$bug->id]"] = helper::createLink('user', 'ajaxGetMore');
|
||||
unset($bug->assignedToList['closed']);
|
||||
}
|
||||
|
||||
$this->config->moreLinks["duplicateBugs[{$bug->id}]"] = inlink('ajaxGetProductBugs', "productID={$bug->product}&bugID={$bug->id}&type=json");
|
||||
$this->config->moreLinks["resolvedBys[$bug->id]"] = helper::createLink('user', 'ajaxGetMore');
|
||||
}
|
||||
|
||||
/* Get assigned to member. */
|
||||
@@ -1938,6 +1962,8 @@ class bug extends control
|
||||
$this->bug->checkBugExecutionPriv($bug);
|
||||
$this->qa->setMenu($this->products, $productID, $bug->branch);
|
||||
|
||||
$this->config->moreLinks['duplicateBug'] = inlink('ajaxGetProductBugs', "productID={$productID}&bugID={$bugID}&type=json");
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->resolve;
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $users;
|
||||
|
||||
@@ -24,7 +24,7 @@ $(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev(
|
||||
/* Set ditto value. */
|
||||
$(document).on('change', 'select', function()
|
||||
{
|
||||
if($(this).val() == 'ditto')
|
||||
if($(this).data('zui.picker').getValue() == 'ditto')
|
||||
{
|
||||
var index = $(this).closest('td').index();
|
||||
var row = $(this).closest('tr').index();
|
||||
@@ -38,34 +38,34 @@ $(document).on('change', 'select', function()
|
||||
}
|
||||
|
||||
var value = '';
|
||||
var label = '';
|
||||
for(i = row - 1; i >= 0; i--)
|
||||
{
|
||||
value = tbody.children('tr').eq(i).find('td').eq(index).find('select').val();
|
||||
value = tbody.children('tr').eq(i).find('td').eq(index).find('select').data('zui.picker').getValue();
|
||||
label = tbody.children('tr').eq(i).find('td').eq(index).find('select').data('zui.picker').getListItem(value).text;
|
||||
if(value != 'ditto') break;
|
||||
}
|
||||
|
||||
isPlans = $(this).attr('name').indexOf('plans') != -1;
|
||||
|
||||
$(this).data('zui.picker').updateOptionList([{text: label, value}]);
|
||||
if(isPlans)
|
||||
{
|
||||
var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ',';
|
||||
if(valueStr.indexOf(',' + value + ',') != -1)
|
||||
{
|
||||
$(this).val(value);
|
||||
$(this).data('zui.picker').setValue(value);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert(dittoNotice);
|
||||
$(this).val(oldValue);
|
||||
$(this).data('zui.picker').setValue(oldValue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).val(value);
|
||||
$(this).data('zui.picker').setValue(value);
|
||||
}
|
||||
|
||||
$(this).trigger("chosen:updated");
|
||||
$(this).trigger("change");
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -2,23 +2,6 @@ function setDuplicate(resolution)
|
||||
{
|
||||
if(resolution == 'duplicate')
|
||||
{
|
||||
$.ajaxSettings.async = false;
|
||||
link = createLink('bug', 'ajaxGetProductBugs', 'projectID=' + productID + '&bugID=' + bugID);
|
||||
link = link + (link.indexOf('?') !== -1 ? '&' : '?') + 'limit=200';
|
||||
remoteLink = createLink('bug', 'ajaxGetProductBugs', 'productID=' + productID + '&bugID=' + bugID + '&type=json');
|
||||
remoteLink = remoteLink + (remoteLink.indexOf('?') !== -1 ? '&' : '?') + 'search={search}';
|
||||
$.get(link, function(data)
|
||||
{
|
||||
$('#duplicateBug').replaceWith(data);
|
||||
$('#pk_duplicateBug-search').parent().parent().remove();
|
||||
$('#duplicateBug').picker(
|
||||
{
|
||||
disableEmptySearch : true,
|
||||
dropWidth : 'auto',
|
||||
remote: remoteLink
|
||||
});
|
||||
});
|
||||
$.ajaxSettings.async = true;
|
||||
$('#duplicateBugBox').show();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -561,7 +561,7 @@ class bugModel extends model
|
||||
|
||||
$bug = $this->loadModel('file')->replaceImgURL($bug, 'steps');
|
||||
if($setImgSize) $bug->steps = $this->file->setImgSize($bug->steps);
|
||||
foreach($bug as $key => $value) if(strpos($key, 'Date') !== false and !(int)substr($value, 0, 4)) $bug->$key = '';
|
||||
foreach($bug as $key => $value) if(strpos($key, 'Date') !== false && $value && !(int)substr($value, 0, 4)) $bug->$key = '';
|
||||
|
||||
if($bug->duplicateBug) $bug->duplicateBugTitle = $this->dao->findById($bug->duplicateBug)->from(TABLE_BUG)->fields('title')->fetch('title');
|
||||
if($bug->case) $bug->caseTitle = $this->dao->findById($bug->case)->from(TABLE_CASE)->fields('title')->fetch('title');
|
||||
|
||||
@@ -129,12 +129,12 @@
|
||||
unset($assignedToList['closed']);
|
||||
}
|
||||
?>
|
||||
<td class='<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo $bug->status == 'closed' ? html::input("assignedTos[$bugID]", ucfirst($bug->assignedTo), 'class=form-control disabled') : html::select("assignedTos[$bugID]", $assignedToList, $bug->assignedTo, "class='form-control picker-select' data-drop-width='135px'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo $bug->status == 'closed' ? html::input("assignedTos[$bugID]", ucfirst($bug->assignedTo), 'class=form-control disabled') : html::select("assignedTos[$bugID]", array('' => '', 'ditto' => $this->lang->bug->ditto) + array($bug->assignedTo => zget($bug->assignedToList, $bug->assignedTo)), $bug->assignedTo, "class='form-control picker-select' data-drop-width='135px'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'deadline', ' hidden')?>' style='overflow:visible'><?php echo html::input("deadlines[$bugID]", helper::isZeroDate($bug->deadline) ? '' : $bug->deadline, "class='form-control form-date'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'os', "class='hidden'")?>><?php echo html::select("os[$bugID][]", $lang->bug->osList, $bug->os, 'class="form-control chosen" multiple');?></td>
|
||||
<td <?php echo zget($visibleFields, 'browser', "class='hidden'")?>><?php echo html::select("browsers[$bugID][]", $lang->bug->browserList, $bug->browser, 'class="form-control chosen" multiple');?></td>
|
||||
<td <?php echo zget($visibleFields, 'keywords', "class='hidden'")?>><?php echo html::input("keywords[$bugID]", $bug->keywords, 'class=form-control');?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>' style='overflow:visible'><?php echo html::select("resolvedBys[$bugID]", $users, $bug->resolvedBy, "class='form-control picker-select' data-drop-width='auto'");?></td>
|
||||
<td class='<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>' style='overflow:visible'><?php echo html::select("resolvedBys[$bugID]", array('' => '', 'ditto' => $this->lang->bug->ditto) + array($bug->resolvedBy => zget($users, $bug->resolvedBy)), $bug->resolvedBy, "class='form-control picker-select' data-drop-width='auto'");?></td>
|
||||
<td <?php echo zget($visibleFields, 'resolution', "class='hidden'")?>>
|
||||
<table class='table-borderless table no-margin table-form'>
|
||||
<tr>
|
||||
|
||||
@@ -1384,13 +1384,13 @@ class user extends control
|
||||
{
|
||||
$params = base64_decode($this->get->params);
|
||||
parse_str($params, $parsedParams);
|
||||
$users = $this->user->getPairs($parsedParams['params'], $parsedParams['usersToAppended']);
|
||||
$users = $this->user->getPairs(zget($parsedParams, 'params', ''), zget($parsedParams, 'usersToAppended', ''));
|
||||
|
||||
$search = $this->get->search;
|
||||
$limit = $this->get->limit;
|
||||
$index = 0;
|
||||
$newUsers = array();
|
||||
if(empty($search)) return array();
|
||||
//if(empty($search)) return array();
|
||||
foreach($users as $account => $realname)
|
||||
{
|
||||
if($index >= $limit) break;
|
||||
|
||||
Reference in New Issue
Block a user