From d64667dc996e02981fe0ac595c3e305ea002742f Mon Sep 17 00:00:00 2001 From: z Date: Tue, 25 Aug 2020 09:19:54 +0800 Subject: [PATCH 1/9] * adjust for get parent pairs. --- module/program/control.php | 5 ++++- module/program/model.php | 39 +++++++++++++++++++++++++++----------- 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index decbb0d603..8d1324b6e9 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -175,11 +175,14 @@ class program extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $url)); } + $parents = $this->program->getParentPairs(); + unset($parents[$programID]); + $this->view->pmUsers = $this->loadModel('user')->getPairs('noclosed|nodeleted|pmfirst', $program->PM); $this->view->title = $this->lang->program->edit; $this->view->position[] = $this->lang->program->edit; $this->view->program = $program; - $this->view->parents = $this->program->getParentPairs(); + $this->view->parents = $parents; $this->view->groups = $this->loadModel('group')->getPairs(); $this->display(); } diff --git a/module/program/model.php b/module/program/model.php index 82f796acd6..0542042367 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -490,23 +490,40 @@ class programModel extends model */ public function getParentPairs() { - $stmt = $this->dao->select('id,name,parent,path,grade')->from(TABLE_PROJECT)->where('isCat')->eq(1)->andWhere('deleted')->eq(0)->orderBy('grade, `order`')->query(); + $modules = $this->dao->select('id,name,parent,path,grade')->from(TABLE_PROJECT)->where('isCat')->eq(1)->andWhere('deleted')->eq(0)->orderBy('grade desc, `order`')->fetchAll('id'); - $pairs = array(); - $pairs[0] = '/'; - while($program = $stmt->fetch()) + $treeMenu = array(); + foreach($modules as $module) { - if($program->grade == 1) + $moduleName = '/'; + $parentModules = explode(',', $module->path); + foreach($parentModules as $parentModuleID) { - $pairs[$program->id] = '/' . $program->name; - continue; + if(empty($parentModuleID)) continue; + if(empty($modules[$parentModuleID])) continue; + $moduleName .= $modules[$parentModuleID]->name . '/'; } + $moduleName = str_replace('|', '¦', rtrim($moduleName, '/')); + $moduleName .= "|$module->id\n"; - $programName = '/' . $program->name; - $pairs[$program->id] = isset($pairs[$program->parent]) ? $pairs[$program->parent] . $programName : $programName; + if(!isset($treeMenu[$module->parent])) $treeMenu[$module->parent] = ''; + $treeMenu[$module->parent] .= $moduleName; + + if(isset($treeMenu[$module->id]) and !empty($treeMenu[$module->id])) $treeMenu[$module->parent] .= $treeMenu[$module->id]; } - return $pairs; + ksort($treeMenu); + $topMenu = array_shift($treeMenu); + $topMenu = explode("\n", trim($topMenu)); + $lastMenu[] = '/'; + foreach($topMenu as $menu) + { + if(strpos($menu, '|') === false) continue; + list($label, $moduleID) = explode('|', $menu); + $lastMenu[$moduleID] = str_replace('¦', '|', $label); + } + + return $lastMenu; } /** @@ -533,7 +550,7 @@ class programModel extends model foreach($childNodes as $childNode) { $path = substr($childNode->path, strpos($childNode->path, ",{$programID},")); - $grade = $oldGrade - $childNode->grade + 1; + $grade = $childNode->grade - $oldGrade + 1; if($parent) { $path = rtrim($parent->path, ',') . $path; From 6abb1f2aae6ebd05ee68aafae436d480c3f7d0d0 Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Tue, 25 Aug 2020 09:37:08 +0800 Subject: [PATCH 2/9] * Add block for program statistic. --- module/block/control.php | 14 ++- .../block/view/printassigntomeblock.html.php | 14 ++- .../block/view/programstatisticblock.html.php | 73 +++++++++++++ module/group/lang/resource.php | 2 + module/program/lang/en.php | 102 +++++++++++------- module/program/lang/zh-cn.php | 9 ++ 6 files changed, 168 insertions(+), 46 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 9bfa0ef78d..52e3e9581e 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1377,13 +1377,14 @@ class block extends control */ public function printAssignToMeBlock($longBlock = true) { - if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true; - if(common::hasPriv('task', 'view')) $hasViewPriv['task'] = true; - if(common::hasPriv('bug', 'view')) $hasViewPriv['bug'] = true; - if(common::hasPriv('risk', 'view')) $hasViewPriv['risk'] = true; + if(common::hasPriv('todo', 'view')) $hasViewPriv['todo'] = true; + if(common::hasPriv('task', 'view')) $hasViewPriv['task'] = true; + if(common::hasPriv('bug', 'view')) $hasViewPriv['bug'] = true; + if(common::hasPriv('risk', 'view')) $hasViewPriv['risk'] = true; $params = $this->get->param; $params = json_decode(base64_decode($params)); + $count = array(); if(isset($hasViewPriv['todo'])) { @@ -1407,6 +1408,7 @@ class block extends control $todo->begin = date::formatTime($todo->begin); $todo->end = date::formatTime($todo->end); } + $count['todo'] = count($todos); $this->view->todos = $todos; } if(isset($hasViewPriv['task'])) @@ -1420,6 +1422,7 @@ class block extends control if(isset($params->taskNum)) $stmt->limit($params->taskNum); $tasks = $stmt->fetchAll(); + $count['task'] = count($tasks); $this->view->tasks = $tasks; } if(isset($hasViewPriv['bug'])) @@ -1433,6 +1436,7 @@ class block extends control if(isset($params->bugNum)) $stmt->limit($params->bugNum); $bugs = $stmt->fetchAll(); + $count['bug'] = count($bugs); $this->view->bugs = $bugs; } if(isset($hasViewPriv['risk'])) @@ -1446,11 +1450,13 @@ class block extends control if(isset($params->riskNum)) $stmt->limit($params->riskNum); $risks = $stmt->fetchAll(); + $count['risk'] = count($risks); $this->view->risks = $risks; } $this->view->selfCall = $this->selfCall; $this->view->hasViewPriv = $hasViewPriv; + $this->view->count = $count; $this->view->longBlock = $longBlock; $this->display(); } diff --git a/module/block/view/printassigntomeblock.html.php b/module/block/view/printassigntomeblock.html.php index 379fa30f61..9085b18ead 100644 --- a/module/block/view/printassigntomeblock.html.php +++ b/module/block/view/printassigntomeblock.html.php @@ -16,7 +16,12 @@ $bool):?> global->flow != 'full' && $config->global->flow != 'onlyTask' && $type == 'task') continue;?> global->flow != 'full' && $config->global->flow != 'onlyTest' && $type == 'bug') continue;?> - >block->availableBlocks->$type;?> + > + + block->availableBlocks->$type;?> + '> + +
@@ -36,3 +41,10 @@ #assigntomeBlock > .nav {position: absolute; top: -41px; left: 120px;} #assigntomeBlock .block-todoes .todoes-form{top: -50px;} + diff --git a/module/block/view/programstatisticblock.html.php b/module/block/view/programstatisticblock.html.php index 00d3380f4b..d6a321b4e9 100644 --- a/module/block/view/programstatisticblock.html.php +++ b/module/block/view/programstatisticblock.html.php @@ -62,6 +62,14 @@ html[lang="en"] .product-info .type-info {color: #A6AAB8; text-align: center; po .status-count{margin:auto} .status-count tr:first-child td:last-child{color:#000;font-weight:bold} + +.block-statistic .progress-group{margin-top: 20px; height: 65px;} +.block-statistic .weekly-title{font-weight: bold; font-size:14px; color: #3C4253;} +.block-statistic .weekly-small{font-size:12px; color: #838A9D;} +.block-statistic .weekly-progress {font-weight: bold; font-size:24px;} +.block-statistic .weekly-name{font-size:14px; color: #838A9D;} +.block-statistic .weekly-value{font-size:18px; color: #3C4253;} +.block-statistic .col-6 .stage{margin-left: 10px} diff --git a/module/story/view/track.html.php b/module/story/view/track.html.php new file mode 100644 index 0000000000..7b2deee001 --- /dev/null +++ b/module/story/view/track.html.php @@ -0,0 +1,86 @@ + + + +
+
+ +
+

+ noData;?> +

+
+ +
+ + + + + + + + + + + + + $requirement):?> + track;?> + + + + + + $story):?> + ';?> + + + + + + ';?> + + + + + + + + + + + + +
story->requirement;?>story->story;?>story->design;?>story->case;?>story->repoCommit;?>story->bug;?>
id"), $requirement->title, '', "title=$requirement->title");?> + + story->statusList, $requirement->status);?> + + createLink('story', 'view', "storyID=$storyID"), $story->title, '',"title='$story->title'");?> + design as $designID => $design):?> + createLink('design', 'view', "designID=$designID"), $design->name, '', "title='$design->name'") . '
';?> + +
+ case as $caseID => $case):?> + createLink('testcase', 'view', "caseID=$caseID"), $case->title, '', "title='$case->title'") . '
';?> + +
+ revision as $revision => $repoID):?> + createLink('design', 'revision', "repoID=$revision"), '#'. $revision) . '
'; + ?> + +
+ bug as $bugID => $bug):?> + createLink('bug', 'view', "bugID=$bugID"), $bug->title, '', "title='$bug->title'") . '
';?> + +
+
+ +
+
+ diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index e93fc565ec..ecac3587f9 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -62,6 +62,56 @@
story->legendVerify;?>
verify;?>
+ type == 'requirement'):?> + +
+
story->track;?>
+
+ + + + + + + + + + + + $storyInfo):?> + + + + + + + + + +
story->story;?>story->design;?>story->case;?>story->repoCommit;?>story->bug;?>
createLink('story', 'view', "storyID=$storyID"), $storyInfo->title, '', "title='$storyInfo->title'");?> + + design as $designID => $design):?> + createLink('design', 'view', "designID=$designID"), $design->name, '', "title='$design->name'") . '
';?> + +
+ case as $caseID => $case):?> + createLink('testcase', 'view', "caseID=$caseID"), $case->title, '', "title='$case->title'") . '
';?> + +
+ revision as $revision => $repoID):?> + createLink('design', 'revision', "repoID=$revision"), '#'. $revision) . '
'; + ?> + +
+ bug as $bugID => $bug):?> + createLink('bug', 'view', "bugID=$bugID"), $bug->title, '', "title='$bug->title'") . '
';?> + +
+
+
+ + fetch('file', 'printFiles', array('files' => $story->files, 'fieldset' => 'true'));?> createLink('action', 'comment', "objectType=story&objectID=$story->id");?> children)):?> @@ -334,12 +384,34 @@
+ template == 'cmmi'):?> +
+
    + id] = $item->title; + foreach($relation as $id => $title) + { + echo "
  • " . html::a($this->createLink('story', 'view', "id=$id", '', true), "#$id $title", '', "class='iframe' data-width='80%'"); + echo html::a($this->createLink('story', 'linkStory', "storyID=$story->id&type=remove&linkedID=$id"), '', 'hiddenwin', "class='deleter hide removeButton'"); + } + ?> + type == 'story') ? $lang->story->requirement : $lang->story->story;?> +
  • createLink('story', 'linkStory', "storyID=$story->id", '', true), $lang->story->link . $linkLang, '', "class='btn btn-info iframe' data-width='95%' id='linkButton'");?> + story->unlink . $linkLang, '', "class='btn btn-info' id='unlinkStory'");?>
  • +
+
+ global->flow != 'onlyStory'):?>
    @@ -454,6 +526,8 @@ js::set('productID', $story->product); js::set('branch', $story->branch); js::set('moduleID', $story->module); js::set('storyType', $story->type); +js::set('unlink', $lang->story->unlink); +js::set('cancel', $lang->cancel); ?> From 2a49dfd4d13648ee864c492463cae4f6466af578 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 25 Aug 2020 11:27:34 +0800 Subject: [PATCH 6/9] * Fix weekly bugs. --- module/weekly/control.php | 2 +- module/weekly/model.php | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/module/weekly/control.php b/module/weekly/control.php index 605ccc07ed..77f740e14b 100644 --- a/module/weekly/control.php +++ b/module/weekly/control.php @@ -40,7 +40,7 @@ class weekly extends control $this->view->postponed = $this->weekly->getPostponed($program); $this->view->nextWeek = $this->weekly->getTasksOfNextWeek($program, $date); $this->view->workload = $this->weekly->getWorkloadByType($program, $date); - $this->weekly->save($program, $this->view, $date); + $this->weekly->save($program, $date); $this->lang->modulePageNav = $this->weekly->getPageNav($this->view->program, $date); $this->display(); diff --git a/module/weekly/model.php b/module/weekly/model.php index 7e0937f656..9ca9330d2d 100644 --- a/module/weekly/model.php +++ b/module/weekly/model.php @@ -60,19 +60,18 @@ class weeklyModel extends model ->fetch(); } - public function save($program, $data, $date) + public function save($program, $date) { $report = new stdclass; - $report->pv = zget($data, 'pv', ''); - $report->ev = zget($data, 'ev', ''); - $report->ac = zget($data, 'ac', ''); - $report->sv = zget($data, 'sv', ''); - $report->cv = zget($data, 'cv', ''); + $report->pv = $this->getPV($program, $date); + $report->ev = $this->getEV($program, $date); + $report->ac = $this->getAC($program, $date); + $report->sv = $this->getSV($report->ev, $report->pv); + $report->cv = $this->getCV($report->ev, $report->ac); $report->program = $program; $report->weekStart = $this->getThisMonday($date); - $report->staff = zget($data, 'staff', ''); - $report->progress = zget($data, 'progress', ''); - $report->workload = json_encode(zget($data, 'workload', '')); + $report->staff = $this->getStaff($program); + $report->workload = json_encode($this->getWorkloadByType($program, $date)); $this->dao->replace(TABLE_WEEKLYREPORT)->data($report)->exec(); } From eea72cf85175636349857f14d73d44ba29bf6bcd Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Tue, 25 Aug 2020 13:03:07 +0800 Subject: [PATCH 7/9] * Edit block lang. --- module/block/view/programstatisticblock.html.php | 2 +- module/program/lang/en.php | 2 +- module/program/lang/zh-cn.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/block/view/programstatisticblock.html.php b/module/block/view/programstatisticblock.html.php index ba8897a7b8..e739b2941e 100644 --- a/module/block/view/programstatisticblock.html.php +++ b/module/block/view/programstatisticblock.html.php @@ -172,7 +172,7 @@ $(function()
-
+
program->weekly;?> current;?>
diff --git a/module/program/lang/en.php b/module/program/lang/en.php index 89909398ba..56bf1cab5e 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -56,7 +56,7 @@ $lang->program->weekly = 'Program Weekly'; $lang->program->pv = 'PV'; $lang->program->ev = 'EV'; $lang->program->sv = 'SV%'; -$lang->program->ac = 'AV'; +$lang->program->ac = 'AC'; $lang->program->cv = 'CV%'; $lang->program->pm = 'PM'; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index b50a6a8e39..b6b9e9faa1 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -61,7 +61,7 @@ $lang->program->weekly = '项目周报'; $lang->program->pv = 'PV'; $lang->program->ev = 'EV'; $lang->program->sv = 'SV%'; -$lang->program->ac = 'AV'; +$lang->program->ac = 'AC'; $lang->program->cv = 'CV%'; $lang->program->pm = '项目负责人'; $lang->program->teamCount = '项目成员'; From 5885a75c2e2de188ca2708ee506124149f080075 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 25 Aug 2020 13:15:56 +0800 Subject: [PATCH 8/9] * Code for program mothod. --- module/block/control.php | 2 +- module/block/view/recentprogramblock.html.php | 5 +++-- module/program/model.php | 3 ++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 5df76e81ed..10d0aca623 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1498,7 +1498,7 @@ class block extends control { $this->loadModel('project'); - $num = isset($this->params->num) ? (int)$this->params->num : 15; + $num = isset($this->params->num) ? (int)$this->params->num : 15; /* Get projects. */ $this->view->programs = $this->loadModel('program')->getUserPrograms('all', 'id_desc', $num); diff --git a/module/block/view/recentprogramblock.html.php b/module/block/view/recentprogramblock.html.php index 8ff4831f67..d8ab8169df 100644 --- a/module/block/view/recentprogramblock.html.php +++ b/module/block/view/recentprogramblock.html.php @@ -19,13 +19,14 @@ #cards .program-detail > p {margin-bottom: 8px;} #cards .program-detail .progress {height: 4px;} #cards .program-detail .progress-text-left .progress-text {width: 50px; left: -50px;} +#cards .panel-heading {cursor: pointer;}
$program):?>
id");?>'>
- name;?> + createLink('program', 'index', "programID=$program->id", '', '', $program->id), $program->name);?> template === 'cmmi'): ?> program->cmmi; ?> @@ -64,7 +65,7 @@

program->lastIteration; ?>

-
name; ?>
+
name;?>
diff --git a/module/program/model.php b/module/program/model.php index 0542042367..77b32ce669 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -189,7 +189,8 @@ class programModel extends model foreach($programs as $programID => $program) { - $program->projects = $this->project->getProjectStats($status, 0, 0, $itemCounts, 'id_desc', $pager, $programID); + $orderBy = $program->template == 'cmmi' ? 'id_asc' : 'id_desc'; + $program->projects = $this->project->getProjectStats($status, 0, 0, $itemCounts, $orderBy, $pager, $programID); $program->teamCount = isset($teams[$programID]) ? $teams[$programID]->count : 0; $program->estimate = isset($estimates[$programID]) ? $estimates[$programID]->estimate : 0; } From 865cda58f7528681766e6f7f8357757d2ab0400a Mon Sep 17 00:00:00 2001 From: holan20180123 <56391770@qq.com> Date: Tue, 25 Aug 2020 13:21:39 +0800 Subject: [PATCH 9/9] * Finish task #7627. --- config/zentaopms.php | 1 + module/action/config.php | 1 + 2 files changed, 2 insertions(+) diff --git a/config/zentaopms.php b/config/zentaopms.php index ff9bafc479..408f4ee482 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -224,6 +224,7 @@ $config->objectTables['module'] = TABLE_MODULE; $config->objectTables['caselib'] = TABLE_TESTSUITE; $config->objectTables['entry'] = TABLE_ENTRY; $config->objectTables['webhook'] = TABLE_WEBHOOK; +$config->objectTables['risk'] = TABLE_RISK; /* Program privs.*/ $config->programPriv = new stdclass(); diff --git a/module/action/config.php b/module/action/config.php index 7e9c1a3796..9973386a59 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -22,6 +22,7 @@ $config->action->objectNameFields['caselib'] = 'name'; $config->action->objectNameFields['testreport'] = 'title'; $config->action->objectNameFields['entry'] = 'name'; $config->action->objectNameFields['webhook'] = 'name'; +$config->action->objectNameFields['risk'] = 'name'; $config->action->commonImgSize = 870;