* adjust code for batch create and edit mothod.

This commit is contained in:
chenfeiCF
2016-05-02 11:51:21 +08:00
parent ae1bea822c
commit efd4c1c14c
20 changed files with 106 additions and 147 deletions
+10 -16
View File
@@ -612,7 +612,7 @@ class bug extends control
/* Set plans. */
$plans = $this->loadModel('productplan')->getPairs($productID, $branch);
$plans['ditto'] = $this->lang->bug->ditto;
$plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans;
/* Set product menu. */
$this->bug->setMenu($this->products, $productID, $branch);
@@ -645,27 +645,21 @@ class bug extends control
$this->view->showFields = $this->config->bug->custom->batchEditFields;
/* Set users. */
$users = $this->user->getPairs('nodeleted,devfirst');
$users['ditto'] = $this->lang->bug->ditto;
/* Set ditto option for users and type, severity, pri, resolution list. */
$this->lang->bug->typeList['ditto'] = $this->lang->bug->ditto;
$this->lang->bug->priList['ditto'] = $this->lang->bug->ditto;
$this->lang->bug->resolutionList['ditto'] = $this->lang->bug->ditto;
$this->lang->bug->severityList['ditto'] = $this->lang->bug->ditto;
$this->lang->bug->statusList['ditto'] = $this->lang->bug->ditto;
$this->lang->bug->osList['ditto'] = $this->lang->bug->ditto;
$this->lang->bug->browserList['ditto'] = $this->lang->bug->ditto;
$users = $this->user->getPairs('nodeleted,devfirst');
$users = array('' => '', 'ditto' => $this->lang->bug->ditto) + $users;
/* Assign. */
$this->view->position[] = $this->lang->bug->common;
$this->view->position[] = $this->lang->bug->batchEdit;
$this->view->bugIDList = $bugIDList;
$this->view->productID = $productID;
$this->view->typeList = $this->lang->bug->typeList;
$this->view->priList = (array)$this->lang->bug->priList;
$this->view->resolutionList = $this->lang->bug->resolutionList;
$this->view->severityList = (array)$this->lang->bug->severityList;
$this->view->severityList = array('ditto' => $this->lang->bug->ditto) + $this->lang->bug->severityList;
$this->view->typeList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->typeList;
$this->view->priList = array('0' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->priList;
$this->view->resolutionList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->resolutionList;
$this->view->statusList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->statusList;
$this->view->osList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->osList;
$this->view->browserList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $this->lang->bug->browserList;
$this->view->bugs = $bugs;
$this->view->branch = $branch;
$this->view->users = $users;
+1
View File
@@ -1,6 +1,7 @@
$(function()
{
$(".chosenBox select").chosen(defaultChosenOptions);
removeDitto();//Remove 'ditto' in first row.
})
/**
+6 -13
View File
@@ -17,37 +17,30 @@ function setDuplicate(resolution, bugID)
}
}
$(function()
{
$firstTr = $('.table-form').find('tbody tr:first');
$firstTr.find('td select').each(function()
{
$(this).find("option[value='ditto']").remove();
$(this).trigger("chosen:updated");
});
})
$(document).ready(removeDitto());//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value.
/* Set ditto value. */
$(document).on('change', 'select', function()
{
if($(this).val() == 'ditto')
{
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var $tbody = $(this).closest('tr').parent();
var tbody = $(this).closest('tr').parent();
if($(this).attr('name').indexOf('resolutions') != -1)
{
index = $(this).closest('tr').closest('td').index();
row = $(this).closest('tr').closest('td').parent().index();
$tbody = $(this).closest('tr').closest('td').parent().parent();
tbody = $(this).closest('tr').closest('td').parent().parent();
}
var value = '';
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').val();
if(value != 'ditto') break;
}
+5 -5
View File
@@ -53,8 +53,8 @@ $columns = count($visibleFields) + 2;
<?php
if(!$productID)
{
$plans = $this->loadModel('productplan')->getPairs($bugs[$bugID]->product, $branch);
$plans['ditto'] = $this->lang->story->ditto;
$plans = $this->loadModel('productplan')->getPairs($bugs[$bugID]->product, $branch);
$plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans;
}
/**
* Remove designchange, newfeature, trackings from the typeList, because should be tracked in story or task.
@@ -72,9 +72,9 @@ $columns = count($visibleFields) + 2;
<td title='<?php echo $bugs[$bugID]->title?>'> <?php echo html::input("titles[$bugID]", $bugs[$bugID]->title, 'class=form-control');?></td>
<td class='text-left<?php echo zget($visibleFields, 'productplan', ' hidden')?>' style='overflow:visible'><?php echo html::select("plans[$bugID]", $plans, $bugs[$bugID]->plan, "class='form-control chosen'");?></td>
<td class='text-left<?php echo zget($visibleFields, 'assignedTo', ' hidden')?>' style='overflow:visible'><?php echo html::select("assignedTos[$bugID]", $users, $bugs[$bugID]->assignedTo, "class='form-control chosen'");?></td>
<td <?php echo zget($visibleFields, 'status', "class='hidden'")?>><?php echo html::select("statuses[$bugID]", $lang->bug->statusList, $bugs[$bugID]->status, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'os', "class='hidden'")?>><?php echo html::select("os[$bugID]", $lang->bug->osList, $bugs[$bugID]->os, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'browser', "class='hidden'")?>><?php echo html::select("browsers[$bugID]", $lang->bug->browserList, $bugs[$bugID]->browser, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'status', "class='hidden'")?>><?php echo html::select("statuses[$bugID]", $statusList, $bugs[$bugID]->status, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'os', "class='hidden'")?>><?php echo html::select("os[$bugID]", $osList, $bugs[$bugID]->os, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'browser', "class='hidden'")?>><?php echo html::select("browsers[$bugID]", $browserList, $bugs[$bugID]->browser, 'class=form-control');?></td>
<td <?php echo zget($visibleFields, 'keywords', "class='hidden'")?>><?php echo html::input("keywords[$bugID]", $bugs[$bugID]->keywords, 'class=form-control');?></td>
<td class='text-left<?php echo zget($visibleFields, 'resolvedBy', ' hidden')?>' style='overflow:visible'><?php echo html::select("resolvedBys[$bugID]", $users, $bugs[$bugID]->resolvedBy, "class='form-control chosen'");?></td>
<td <?php echo zget($visibleFields, 'resolution', "class='hidden'")?>>
+10 -14
View File
@@ -388,10 +388,10 @@ class story extends control
$product = $this->product->getByID($productID);
/* Set modules and productPlans. */
$modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
$modules['ditto'] = $this->lang->story->ditto;
$productPlans = $this->productplan->getPairs($productID, $branch);
$productPlans['ditto'] = $this->lang->story->ditto;
$modules = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch);
$modules = array('ditto' => $this->lang->story->ditto) + $modules;
$productPlans = $this->productplan->getPairs($productID, $branch);
$productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;
$this->view->modules = $modules;
$this->view->productPlans = $productPlans;
@@ -421,13 +421,9 @@ class story extends control
$this->view->title = $this->lang->story->batchEdit;
}
/* Set ditto option for users and pri, source, stage list. */
/* Set ditto option for users. */
$users = $this->loadModel('user')->getPairs('nodeleted');
$users['ditto'] = $this->lang->story->ditto;
$this->lang->story->priList['ditto'] = $this->lang->story->ditto;
$this->lang->story->sourceList['ditto'] = $this->lang->story->ditto;
$this->lang->story->stageList['ditto'] = $this->lang->story->ditto;
$this->lang->story->reasonList['ditto'] = $this->lang->story->ditto;
$users = array('' => '', 'ditto' => $this->lang->story->ditto) + $users;
/* Set Custom*/
foreach(explode(',', $this->config->story->list->customBatchEditFields) as $field) $customFields[$field] = $this->lang->story->$field;
@@ -443,10 +439,10 @@ class story extends control
$this->view->position[] = $this->lang->story->common;
$this->view->position[] = $this->lang->story->batchEdit;
$this->view->users = $users;
$this->view->priList = (array)$this->lang->story->priList;
$this->view->sourceList = $this->lang->story->sourceList;
$this->view->reasonList = $this->lang->story->reasonList;
$this->view->stageList = $this->lang->story->stageList;
$this->view->priList = array('0' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->priList;
$this->view->sourceList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->sourceList;
$this->view->reasonList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->reasonList;
$this->view->stageList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->stageList;
$this->view->productID = $productID;
$this->view->storyIDList = $storyIDList;
$this->view->branch = $branch;
+2
View File
@@ -1,3 +1,5 @@
$(document).ready(removeDitto());//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
+10 -17
View File
@@ -25,37 +25,30 @@ function setDuplicateAndChild(resolution, storyID)
}
}
$(function()
{
$firstTr = $('.table-form').find('tbody tr:first');
$firstTr.find('td select').each(function()
{
$(this).find("option[value='ditto']").remove();
$(this).trigger("chosen:updated");
});
})
$(document).ready(removeDitto());//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value.
/* Set ditto value. */
$(document).on('change', 'select', function()
{
if($(this).val() == 'ditto')
{
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var $tbody = $(this).closest('tr').parent();
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var tbody = $(this).closest('tr').parent();
if($(this).attr('name').indexOf('closedReasons') != -1)
{
index = $(this).closest('tr').closest('td').index();
row = $(this).closest('tr').closest('td').parent().index();
$tbody = $(this).closest('tr').closest('td').parent().parent();
index = $(this).closest('tr').closest('td').index();
row = $(this).closest('tr').closest('td').parent().index();
tbody = $(this).closest('tr').closest('td').parent().parent();
}
var value = '';
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').val();
if(value != 'ditto') break;
}
+3 -3
View File
@@ -58,10 +58,10 @@ foreach(explode(',', $showFields) as $field)
$product = $this->product->getByID($stories[$storyID]->product);
$modules = $this->tree->getOptionMenu($stories[$storyID]->product, $viewType = 'story', 0, $branch);
foreach($modules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $product->name . $moduleName;
$modules['ditto'] = $this->lang->story->ditto;
$modules = array('ditto' => $this->lang->story->ditto) + $modules;
$productPlans = $this->productplan->getPairs($stories[$storyID]->product, $branch);
$productPlans['ditto'] = $this->lang->story->ditto;
$productPlans = $this->productplan->getPairs($stories[$storyID]->product, $branch);
$productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;
}
?>
<tr class='text-center'>
+7 -12
View File
@@ -341,11 +341,11 @@ class task extends control
$this->project->setMenu($this->project->getPairs(), $project->id);
/* Set modules and members. */
$modules = $this->tree->getTaskOptionMenu($projectID);
$modules['ditto'] = $this->lang->task->ditto;
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$modules = $this->tree->getTaskOptionMenu($projectID);
$modules = array('ditto' => $this->lang->task->ditto) + $modules;
$members = $this->project->getTeamMemberPairs($projectID, 'nodeleted');
$members = array('' => '', 'ditto' => $this->lang->task->ditto) + $members;
$members['closed'] = 'Closed';
$members['ditto'] = $this->lang->task->ditto;
$this->view->title = $project->name . $this->lang->colon . $this->lang->task->batchEdit;
$this->view->position[] = html::a($this->createLink('project', 'browse', "project=$project->id"), $project->name);
@@ -379,18 +379,13 @@ class task extends control
$this->view->customFields = $customFields;
$this->view->showFields = $this->config->task->custom->batchEditFields;
/* Set ditto option for pri, status and type list. */
$this->lang->task->priList['ditto'] = $this->lang->task->ditto;
$this->lang->task->statusList['ditto'] = $this->lang->task->ditto;
$this->lang->task->typeList['ditto'] = $this->lang->task->ditto;
/* Assign. */
$this->view->position[] = $this->lang->task->common;
$this->view->position[] = $this->lang->task->batchEdit;
$this->view->projectID = $projectID;
$this->view->priList = (array)$this->lang->task->priList;
$this->view->statusList = $this->lang->task->statusList;
$this->view->typeList = $this->lang->task->typeList;
$this->view->priList = array('0' => '', 'ditto' => $this->lang->task->ditto) + $this->lang->task->priList;
$this->view->statusList = array('' => '', 'ditto' => $this->lang->task->ditto) + $this->lang->task->statusList;
$this->view->typeList = array('' => '', 'ditto' => $this->lang->task->ditto) + $this->lang->task->typeList;
$this->view->taskIDList = $taskIDList;
$this->view->tasks = $tasks;
$this->view->projectName = isset($project) ? $project->name : '';
+2
View File
@@ -1,6 +1,8 @@
/* Remove width in defaultChosenOptions. */
delete defaultChosenOptions.width;
$(document).ready(removeDitto());//Remove 'ditto' in first row.
/* Get select of stories.*/
function setStories(moduleID, projectID, num)
{
+7 -14
View File
@@ -1,27 +1,20 @@
$(function()
{
$firstTr = $('.table-form').find('tbody tr:first');
$firstTr.find('td select').each(function()
{
$(this).find("option[value='ditto']").remove();
$(this).trigger("chosen:updated");
});
})
$(document).ready(removeDitto());//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value.
/* Set ditto value. */
$(document).on('change', 'select', function()
{
if($(this).val() == 'ditto')
{
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var $tbody = $(this).closest('tr').parent();
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var tbody = $(this).closest('tr').parent();
var value = '';
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').val();
if(value != 'ditto') break;
}
+3 -3
View File
@@ -59,10 +59,10 @@ foreach(explode(',', $showFields) as $field)
$prjInfo = $this->project->getById($tasks[$taskID]->project);
$modules = $this->tree->getOptionMenu($tasks[$taskID]->project, $viewType = 'task');
foreach($modules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $prjInfo->name. $moduleName;
$modules['ditto'] = $this->lang->task->ditto;
$modules = array('ditto' => $this->lang->task->ditto) + $modules;
$members = $this->project->getTeamMemberPairs($tasks[$taskID]->project, 'nodeleted');
$members['ditto'] = $this->lang->task->ditto;
$members = $this->project->getTeamMemberPairs($tasks[$taskID]->project, 'nodeleted');
$members = array('' => '', 'ditto' => $this->lang->task->ditto) + $members;
}
?>
<tr class='text-center'>
+4 -8
View File
@@ -569,8 +569,8 @@ class testcase extends control
$this->testcase->setMenu($this->products, $productID, $branch);
/* Set modules. */
$modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
$modules['ditto'] = $this->lang->testcase->ditto;
$modules = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch);
$modules = array('ditto' => $this->lang->testcase->ditto) + $modules;
$this->view->modules = $modules;
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
@@ -593,10 +593,6 @@ class testcase extends control
$this->app->session->set('showSuhosinInfo', $showSuhosinInfo);
if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo;
/* Set pri and type list. */
$this->lang->testcase->priList['ditto'] = $this->lang->testcase->ditto;
$this->lang->testcase->typeList['ditto'] = $this->lang->testcase->ditto;
/* Set custom. */
foreach(explode(',', $this->config->testcase->customBatchEditFields) as $field) $customFields[$field] = $this->lang->testcase->$field;
$this->view->customFields = $customFields;
@@ -607,8 +603,8 @@ class testcase extends control
$this->view->position[] = $this->lang->testcase->batchEdit;
$this->view->caseIDList = $caseIDList;
$this->view->productID = $productID;
$this->view->priList = (array)$this->lang->testcase->priList;
$this->view->typeList = $this->lang->testcase->typeList;
$this->view->priList = array('ditto' => $this->lang->testcase->ditto) + $this->lang->testcase->priList;
$this->view->typeList = array('' => '', 'ditto' => $this->lang->testcase->ditto) + $this->lang->testcase->typeList;
$this->view->cases = $cases;
$this->display();
+2
View File
@@ -1,5 +1,7 @@
$(document).ready(function()
{
removeDitto();//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
+8 -18
View File
@@ -1,16 +1,3 @@
$(function()
{
$(".chosen").chosen(defaultChosenOptions);
/* Remove ditto option of select in first row. */
$firstTr = $('.table-form').find('tbody tr:first');
$firstTr.find('td select').each(function()
{
$(this).find("option[value='ditto']").remove();
$(this).trigger("chosen:updated");
});
})
/**
* Set duplicate field.
*
@@ -38,20 +25,23 @@ function setDuplicateAndChild(resolution, storyID)
}
}
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})
$(document).ready(removeDitto());//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();})//Save old value.
/* Set ditto value. */
$(document).on('change', 'select', function()
{
if($(this).val() == 'ditto')
{
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var $tbody = $(this).closest('tr').parent();
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var tbody = $(this).closest('tr').parent();
var value = '';
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').val();
if(value != 'ditto') break;
}
+1 -1
View File
@@ -51,7 +51,7 @@ foreach(explode(',', $showFields) as $field)
$product = $this->product->getByID($cases[$caseID]->product);
$modules = $this->tree->getOptionMenu($cases[$caseID]->product, $viewType = 'case', $startModuleID = 0);
foreach($modules as $moduleID => $moduleName) $modules[$moduleID] = '/' . $product->name . $moduleName;
$modules['ditto'] = $this->lang->testcase->ditto;
$modules = array('ditto' => $this->lang->testcase->ditto) + $modules;
}
?>
<tr class='text-center'>
+2
View File
@@ -21,6 +21,8 @@ function toggleCheck(obj, i)
}
}
$(document).ready(removeDitto());//Remove 'ditto' in first row.
$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
+10 -21
View File
@@ -1,34 +1,23 @@
$(document).on('click', '.chosen-with-drop', function()
{
var select = $(this).prev('select');
if($(select).val() == 'ditto')
{
var index = $(select).closest('td').index();
var row = $(select).closest('tr').index();
var table = $(select).closest('tr').parent();
var value = '';
for(i = row - 1; i >= 0; i--)
{
value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
if(value != 'ditto') break;
}
$(select).val(value);
$(select).trigger("chosen:updated");
}
})
$(document).on('mousedown', 'select', function()
$(document).ready(removeDitto());//Remove 'ditto' in first row.
/* Set ditto value. */
$(document).on('change', 'select', function()
{
if($(this).val() == 'ditto')
{
var index = $(this).closest('td').index();
var row = $(this).closest('tr').index();
var table = $(this).closest('tr').parent();
var tbody = $(this).closest('tr').parent();
var value = '';
for(i = row - 1; i >= 0; i--)
{
value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val();
value = tbody.children('tr').eq(i).find('td').eq(index).find('select').val();
if(value != 'ditto') break;
}
$(this).val(value);
$(this).trigger("chosen:updated");
$(this).trigger("change");
}
})
+2 -2
View File
@@ -52,8 +52,8 @@ $minWidth = (count($visibleFields) > 7) ? 'w-120px' : '';
<th class='w-120px<?php echo zget($visibleFields, 'zipcode', ' hidden')?>'> <?php echo $lang->user->zipcode;?></th>
</tr>
</thead>
<?php $depts = $depts + array('ditto' => $lang->user->ditto)?>
<?php $lang->user->roleList = $lang->user->roleList + array('ditto' => $lang->user->ditto)?>
<?php $depts = array('ditto' => $lang->user->ditto) + $depts;?>
<?php $lang->user->roleList = array('' => '', 'ditto' => $lang->user->ditto) + $lang->user->roleList;?>
<?php $first = true;?>
<?php foreach($users as $user):?>
<?php
+11
View File
@@ -1789,6 +1789,17 @@ function checkTutorial()
}
}
/* Remove 'ditto' in first row when batch create or edit. */
function removeDitto()
{
$firstTr = $('.table-form').find('tbody tr:first');
console.log($firstTr);
$firstTr.find('td select').each(function()
{
$(this).find("option[value='ditto']").remove();
$(this).trigger("chosen:updated");
});
}
/* Ping the server every some minutes to keep the session. */
needPing = true;