diff --git a/module/bug/control.php b/module/bug/control.php index 59d8f46bd2..68829c2bf7 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -621,14 +621,26 @@ class bug extends control $this->app->session->set('showSuhosinInfo', $showSuhosinInfo); if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo; + /* Set ditto option for users and type, severity, pri, resolution list. */ + $users = $this->user->getPairs('nodeleted,devfirst'); + $users['ditto'] = $this->lang->bug->ditto; + $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; + /* 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->bugs = $bugs; - $this->view->branch = $branch; - $this->view->users = $this->user->getPairs('nodeleted,devfirst'); + $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->bugs = $bugs; + $this->view->branch = $branch; + $this->view->users = $users; $this->display(); } diff --git a/module/bug/js/batchedit.js b/module/bug/js/batchedit.js index 0b26083423..b50a1c2305 100644 --- a/module/bug/js/batchedit.js +++ b/module/bug/js/batchedit.js @@ -16,3 +16,50 @@ function setDuplicate(resolution, bugID) $('#duplicateBugBox' + bugID).hide(); } } + +$(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).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 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; + } + + 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).trigger("chosen:updated"); + $(this).trigger("change"); + } +}) diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 501a074552..8a3010a840 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -39,7 +39,6 @@ * Remove designchange, newfeature, trackings from the typeList, because should be tracked in story or task. * These thress types if upgrade from bugfree2.x. */ - $typeList = $lang->bug->typeList; if($bugs[$bugID]->type != 'designchange') unset($typeList['designchange']); if($bugs[$bugID]->type != 'newfeature') unset($typeList['newfeature']); if($bugs[$bugID]->type != 'trackthings') unset($typeList['trackthings']); @@ -47,8 +46,8 @@ type, 'class=form-control');?> - bug->severityList, $bugs[$bugID]->severity, 'class=form-control');?> - bug->priList, $bugs[$bugID]->pri, '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');?> @@ -57,7 +56,7 @@ @@ -66,9 +66,9 @@ story->batchCreate; $i++):?> - - - + + + diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index 83b7b01b09..4ec244e3a0 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -11,6 +11,7 @@ */ ?> +lang->story->dittoNotice);?>
icons['story']);?> @@ -38,20 +39,32 @@
+ 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; + } + ?> - - + + - - + + status != 'draft'):?> - + - + status == 'closed'):?> @@ -65,7 +78,7 @@
- lang->bug->resolutionList, $bugs[$bugID]->resolution, "class=form-control onchange=setDuplicate(this.value,$bugID)");?> + resolution, "class=form-control onchange=setDuplicate(this.value,$bugID)");?> ' resolution != 'duplicate') echo "style='display:none'";?>> bug->duplicateBug}'");?> diff --git a/module/story/control.php b/module/story/control.php index 71e6581a9f..9f4c6e912f 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -242,11 +242,11 @@ class story extends control $this->view->titles = $titles; } - $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; + $moduleOptionMenu['ditto'] = $this->lang->story->ditto; + $plans = $this->loadModel('productplan')->getPairs($productID, $branch, 'unexpired'); + $plans['ditto'] = $this->lang->story->ditto; + $priList = (array)$this->lang->story->priList; + $priList['ditto'] = $this->lang->story->ditto; $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchCreate; $this->view->productName = $product->name; @@ -348,6 +348,9 @@ class story extends control */ public function batchEdit($productID = 0, $projectID = 0, $branch = 0) { + /* Load model. */ + $this->loadModel('productplan'); + if($this->post->titles) { $allChanges = $this->story->batchUpdate(); @@ -364,7 +367,6 @@ class story extends control } } die(js::locate($this->session->storyList, 'parent')); - } $storyIDList = $this->post->storyIDList ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent')); @@ -377,8 +379,17 @@ class story extends control { $this->product->setMenu($this->product->getPairs('nodeleted'), $productID, $branch); $product = $this->product->getByID($productID); - $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name); - $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit; + + /* 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; + + $this->view->modules = $modules; + $this->view->productPlans = $productPlans; + $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name); + $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit; } /* The stories of a project. */ @@ -403,15 +414,13 @@ class story extends control $this->view->title = $this->lang->story->batchEdit; } - /* Get the module and productplan of edited stories. */ - $moduleOptionMenus = array(); - $productPlans = array(); - $this->loadModel('productplan'); - foreach($stories as $story) - { - $moduleOptionMenus[$story->product] = $this->tree->getOptionMenu($story->product, $viewType = 'story', 0, $branch); - $productPlans[$story->product] = $this->productplan->getPairs($story->product, $branch); - } + /* Set ditto option for users and pri, source, stage list. */ + $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; /* Judge whether the editedStories is too large and set session. */ $showSuhosinInfo = false; @@ -421,11 +430,14 @@ class story extends control $this->view->position[] = $this->lang->story->common; $this->view->position[] = $this->lang->story->batchEdit; - $this->view->users = $this->loadModel('user')->getPairs('nodeleted'); - $this->view->moduleOptionMenus = $moduleOptionMenus; - $this->view->productPlans = $productPlans; + $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->productID = $productID; $this->view->storyIDList = $storyIDList; + $this->view->branch = $branch; $this->view->stories = $stories; $this->view->productName = isset($product) ? $product->name : ''; $this->display(); diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js index ed0b319f4d..73d3b44a68 100644 --- a/module/story/js/batchcreate.js +++ b/module/story/js/batchcreate.js @@ -1,7 +1,7 @@ $(document).on('click', '.chosen-with-drop', function() { var select = $(this).prev('select'); - if($(select).val() == 'same') + if($(select).val() == 'ditto') { var index = $(select).closest('td').index(); var row = $(select).closest('tr').index(); @@ -10,7 +10,7 @@ $(document).on('click', '.chosen-with-drop', function() for(i = row - 1; i >= 0; i--) { value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val(); - if(value != 'same') break; + if(value != 'ditto') break; } $(select).val(value); $(select).trigger("chosen:updated"); @@ -18,7 +18,7 @@ $(document).on('click', '.chosen-with-drop', function() }); $(document).on('mousedown', 'select', function() { - if($(this).val() == 'same') + if($(this).val() == 'ditto') { var index = $(this).closest('td').index(); var row = $(this).closest('tr').index(); @@ -27,7 +27,7 @@ $(document).on('mousedown', 'select', function() for(i = row - 1; i >= 0; i--) { value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val(); - if(value != 'same') break; + if(value != 'ditto') break; } $(this).val(value); } diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index 45150d3088..f0b5b2c9f2 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -24,3 +24,50 @@ function setDuplicateAndChild(resolution, storyID) $('#childStoryBox' + storyID).hide(); } } + +$(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).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 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; + } + + 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).trigger("chosen:updated"); + $(this).trigger("change"); + } +}) diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 7f0d94a9e4..6df6c30851 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -76,7 +76,8 @@ $lang->story->preVersion = 'Pre version'; $lang->story->keywords = 'Keyword'; $lang->story->newStory = 'Continue to add story.'; -$lang->story->same = 'Ditto'; +$lang->story->ditto = 'Ditto'; +$lang->story->dittoNotice = 'Current story and story above it do not belong to same product!'; $lang->story->useList[0] = 'No use'; $lang->story->useList[1] = 'Use'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 999b9c4dfa..daffe2611b 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -76,7 +76,8 @@ $lang->story->preVersion = '之前版本'; $lang->story->keywords = '关键词'; $lang->story->newStory = '继续添加需求'; -$lang->story->same = '同上'; +$lang->story->ditto = '同上'; +$lang->story->dittoNotice = '该需求与上一需求不属于同一产品!'; $lang->story->useList[0] = '不使用'; $lang->story->useList[1] = '使用'; diff --git a/module/story/model.php b/module/story/model.php index 401cb86b3a..437effe48c 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -249,9 +249,9 @@ class storyModel extends model $pri = 0; for($i = 0; $i < $batchNum; $i++) { - $module = $stories->module[$i] == 'same' ? $module : $stories->module[$i]; - $plan = $stories->plan[$i] == 'same' ? $plan : $stories->plan[$i]; - $pri = $stories->pri[$i] == 'same' ? $pri : $stories->pri[$i]; + $module = $stories->module[$i] == 'ditto' ? $module : $stories->module[$i]; + $plan = $stories->plan[$i] == 'ditto' ? $plan : $stories->plan[$i]; + $pri = $stories->pri[$i] == 'ditto' ? $pri : $stories->pri[$i]; $stories->module[$i] = (int)$module; $stories->plan[$i] = (int)$plan; $stories->pri[$i] = (int)$pri; diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php index 1f38bb12b4..cd05025702 100644 --- a/module/story/view/batchcreate.html.php +++ b/module/story/view/batchcreate.html.php @@ -42,9 +42,9 @@ $fileName):?> - - - + + +
product], $stories[$storyID]->module, "class='form-control chosen'");?> product], $stories[$storyID]->plan, "class='form-control chosen'");?> module, "class='form-control chosen'");?> plan, "class='form-control chosen'");?> title, 'class=form-control'); ?> estimate, "class='form-control' autocomplete='off'"); ?>story->priList, $stories[$storyID]->pri, 'class=form-control');?>story->sourceList, $stories[$storyID]->source, 'class=form-control');?>pri, 'class=form-control');?>source, 'class=form-control');?> story->statusList[$stories[$storyID]->status];?> story->stageList, $stories[$storyID]->stage, 'class=form-control');?>stage, 'class=form-control');?> story->stageList, $stories[$storyID]->stage, 'class="form-control" disabled="disabled"');?>stage, 'class="form-control" disabled="disabled"');?>
- story->reasonList, $stories[$storyID]->closedReason, "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 70px'");?> + closedReason, "class=form-control onchange=setDuplicateAndChild(this.value,$storyID) style='min-width: 70px'");?> ' closedReason != 'duplicate') echo "style='display:none'";?>> idAB}'");?> @@ -77,7 +90,7 @@
- story->reasonList, $stories[$storyID]->closedReason, 'class="form-control" disabled="disabled"');?> + closedReason, 'class="form-control" disabled="disabled"');?> diff --git a/module/task/control.php b/module/task/control.php index b23704b9e1..0c2cb7a804 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -338,9 +338,11 @@ class task extends control $this->project->setMenu($this->project->getPairs(), $project->id); /* Set modules and members. */ - $modules = array(0 => '/', 'ditto' => $this->lang->task->ditto) + $this->tree->getTaskOptionMenu($projectID); - $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted') + array('closed' => 'Closed'); - $members = array('' => '', 'ditto' => $this->lang->task->ditto) + $members; + $modules = $this->tree->getTaskOptionMenu($projectID); + $modules['ditto'] = $this->lang->task->ditto; + $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); + $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); @@ -369,18 +371,18 @@ class task extends control $this->app->session->set('showSuhosinInfo', $showSuhosinInfo); if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo; - /* Set pri, status and type list. */ - $priList = array(0 => '', 'ditto' => $this->lang->task->ditto) + (array)$this->lang->task->priList; - $statusList = array('' => '', 'ditto' => $this->lang->task->ditto) + $this->lang->task->statusList; - $typeList = array('' => '', 'ditto' => $this->lang->task->ditto) + $this->lang->task->typeList; + /* 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 = $priList; - $this->view->statusList = $statusList; - $this->view->typeList = $typeList; + $this->view->priList = (array)$this->lang->task->priList; + $this->view->statusList = $this->lang->task->statusList; + $this->view->typeList = $this->lang->task->typeList; $this->view->taskIDList = $taskIDList; $this->view->tasks = $tasks; $this->view->projectName = isset($project) ? $project->name : ''; diff --git a/module/task/js/batchedit.js b/module/task/js/batchedit.js index 1aa60962f3..f647b28e71 100644 --- a/module/task/js/batchedit.js +++ b/module/task/js/batchedit.js @@ -1,3 +1,13 @@ +$(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).on('click', '.chosen-with-drop', function() { var $select = $(this).prev('select'); @@ -26,7 +36,7 @@ $(document).on('change', 'select', function() } else { - alert(editNotice); + alert(dittoNotice); $(this).val(oldValue); } diff --git a/module/task/lang/en.php b/module/task/lang/en.php index d2a998da0f..479c6eb424 100644 --- a/module/task/lang/en.php +++ b/module/task/lang/en.php @@ -31,7 +31,6 @@ $lang->task->export = "Export data"; $lang->task->reportChart = "Report chart"; $lang->task->fromBug = 'From Bug'; $lang->task->confirmStoryChange = "Confirm story change"; -$lang->task->editNotice = "Current task and task above it do not belong to same project!"; $lang->task->common = 'Task'; $lang->task->id = 'ID'; @@ -88,6 +87,7 @@ $lang->task->editEstimate = 'Edit Hour'; $lang->task->deleteEstimate = 'Delete Hour'; $lang->task->ditto = 'Ditto'; +$lang->task->dittoNotice = "Current task and task above it do not belong to same project!"; $lang->task->selectAllUser = 'All'; $lang->task->statusList[''] = ''; diff --git a/module/task/lang/zh-cn.php b/module/task/lang/zh-cn.php index 8265cedca9..2531e988f4 100644 --- a/module/task/lang/zh-cn.php +++ b/module/task/lang/zh-cn.php @@ -31,7 +31,6 @@ $lang->task->export = "导出数据"; $lang->task->reportChart = "报表统计"; $lang->task->fromBug = '来源Bug'; $lang->task->confirmStoryChange = "确认需求变动"; -$lang->task->editNotice = "该任务与上一任务不属于同一项目!"; $lang->task->common = '任务'; $lang->task->id = '编号'; @@ -88,6 +87,7 @@ $lang->task->editEstimate = '编辑工时'; $lang->task->deleteEstimate = '删除工时'; $lang->task->ditto = '同上'; +$lang->task->dittoNotice = "该任务与上一任务不属于同一项目!"; $lang->task->selectAllUser = '全部'; $lang->task->statusList[''] = ''; diff --git a/module/task/view/batchedit.html.php b/module/task/view/batchedit.html.php index 312725fc10..17f2a08ed6 100755 --- a/module/task/view/batchedit.html.php +++ b/module/task/view/batchedit.html.php @@ -11,7 +11,7 @@ */ ?> -lang->task->editNotice);?> +lang->task->dittoNotice);?>
icons['task']);?> @@ -42,11 +42,13 @@ tree->getOptionMenu($tasks[$taskID]->project, $viewType = 'task'); $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 = array(0 => '/', 'ditto' => $this->lang->task->ditto) + $modules; - $members = array('' => '', 'ditto' => $this->lang->task->ditto) + $this->project->getTeamMemberPairs($tasks[$taskID]->project, 'nodeleted'); + $modules['ditto'] = $this->lang->task->ditto; + + $members = $this->project->getTeamMemberPairs($tasks[$taskID]->project, 'nodeleted'); + $members['ditto'] = $this->lang->task->ditto; } ?> diff --git a/module/testcase/control.php b/module/testcase/control.php index b45d3c5525..dace8c9658 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -554,11 +554,16 @@ class testcase extends control /* The cases of a product. */ if($productID) { - $this->testcase->setMenu($this->products, $productID, $branch); $product = $this->product->getByID($productID); - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch); - $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); - $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; + $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; + + $this->view->modules = $modules; + $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; } /* The cases of my. */ else @@ -577,11 +582,16 @@ 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; /* Assign. */ $this->view->position[] = $this->lang->testcase->common; $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->cases = $cases; $this->display(); diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js index e0cb2f011e..3c7234a16a 100644 --- a/module/testcase/js/batchcreate.js +++ b/module/testcase/js/batchcreate.js @@ -8,11 +8,11 @@ $(document).ready(function() { index = id.substring(5); module = $('#module' + index).val(); - if(module == 'same') + if(module == 'ditto') { for(var i = index - 1; i >=0; i--) { - if($('#module' + i).val() != 'same') + if($('#module' + i).val() != 'ditto') { module = $('#module' + i).val(); break; @@ -22,7 +22,7 @@ $(document).ready(function() link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + module + '&storyID='+ $(select).val() + '&onlyOption=true&status=noclosed'); $('#story' + index).load(link, function(){$(this).trigger("chosen:updated");}); } - if($(select).val() == 'same') + if($(select).val() == 'ditto') { var index = $(select).closest('td').index(); var row = $(select).closest('tr').index(); @@ -31,7 +31,7 @@ $(document).ready(function() for(i = row - 1; i >= 0; i--) { value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val(); - if(value != 'same') break; + if(value != 'ditto') break; } $(select).val(value); $(select).trigger("chosen:updated"); @@ -40,7 +40,7 @@ $(document).ready(function() $(document).on('mousedown', 'select', function() { - if($(this).val() == 'same') + if($(this).val() == 'ditto') { var index = $(this).closest('td').index(); var row = $(this).closest('tr').index(); @@ -49,7 +49,7 @@ $(document).ready(function() for(i = row - 1; i >= 0; i--) { value = $(table).find('tr').eq(i).find('td').eq(index).find('select').val(); - if(value != 'same') break; + if(value != 'ditto') break; } $(this).val(value); } diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js index 37254b93e4..eecba1b295 100644 --- a/module/testcase/js/batchedit.js +++ b/module/testcase/js/batchedit.js @@ -1,4 +1,76 @@ $(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. + * + * @param string $resolution + * @param int $storyID + * @access public + * @return void + */ +function setDuplicateAndChild(resolution, storyID) +{ + if(resolution == 'duplicate') + { + $('#childStoryBox' + storyID).hide(); + $('#duplicateStoryBox' + storyID).show(); + } + else if(resolution == 'subdivided') + { + $('#duplicateStoryBox' + storyID).hide(); + $('#childStoryBox' + storyID).show(); + } + else + { + $('#duplicateStoryBox' + storyID).hide(); + $('#childStoryBox' + storyID).hide(); + } +} + +$(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 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; + } + + 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).trigger("chosen:updated"); + $(this).trigger("change"); + } }) diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index 5cc9e053a2..6dc79af0d7 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -97,7 +97,8 @@ $lang->testcase->legendComment = 'Comment'; $lang->testcase->confirmDelete = 'Are you sure to delete this case?'; $lang->testcase->confirmBatchDelete = 'Are you sure to batch delete there cases?'; -$lang->testcase->same = 'Ditto'; +$lang->testcase->ditto = 'Ditto'; +$lang->testcase->dittoNotice = 'Current case and case above it do not belong to same product!'; $lang->testcase->priList[3] = 3; $lang->testcase->priList[1] = 1; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 0cebc56869..48e63174e7 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -97,7 +97,8 @@ $lang->testcase->legendComment = '备注'; $lang->testcase->confirmDelete = '您确认要删除该测试用例吗?'; $lang->testcase->confirmBatchDelete = '您确认要批量删除这些测试用例吗?'; -$lang->testcase->same = '同上'; +$lang->testcase->ditto = '同上'; +$lang->testcase->dittoNotice = '该用例与上一用例不属于同一产品!'; $lang->testcase->priList[3] = 3; $lang->testcase->priList[1] = 1; diff --git a/module/testcase/model.php b/module/testcase/model.php index 4c72463c45..763e721360 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -105,9 +105,9 @@ class testcaseModel extends model $type = ''; for($i = 0; $i < $batchNum; $i++) { - $module = $cases->module[$i] == 'same' ? $module : $cases->module[$i]; - $story = $cases->story[$i] == 'same' ? $story : $cases->story[$i]; - $type = $cases->type[$i] == 'same' ? $type : $cases->type[$i]; + $module = $cases->module[$i] == 'ditto' ? $module : $cases->module[$i]; + $story = $cases->story[$i] == 'ditto' ? $story : $cases->story[$i]; + $type = $cases->type[$i] == 'ditto' ? $type : $cases->type[$i]; $cases->module[$i] = (int)$module; $cases->story[$i] = (int)$story; $cases->type[$i] = $type; diff --git a/module/testcase/view/batchcreate.html.php b/module/testcase/view/batchcreate.html.php index 033c5071ce..6f949b0242 100644 --- a/module/testcase/view/batchcreate.html.php +++ b/module/testcase/view/batchcreate.html.php @@ -43,13 +43,13 @@ testcase->typeList['']); - $moduleOptionMenu['same'] = $lang->testcase->same; + $moduleOptionMenu['ditto'] = $lang->testcase->ditto; ?> testcase->batchCreate; $i++):?> testcase->typeList['same'] = $lang->testcase->same; - $type = $i == 0 ? 'feature' : 'same'; + if($i != 0) $currentModuleID = 'ditto'; + if($i != 0) $lang->testcase->typeList['ditto'] = $lang->testcase->ditto; + $type = $i == 0 ? 'feature' : 'ditto'; $pri = 3; ?> diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index ac88f2efe0..b28f54ce34 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -11,6 +11,7 @@ */ ?> +lang->testcase->dittoNotice);?>
icons['testcase']);?> @@ -32,14 +33,22 @@ - tree->getOptionMenu($cases[$caseID]->product, $viewType = 'case', $startModuleID = 0); ?> + 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; + } + ?> - testcase->priList, $cases[$caseID]->pri, 'class=form-control');?> + pri, 'class=form-control');?> testcase->statusList, $cases[$caseID]->status, 'class=form-control');?> - module, "class='form-control chosen'");?> + module, "class='form-control chosen'");?> title, 'class=form-control'); echo "*";?> - testcase->typeList, $cases[$caseID]->type, 'class=form-control');?> + type, 'class=form-control');?> testcase->stageList, $cases[$caseID]->stage, "class='form-control chosen' multiple data-placeholder='{$lang->testcase->stage}'");?>