From 6977cf91ede8602f29ca3c8df25df334e295a55a Mon Sep 17 00:00:00 2001
From: tianshujie98
Date: Tue, 13 Jul 2021 13:38:14 +0800
Subject: [PATCH] * Add select all.
---
module/upgrade/control.php | 6 +-
module/upgrade/css/mergeprogram.css | 1 +
module/upgrade/js/mergeprogram.js | 262 +++++++++++++++++----
module/upgrade/lang/de.php | 10 +-
module/upgrade/lang/en.php | 10 +-
module/upgrade/lang/fr.php | 10 +-
module/upgrade/lang/vi.php | 10 +-
module/upgrade/lang/zh-cn.php | 10 +-
module/upgrade/view/mergebysprint.html.php | 6 +-
9 files changed, 246 insertions(+), 79 deletions(-)
diff --git a/module/upgrade/control.php b/module/upgrade/control.php
index 360d1cafab..c5a39c4e8e 100644
--- a/module/upgrade/control.php
+++ b/module/upgrade/control.php
@@ -410,7 +410,7 @@ class upgrade extends control
$productlines = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->andWhere('root')->eq(0)->orderBy('id_desc')->fetchAll('id');
$noMergedProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('line')->in(array_keys($productlines))->orderBy('id_desc')->fetchAll('id');
- if(empty($productlines) || empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=product'));
+ if(empty($productlines) || empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', "type=product&programID=0&projectType=$projectType"));
$noMergedSprints = $this->dao->select('t1.*')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
@@ -482,7 +482,7 @@ class upgrade extends control
/* Add products without sprints. */
$noMergedProducts += $this->dao->select('*')->from(TABLE_PRODUCT)->where('program')->eq(0)->fetchAll('id');
- if(empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=sprint'));
+ if(empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', "type=sprint&programID=0&projectType=$projectType"));
/* Group project by product. */
@@ -506,7 +506,7 @@ class upgrade extends control
$projectProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($noMergedSprints))->fetchGroup('project', 'product');
foreach($projectProducts as $sprintID => $products) unset($noMergedSprints[$sprintID]);
- if(empty($noMergedSprints)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=moreLink'));
+ if(empty($noMergedSprints)) $this->locate($this->createLink('upgrade', 'mergeProgram', "type=moreLink"));
$this->view->noMergedSprints = $noMergedSprints;
}
diff --git a/module/upgrade/css/mergeprogram.css b/module/upgrade/css/mergeprogram.css
index 9ac8e4b412..fdc6cb3c64 100644
--- a/module/upgrade/css/mergeprogram.css
+++ b/module/upgrade/css/mergeprogram.css
@@ -30,3 +30,4 @@ div.divider {vertical-align: middle;}
#source .lineGroup .productList {width: 170px;}
#lineList .checkbox-primary {display: inline-block;}
.main-row .side-col .check-allLine > label {font-weight: 700}
+.sprintGroup {margin-left: 6px;}
diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js
index fd07149c97..3177e5b693 100644
--- a/module/upgrade/js/mergeprogram.js
+++ b/module/upgrade/js/mergeprogram.js
@@ -1,14 +1,48 @@
$(function()
{
- var checkedProduct = true;
- var productLine = $('.nav li.active').attr('lineid');
- $("[id^='products\[" + productLine + "\]']").each(function()
+ if($('[id^=productLines]').length > 0)
{
- if(!$(this).prop('checked')) checkedProduct = false;
- })
- $("[id^='productLines\[" + productLine + "\]']").prop('checked', checkedProduct);
- $('#checkAllProducts').prop('checked', checkedProduct);
- $('#checkAllProjects').prop('checked', checkedProduct);
+ var checkedProduct = true;
+ var productLine = $('.nav li.active').attr('lineid');
+ $("[id^='products\[" + productLine + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProduct = false;
+ return false;
+ }
+ })
+ $("[id^='productLines\[" + productLine + "\]']").prop('checked', checkedProduct);
+ $('#checkAllProducts').prop('checked', checkedProduct);
+ $('#checkAllProjects').prop('checked', checkedProduct);
+ }
+ else if($('[id^=products]').length > 0)
+ {
+ var checkedProduct = true;
+ $('[id^=products]').each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProduct = false;
+ return false;
+ }
+ })
+ $('#checkAllProducts').prop('checked', checkedProduct);
+ $('#checkAllProjects').prop('checked', checkedProduct);
+ }
+ else if($('[id^=sprints]').length > 0)
+ {
+ var checkedProject = true;
+ $('[id^=sprints]').each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProject = false;
+ return false;
+ }
+ })
+ $('#checkAllProjects').prop('checked', checkedProject);
+ }
/* Define drag to select relevant parameters. */
var options = {
@@ -23,31 +57,6 @@ $(function()
var checkedProduct = true;
var checkedProject = true;
- /* All products selected. */
- $("[id^='products\[" + lineID + "\]']").each(function()
- {
- if(!$(this).prop('checked')) checkedProduct = false;
- })
- $('#checkAllProducts').prop('checked', checkedProduct);
- $("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedProduct);
-
- /* All projects selected. */
- $("[id^='sprints\[" + lineID + "\]']").each(function()
- {
- if(!$(this).prop('checked'))
- {
- checkedProject = false;
- }
- else
- {
- var productID = $(this).attr('data-product');
- if(productID && $('[data-productid=' + productID + ']').length > 0 && !$('[data-productid=' + productID + ']').prop('checked')) $('[data-productid=' + productID + ']').prop('checked', true);
- }
- })
- $('#checkAllProjects').prop('checked', checkedProject);
- $('#checkAllProducts').prop('checked', checkedProject);
- $("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedProject);
-
/* Select the product line of the current page. */
if($('.nav li.active').find('[id^=productLines]').prop('checked'))
{
@@ -58,6 +67,82 @@ $(function()
$("[id^='sprints\[" + lineID + "\]'").prop('checked', true);
}
+ /* All products selected. */
+ if($('[id^=productLines]').length > 0)
+ {
+ $("[id^='products\[" + lineID + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProduct = false;
+ }
+ else
+ {
+ $('[data-product=' + $(this).val() +']').prop('checked', true);
+ }
+ })
+ $("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedProduct);
+ }
+ else
+ {
+ $("[id^=products]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProduct = false;
+ }
+ else
+ {
+ $('[data-product=' + $(this).val() +']').prop('checked', true);
+ }
+ })
+ }
+ $('#checkAllProducts').prop('checked', checkedProduct);
+
+ /* All projects selected. */
+ if($('[id^=productLines]').length > 0)
+ {
+ $("[id^='sprints\[" + lineID + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProject = false;
+ }
+ else
+ {
+ var productID = $(this).attr('data-product');
+ if(productID && $('[data-productid=' + productID + ']').length > 0 && !$('[data-productid=' + productID + ']').prop('checked')) $('[data-productid=' + productID + ']').prop('checked', true);
+ }
+ })
+ }
+ else if($('[id^=products]').length > 0)
+ {
+ $("[id^=sprints]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProject = false;
+ }
+ else
+ {
+ var productID = $(this).attr('data-product');
+ if(productID && $('[data-productid=' + productID + ']').length > 0 && !$('[data-productid=' + productID + ']').prop('checked')) $('[data-productid=' + productID + ']').prop('checked', true);
+ }
+ })
+ }
+ else
+ {
+ $("[id^=sprints]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProject = false;
+ return false;
+ }
+ })
+ }
+ $('#checkAllProjects').prop('checked', checkedProject);
+
/* All product lines selected. */
$('[name^=productLines]').each(function()
{
@@ -413,10 +498,29 @@ $(function()
var checked = true;
var lineID = $(this).attr('data-line');
- $("[id^='products\[" + lineID + "\]']").each(function()
+ if($('[id^=productLines]').length > 0)
{
- if(!$(this).prop('checked')) checked = false;
- })
+ $("[id^='products\[" + lineID + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checked = false;
+ return false;
+ }
+ })
+ }
+ else if($('[id^=products]').length > 0)
+ {
+ $("[id^=products]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checked = false;
+ return false;
+ }
+ })
+ }
+
$('#checkAllProducts').prop('checked', checked);
$("[id^='productLines\[" + lineID + "\]']").prop('checked', checked);
@@ -433,10 +537,28 @@ $(function()
}
var checkedSprint = true;
- $("[id^='sprints\[" + lineID + "\]']").each(function()
+ if($('[id^=productLines]').length > 0)
{
- if(!$(this).prop('checked')) checkedSprint = false;
- })
+ $("[id^='sprints\[" + lineID + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedSprint = false;
+ return false;
+ }
+ })
+ }
+ else if($('[id^=products]').length > 0)
+ {
+ $("[id^=sprints]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedSprint = false;
+ return false;
+ }
+ })
+ }
$('#checkAllProjects').prop('checked', checkedSprint);
setProgramBegin(programBegin);
@@ -450,18 +572,60 @@ $(function()
{
var checked = true;
var checkedProduct = true;
- var lineID = $(this).attr('data-line');
- $("[id^='sprints\[" + lineID + "\]']").each(function()
+ if($('[id^=productLines]').length > 0)
{
- if(!$(this).prop('checked')) checked = false;
- })
+ var lineID = $(this).attr('data-line');
+ $("[id^='sprints\[" + lineID + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checked = false;
+ return false;
+ }
+ })
+
+ $("[id^='products\[" + lineID + "\]']").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProduct = false;
+ return false;
+ }
+ })
+ }
+ else if($('[id^=products]').length > 0)
+ {
+ $("[id^=sprints]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checked = false;
+ return false;
+ }
+ })
+
+ $("[id^=products]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checkedProduct = false;
+ return false;
+ }
+ })
+ }
+ else if($('[id^=sprints]').length > 0)
+ {
+ $("[id^=sprints]").each(function()
+ {
+ if(!$(this).prop('checked'))
+ {
+ checked = false;
+ return false;
+ }
+ })
+ }
+
$('#checkAllProjects').prop('checked', checked);
-
- $("[id^='products\[" + lineID + "\]']").each(function()
- {
- if(!$(this).prop('checked')) checkedProduct = false;
- })
-
$('#checkAllProducts').prop('checked', checkedProduct);
if($(this).prop('checked'))
diff --git a/module/upgrade/lang/de.php b/module/upgrade/lang/de.php
index c78fb2559f..b1ced8a7e5 100644
--- a/module/upgrade/lang/de.php
+++ b/module/upgrade/lang/de.php
@@ -118,10 +118,10 @@ $lang->upgrade->selectProject = 'The target project';
$lang->upgrade->newProgram = 'Create';
$lang->upgrade->projectEmpty = 'Project must be not empty.';
-$lang->upgrade->mergeSummary = "Dear users, there are %s products and %s iterations in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
-$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED iterations: Consolidate the entire product line and the products and iterations below it into one large project.";
-$lang->upgrade->mergeByProduct = "PRODUCT-BASED iterations: You can select multiple products and their lower iterations to merge into a large project, or you can select a product to merge its lower iterations into a larger project";
-$lang->upgrade->mergeByProject = "Independent iterations: You can select several iterations and merge them into one large project, or merge them independently";
+$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
+$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
+$lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project";
+$lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently";
$lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to.";
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
@@ -137,7 +137,7 @@ $lang->upgrade->createProjectTip = <<ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.
EOT;
$lang->upgrade->createExecutionTip = <<ZenTao will upgrade existing {$lang->projectCommon} as Iteration.
+
ZenTao will upgrade existing {$lang->projectCommon} as execution.
After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .
EOT;
diff --git a/module/upgrade/lang/en.php b/module/upgrade/lang/en.php
index b04b36b2c3..5c12590499 100644
--- a/module/upgrade/lang/en.php
+++ b/module/upgrade/lang/en.php
@@ -105,10 +105,10 @@ $lang->upgrade->selectProject = 'The target project';
$lang->upgrade->newProgram = 'Create';
$lang->upgrade->projectEmpty = 'Project must be not empty.';
-$lang->upgrade->mergeSummary = "Dear users, there are %s products and %s iterations in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
-$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED iterations: Consolidate the entire product line and the products and iterations below it into one large project.";
-$lang->upgrade->mergeByProduct = "PRODUCT-BASED iterations: You can select multiple products and their lower iterations to merge into a large project, or you can select a product to merge its lower iterations into a larger project";
-$lang->upgrade->mergeByProject = "Independent iterations: You can select several iterations and merge them into one large project, or merge them independently";
+$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
+$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
+$lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project";
+$lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently";
$lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to.";
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
$lang->upgrade->needBuild4Add = 'Full text retrieval has been added in this upgrade. Need create index. Please go [Admin->System->BuildIndex] page to build index.';
@@ -121,7 +121,7 @@ $lang->upgrade->createProjectTip = <<ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.
EOT;
$lang->upgrade->createExecutionTip = <<ZenTao will upgrade existing {$lang->projectCommon} as Iteration.
+
ZenTao will upgrade existing {$lang->projectCommon} as execution.
After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .
EOT;
diff --git a/module/upgrade/lang/fr.php b/module/upgrade/lang/fr.php
index 56a4023400..73b9b9739f 100644
--- a/module/upgrade/lang/fr.php
+++ b/module/upgrade/lang/fr.php
@@ -119,10 +119,10 @@ $lang->upgrade->selectProject = 'The target project';
$lang->upgrade->newProgram = 'Create';
$lang->upgrade->projectEmpty = 'Project must be not empty.';
-$lang->upgrade->mergeSummary = "Dear users, there are %s products and %s iterations in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
-$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED iterations: Consolidate the entire product line and the products and iterations below it into one large project.";
-$lang->upgrade->mergeByProduct = "PRODUCT-BASED iterations: You can select multiple products and their lower iterations to merge into a large project, or you can select a product to merge its lower iterations into a larger project";
-$lang->upgrade->mergeByProject = "Independent iterations: You can select several iterations and merge them into one large project, or merge them independently";
+$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
+$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
+$lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project";
+$lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently";
$lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to.";
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
@@ -138,7 +138,7 @@ $lang->upgrade->createProjectTip = <<ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.
EOT;
$lang->upgrade->createExecutionTip = <<ZenTao will upgrade existing {$lang->projectCommon} as Iteration.
+
ZenTao will upgrade existing {$lang->projectCommon} as execution.
After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .
EOT;
diff --git a/module/upgrade/lang/vi.php b/module/upgrade/lang/vi.php
index 7891020322..aef45633a7 100644
--- a/module/upgrade/lang/vi.php
+++ b/module/upgrade/lang/vi.php
@@ -119,10 +119,10 @@ $lang->upgrade->selectProject = 'The target project';
$lang->upgrade->newProgram = 'Create';
$lang->upgrade->projectEmpty = 'Project must be not empty.';
-$lang->upgrade->mergeSummary = "Dear users, there are %s products and %s iterations in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
-$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED iterations: Consolidate the entire product line and the products and iterations below it into one large project.";
-$lang->upgrade->mergeByProduct = "PRODUCT-BASED iterations: You can select multiple products and their lower iterations to merge into a large project, or you can select a product to merge its lower iterations into a larger project";
-$lang->upgrade->mergeByProject = "Independent iterations: You can select several iterations and merge them into one large project, or merge them independently";
+$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
+$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
+$lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project";
+$lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently";
$lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to.";
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
$lang->upgrade->needBuild4Add = 'Full text retrieval has been added in this upgrad. Vui lòng create an index.';
@@ -135,7 +135,7 @@ $lang->upgrade->createProjectTip = <<ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.
EOT;
$lang->upgrade->createExecutionTip = <<ZenTao will upgrade existing {$lang->projectCommon} as Iteration.
+
ZenTao will upgrade existing {$lang->projectCommon} as execution.
After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .