diff --git a/module/bug/js/batchedit.js b/module/bug/js/batchedit.js index b50a1c2305..a66f0cf3f5 100644 --- a/module/bug/js/batchedit.js +++ b/module/bug/js/batchedit.js @@ -27,38 +27,29 @@ $(function() }); }) -$(document).on('click', '.chosen-with-drop', function() -{ - var $select = $(this).prev('select'); - oldValue = $select.val(); -}) - $(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 index = $(this).closest('td').index(); + var row = $(this).closest('tr').index(); + 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(); + } 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; } - var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; - if(valueStr.indexOf(',' + value + ',') != -1) - { - $(this).val(value); - } - else - { - alert(dittoNotice); - $(this).val(oldValue); - } - + $(this).val(value); $(this).trigger("chosen:updated"); $(this).trigger("change"); } diff --git a/module/bug/model.php b/module/bug/model.php index 3d4939558d..1813bf7047 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -501,6 +501,24 @@ class bugModel extends model if(!empty($bugIDList)) { + /* Process the data if the value is 'ditto'. */ + foreach($bugIDList as $bugID) + { + if($data->types[$bugID] == 'ditto') $data->types[$bugID] = isset($prev['type']) ? $prev['type'] : ''; + if($data->severities[$bugID] == 'ditto') $data->severities[$bugID] = isset($prev['severity']) ? $prev['severity'] : 3; + if($data->pris[$bugID] == 'ditto') $data->pris[$bugID] = isset($prev['pri']) ? $prev['pri'] : 0; + if($data->assignedTos[$bugID] == 'ditto') $data->assignedTos[$bugID] = isset($prev['assignedTo']) ? $prev['assignedTo'] : ''; + if($data->resolvedBys[$bugID] == 'ditto') $data->resolvedBys[$bugID] = isset($prev['resolvedBy']) ? $prev['resolvedBy'] : ''; + if($data->resolutions[$bugID] == 'ditto') $data->resolutions[$bugID] = isset($prev['resolution']) ? $prev['resolution'] : ''; + + $prev['type'] = $data->types[$bugID]; + $prev['severity'] = $data->severities[$bugID]; + $prev['pri'] = $data->pris[$bugID]; + $prev['assignedTo'] = $data->assignedTos[$bugID]; + $prev['resolvedBy'] = $data->resolvedBys[$bugID]; + $prev['resolution'] = $data->resolutions[$bugID]; + } + /* Initialize bugs from the post data.*/ foreach($bugIDList as $bugID) { diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 8a3010a840..f8346f8087 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -22,7 +22,7 @@ - + @@ -33,43 +33,47 @@ - - type != 'designchange') unset($typeList['designchange']); - if($bugs[$bugID]->type != 'newfeature') unset($typeList['newfeature']); - if($bugs[$bugID]->type != 'trackthings') unset($typeList['trackthings']); - ?> - - - - - - - - - - - - - - - - + + + type != 'designchange') unset($typeList['designchange']); + if($bugs[$bugID]->type != 'newfeature') unset($typeList['newfeature']); + if($bugs[$bugID]->type != 'trackthings') unset($typeList['trackthings']); + ?> + + + + + + + + + + + + + + + + + + +
idAB;?>idAB;?> bug->type;?> bug->severityAB;?> bug->pri;?>bug->resolutionAB;?>
type, 'class=form-control');?>severity, 'class=form-control');?>pri, 'class=form-control');?> title, 'class=form-control');?>assignedTo, "class='form-control chosen'");?>bug->statusList, $bugs[$bugID]->status, 'class=form-control');?>resolvedBy, "class='form-control chosen'");?> - - - - - -
- resolution, "class=form-control onchange=setDuplicate(this.value,$bugID)");?> - ' resolution != 'duplicate') echo "style='display:none'";?>> - bug->duplicateBug}'");?> -
-
type, 'class=form-control');?>severity, 'class=form-control');?>pri, 'class=form-control');?> title, 'class=form-control');?>assignedTo, "class='form-control chosen'");?>bug->statusList, $bugs[$bugID]->status, 'class=form-control');?>resolvedBy, "class='form-control chosen'");?> + + + + + +
+ resolution, "class=form-control onchange=setDuplicate(this.value,$bugID)");?> + ' resolution != 'duplicate') echo "style='display:none'";?>> + bug->duplicateBug}'");?> +
+
diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index f0b5b2c9f2..396fc57f00 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -35,36 +35,50 @@ $(function() }); }) -$(document).on('click', '.chosen-with-drop', function() -{ - var $select = $(this).prev('select'); - oldValue = $select.val(); -}) +$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();}) $(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 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(); + } 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; } - var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; - if(valueStr.indexOf(',' + value + ',') != -1) + isModules = $(this).attr('name').indexOf('modules') != -1; + isPlans = $(this).attr('name').indexOf('plans') != -1; + + if(isModules || isPlans) { - $(this).val(value); + + var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; + if(valueStr.indexOf(',' + value + ',') != -1) + { + $(this).val(value); + } + else + { + alert(dittoNotice); + $(this).val(oldValue); + } } else { - alert(dittoNotice); - $(this).val(oldValue); + $(this).val(value); } $(this).trigger("chosen:updated"); diff --git a/module/story/model.php b/module/story/model.php index 68af5a8418..20e86d8415 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -483,6 +483,27 @@ class storyModel extends model if(!empty($storyIDList)) { $oldStories = $this->getByList($storyIDList); + + /* Process the data if the value is 'ditto'. */ + foreach($storyIDList as $storyID) + { + if($data->pris[$storyID] == 'ditto') $data->pris[$storyID] = isset($prev['pri']) ? $prev['pri'] : 0; + if($data->modules[$storyID] == 'ditto') $data->modules[$storyID] = isset($prev['module']) ? $prev['module'] : 0; + if($data->plans[$storyID] == 'ditto') $data->plans[$storyID] = isset($prev['plan']) ? $prev['plan'] : 0; + if($data->sources[$storyID] == 'ditto') $data->sources[$storyID] = isset($prev['source']) ? $prev['source'] : ''; + if(isset($data->stages[$storyID]) and ($data->stages[$storyID] == 'ditto')) $data->stages[$storyID] = isset($prev['stage']) ? $prev['stage'] : ''; + if(isset($data->closedBys[$storyID]) and ($data->closedBys[$storyID] == 'ditto')) $data->closedBys[$storyID] = isset($prev['closedBy']) ? $prev['closedBy'] : ''; + if(isset($data->closedReasons[$storyID]) and ($data->closedReasons[$storyID] == 'ditto')) $data->closedReasons[$storyID] = isset($prev['closedReason']) ? $prev['closedReason'] : ''; + + $prev['pri'] = $data->pris[$storyID]; + $prev['module'] = $data->modules[$storyID]; + $prev['plan'] = $data->plans[$storyID]; + $prev['source'] = $data->sources[$storyID]; + if(isset($data->stages[$storyID])) $prev['stage'] = $data->stages[$storyID]; + if(isset($data->closedBys[$storyID])) $prev['closedBy'] = $data->closedBys[$storyID]; + if(isset($data->closedReasons[$storyID])) $prev['closedReason'] = $data->closedReasons[$storyID]; + } + foreach($storyIDList as $storyID) { $oldStory = $oldStories[$storyID]; diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index 4ec244e3a0..5809889e6b 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -38,66 +38,70 @@ story->closedReason;?> - - 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; + + + 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; - $productPlans = $this->productplan->getPairs($stories[$storyID]->product, $branch); - $productPlans['ditto'] = $this->lang->story->ditto; - } - ?> - - - module, "class='form-control chosen'");?> - plan, "class='form-control chosen'");?> - title, 'class=form-control'); ?> - estimate, "class='form-control' autocomplete='off'"); ?> - pri, 'class=form-control');?> - source, 'class=form-control');?> - story->statusList[$stories[$storyID]->status];?> + $productPlans = $this->productplan->getPairs($stories[$storyID]->product, $branch); + $productPlans['ditto'] = $this->lang->story->ditto; + } + ?> + + + module, "class='form-control chosen'");?> + plan, "class='form-control chosen'");?> + title, 'class=form-control'); ?> + estimate, "class='form-control' autocomplete='off'"); ?> + pri, 'class=form-control');?> + source, 'class=form-control');?> + story->statusList[$stories[$storyID]->status];?> - status != 'draft'):?> - stage, 'class=form-control');?> - - stage, 'class="form-control" disabled="disabled"');?> + status != 'draft'):?> + stage, 'class=form-control');?> + + stage, 'class="form-control" disabled="disabled"');?> + + + status == 'closed'):?> + closedBy, "class='form-control chosen'");?> + + closedBy, 'class="form-control" disabled="disabled"');?> + + + status == 'closed'):?> + + + + + + + +
+ closedReason, "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 70px'");?> + ' closedReason != 'duplicate') echo "style='display:none'";?>> + idAB}'");?> + ' closedReason != 'subdivided') echo "style='display:none'";?>> + idAB}'");?> +
+ + + closedReason, 'class="form-control" disabled="disabled"');?> + + + + +
- - status == 'closed'):?> - closedBy, "class='form-control chosen'");?> - - closedBy, 'class="form-control" disabled="disabled"');?> - - - status == 'closed'):?> - - - - - - - -
- closedReason, "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 70px'");?> - ' closedReason != 'duplicate') echo "style='display:none'";?>> - idAB}'");?> - ' closedReason != 'subdivided') echo "style='display:none'";?>> - idAB}'");?> -
- - - closedReason, 'class="form-control" disabled="disabled"');?> - - - - -
- - + + + + diff --git a/module/task/js/batchedit.js b/module/task/js/batchedit.js index f647b28e71..6d83b04f51 100644 --- a/module/task/js/batchedit.js +++ b/module/task/js/batchedit.js @@ -8,36 +8,44 @@ $(function() }); }) -$(document).on('click', '.chosen-with-drop', function() -{ - var $select = $(this).prev('select'); - oldValue = $select.val(); -}) +$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();}) $(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 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 = $(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; } - - var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; - if(valueStr.indexOf(',' + value + ',') != -1) + + isModules = $(this).attr('name').indexOf('modules') != -1; + isAssignedTos = $(this).attr('name').indexOf('assignedTos') != -1; + isFinishedBys = $(this).attr('name').indexOf('finishedBys') != -1; + isClosedBys = $(this).attr('name').indexOf('closedBys') != -1; + + if(isModules || isAssignedTos || isFinishedBys || isClosedBys) { - $(this).val(value); + var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; + if(valueStr.indexOf(',' + value + ',') != -1) + { + $(this).val(value); + } + else + { + alert(dittoNotice); + $(this).val(oldValue); + } } else { - alert(dittoNotice); - $(this).val(oldValue); + $(this).val(value); } $(this).trigger("chosen:updated"); diff --git a/module/task/model.php b/module/task/model.php index 159253b99f..94be620170 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -281,6 +281,26 @@ class taskModel extends model /* Adjust whether the post data is complete, if not, remove the last element of $taskIDList. */ if($this->session->showSuhosinInfo) array_pop($taskIDList); + /* Process data if the value is 'ditto'. */ + foreach($taskIDList as $taskID) + { + if(isset($data->modules[$taskID]) and ($data->modules[$taskID] == 'ditto')) $data->modules[$taskID] = isset($prev['module']) ? $prev['module'] : 0; + if($data->types[$taskID] == 'ditto') $data->types[$taskID] = isset($prev['type']) ? $prev['type'] : ''; + if($data->statuses[$taskID] == 'ditto') $data->statuses[$taskID] = isset($prev['status']) ? $prev['status'] : ''; + if($data->assignedTos[$taskID] == 'ditto') $data->assignedTos[$taskID] = isset($prev['assignedTo']) ? $prev['assignedTo'] : ''; + if($data->pris[$taskID] == 'ditto') $data->pris[$taskID] = isset($prev['pri']) ? $prev['pri'] : 0; + if($data->finishedBys[$taskID] == 'ditto') $data->finishedBys[$taskID] = isset($prev['finishedBy']) ? $prev['finishedBy'] : ''; + if($data->closedBys[$taskID] == 'ditto') $data->closedBys[$taskID] = isset($prev['closedBy']) ? $prev['closedBy'] : ''; + + $prev['module'] = $data->modules[$taskID]; + $prev['type'] = $data->types[$taskID]; + $prev['status'] = $data->statuses[$taskID]; + $prev['assignedTo'] = $data->assignedTos[$taskID]; + $prev['pri'] = $data->pris[$taskID]; + $prev['finishedBy'] = $data->finishedBys[$taskID]; + $prev['closedBy'] = $data->closedBys[$taskID]; + } + /* Initialize tasks from the post data.*/ foreach($taskIDList as $taskID) { diff --git a/module/task/view/batchedit.html.php b/module/task/view/batchedit.html.php index 17f2a08ed6..6f02b14050 100755 --- a/module/task/view/batchedit.html.php +++ b/module/task/view/batchedit.html.php @@ -23,7 +23,7 @@ - + @@ -38,45 +38,43 @@ - - 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; + + + 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; - $members = $this->project->getTeamMemberPairs($tasks[$taskID]->project, 'nodeleted'); - $members['ditto'] = $this->lang->task->ditto; - } - ?> - - - - - - - - - - - - - - - - + $members = $this->project->getTeamMemberPairs($tasks[$taskID]->project, 'nodeleted'); + $members['ditto'] = $this->lang->task->ditto; + } + ?> + + + + + + + + + + + + + + + + - - - + + + + - +
idAB;?>idAB;?> task->name?> task->module?> task->assignedTo;?>task->closedReason;?>
name, 'class=form-control');?>module, "class='form-control chosen'")?>assignedTo, "class='form-control chosen'");?>type, 'class=form-control');?>status, 'class=form-control');?>pri, 'class=form-control');?>estimate, "class='form-control text-center' autocomplete='off'");?>left, "class='form-control text-center' autocomplete='off'");?>finishedBy, "class='form-control chosen'");?>closedBy, "class='form-control chosen'");?>task->reasonList, $tasks[$taskID]->closedReason, 'class=form-control');?>
name, 'class=form-control');?>module, "class='form-control chosen'")?>assignedTo, "class='form-control chosen'");?>type, 'class=form-control');?>status, 'class=form-control');?>pri, 'class=form-control');?>estimate, "class='form-control text-center' autocomplete='off'");?>left, "class='form-control text-center' autocomplete='off'");?>finishedBy, "class='form-control chosen'");?>closedBy, "class='form-control chosen'");?>task->reasonList, $tasks[$taskID]->closedReason, 'class=form-control');?>
-
-
- -
diff --git a/module/testcase/control.php b/module/testcase/control.php index dace8c9658..cbd19d61dd 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -585,6 +585,7 @@ class testcase extends control /* Set pri and type list. */ $this->lang->testcase->priList['ditto'] = $this->lang->testcase->ditto; $this->lang->testcase->typeList['ditto'] = $this->lang->testcase->ditto; + /* Assign. */ $this->view->position[] = $this->lang->testcase->common; $this->view->position[] = $this->lang->testcase->batchEdit; diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js index eecba1b295..d9b4259fcd 100644 --- a/module/testcase/js/batchedit.js +++ b/module/testcase/js/batchedit.js @@ -38,36 +38,39 @@ function setDuplicateAndChild(resolution, storyID) } } -$(document).on('click', '.chosen-with-drop', function() -{ - var $select = $(this).prev('select'); - oldValue = $select.val(); -}) +$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();}) $(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 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 = $(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; } - var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; - if(valueStr.indexOf(',' + value + ',') != -1) + if($(this).attr('name').indexOf('modules') != -1) { - $(this).val(value); + var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; + if(valueStr.indexOf(',' + value + ',') != -1) + { + $(this).val(value); + } + else + { + alert(dittoNotice); + $(this).val(oldValue); + } } else { - alert(dittoNotice); - $(this).val(oldValue); + $(this).val(value); } $(this).trigger("chosen:updated"); diff --git a/module/testcase/model.php b/module/testcase/model.php index 044c322a9a..555e7bdebb 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -558,6 +558,18 @@ class testcaseModel extends model /* Adjust whether the post data is complete, if not, remove the last element of $caseIDList. */ if($this->session->showSuhosinInfo) array_pop($caseIDList); + /* Process data if the value is 'ditto'. */ + foreach($caseIDList as $caseID) + { + if($data->pris[$caseID] == 'ditto') $data->pris[$caseID] = isset($prev['pri']) ? $prev['pri'] : 3; + if($data->modules[$caseID] == 'ditto') $data->modules[$caseID] = isset($prev['module']) ? $prev['module'] : 0; + if($data->types[$caseID] == 'ditto') $data->types[$caseID] = isset($prev['type']) ? $prev['type'] : ''; + + $prev['pri'] = $data->pris[$caseID]; + $prev['module'] = $data->modules[$caseID]; + $prev['type'] = $data->types[$caseID]; + } + /* Initialize cases from the post data.*/ foreach($caseIDList as $caseID) { diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index b28f54ce34..1f3eec4214 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -31,30 +31,31 @@ testcase->stage;?> - - - 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; - } - ?> - - - pri, 'class=form-control');?> - testcase->statusList, $cases[$caseID]->status, 'class=form-control');?> - module, "class='form-control chosen'");?> - title, 'class=form-control'); echo "*";?> - type, 'class=form-control');?> - testcase->stageList, $cases[$caseID]->stage, "class='form-control chosen' multiple data-placeholder='{$lang->testcase->stage}'");?> - - - -
- + + + 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; + } + ?> + + + pri, 'class=form-control');?> + testcase->statusList, $cases[$caseID]->status, 'class=form-control');?> + module, "class='form-control chosen'");?> + title, 'class=form-control'); echo "*";?> + type, 'class=form-control');?> + testcase->stageList, $cases[$caseID]->stage, "class='form-control chosen' multiple data-placeholder='{$lang->testcase->stage}'");?> + + + +
+ +