diff --git a/module/block/control.php b/module/block/control.php index cd53a66a89..b63a02e337 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1118,7 +1118,7 @@ class block extends control $productID = isset($this->session->product) ? 0 : $this->session->product; if($productID && !array_key_exists($productID, $products)) $productID = 0; - $this->view->plans = $this->loadModel('programplan')->getDataForGantt($this->session->program, $productID); + $this->view->plans = $this->loadModel('programplan')->getDataForGantt($this->session->program, $productID, 0, 'task'); $this->view->products = $products; $this->view->productID = $productID; } @@ -1585,8 +1585,8 @@ class block extends control */ public function printScrumoverallBlock() { - $programID = $this->session->program; - $totalData = $this->loadModel('program')->getUserPrograms('all','id_desc',15,$programID); + $programID = $this->session->program; + $totalData = $this->loadModel('program')->getUserPrograms('all', 'id_desc', 15, $programID); $this->view->totalData = $totalData; $this->view->programID = $programID; @@ -1611,20 +1611,29 @@ class block extends control /** * Print srcum road map block. * + * @param int $productID * @access public * @return void */ - public function printScrumroadmapBlock() + public function printScrumroadmapBlock($productID = 0) { $this->session->set('releaseList', $this->app->getURI(true)); $this->session->set('productPlanList', $this->app->getURI(true)); - $products = $this->loadModel('product')->getPairs(); -ksort($products); -$productID = key($products); - $this->view->roadmaps = $this->product->getRoadmap($productID, 0, 6); + $products = $this->loadModel('product')->getPairs(); + if(!is_numeric($productID)) $productID = key($products); + + $this->view->roadmaps = $this->product->getRoadmap($productID, 0, 6); + $this->view->productID = $productID; - $this->view->products = $products; + $this->view->products = $products; + $this->view->sync = 1; + + if($_POST) + { + $this->view->sync = 0; + $this->display('block', 'scrumroadmapblock'); + } } /** diff --git a/module/block/js/dashboard.js b/module/block/js/dashboard.js index 4be23863ba..f1f8c11f22 100644 --- a/module/block/js/dashboard.js +++ b/module/block/js/dashboard.js @@ -248,3 +248,21 @@ $(function() refreshBlock($(this).closest('.panel')); }); }); + +function reloadRoadmap(productID) +{ + $.ajax( + { + url: createLink('block', 'printScrumroadmapBlock', 'id=' + productID), + dataType: "html", + async: false, + data: {id: productID}, + type: 'post', + success: function(data) + { + $("#roadMap").html(''); + $("#roadMap").html(data); + $("#createPlanLink").attr('href',createLink('productplan', 'create', 'id=' + productID) ); + } + }) +} diff --git a/module/block/lang/en.php b/module/block/lang/en.php index a51e6543f9..a15f108193 100644 --- a/module/block/lang/en.php +++ b/module/block/lang/en.php @@ -57,6 +57,8 @@ $lang->block->scrum = 'Scrum+'; $lang->block->allProject = 'All ' . $lang->projectCommon; $lang->block->doingProject = 'Doning ' . $lang->projectCommon; $lang->block->finishProject = 'Finish ' . $lang->projectCommon; +$lang->block->estimatedHours = 'Estimated Hours'; +$lang->block->consumedHours = 'Consumed Hours'; $lang->block->params = new stdclass(); $lang->block->params->name = 'Name'; @@ -247,6 +249,7 @@ $lang->block->default['full']['my']['1']['title'] = 'Welcome'; $lang->block->default['full']['my']['1']['block'] = 'welcome'; $lang->block->default['full']['my']['1']['grid'] = 8; $lang->block->default['full']['my']['1']['source'] = ''; + $lang->block->default['full']['my']['2']['title'] = 'Dynamics'; $lang->block->default['full']['my']['2']['block'] = 'dynamic'; $lang->block->default['full']['my']['2']['grid'] = 4; @@ -259,7 +262,7 @@ $lang->block->default['full']['my']['3']['source'] = 'todo'; $lang->block->default['full']['my']['3']['params']['num'] = '20'; $lang->block->default['full']['my']['4']['title'] = $lang->projectCommon . ' Statistic'; -$lang->block->default['full']['my']['4']['source'] = 'statistic'; +$lang->block->default['full']['my']['4']['block'] = 'statistic'; $lang->block->default['full']['my']['4']['source'] = 'program'; $lang->block->default['full']['my']['4']['grid'] = 8; diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index 0cfdd89c52..605fcfae1e 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -83,6 +83,13 @@ $lang->block->totalStory = '总' . $lang->storyCommon; $lang->block->totalBug = '总Bug'; $lang->block->totalRelease = '发布次数'; +$lang->block->totalInvestment = '总投入'; +$lang->block->totalPeople = '总人数'; +$lang->block->spent = '已花费'; +$lang->block->budget = '预算'; +$lang->block->left = '剩余'; + + $lang->block->default['cmmi']['program']['1']['title'] = '项目周报'; $lang->block->default['cmmi']['program']['1']['block'] = 'cmmireport'; $lang->block->default['cmmi']['program']['1']['source'] = 'program'; @@ -334,7 +341,6 @@ $lang->block->modules['scrum']['index']->availableBlocks->scrumlist = $lang- $lang->block->modules['scrum']['index']->availableBlocks->scrumproject = $lang->projectCommon . '总览'; $lang->block->modules['scrum']['index']->availableBlocks->scrumproduct = $lang->productCommon . '总览'; $lang->block->modules['scrum']['index']->availableBlocks->scrumtest = '待测版本'; -$lang->block->modules['scrum']['index']->availableBlocks->scrumroadmap = $lang->productCommon . '路线图'; $lang->block->modules['cmmi']['index'] = new stdclass(); $lang->block->modules['cmmi']['index']->availableBlocks = new stdclass(); diff --git a/module/block/view/recentprogramblock.html.php b/module/block/view/recentprogramblock.html.php index 0e61fabbb7..27a1c35d0a 100644 --- a/module/block/view/recentprogramblock.html.php +++ b/module/block/view/recentprogramblock.html.php @@ -5,10 +5,10 @@ #cards .panel:hover {border-color: #006AF1; box-shadow: 0 0 10px 0 rgba(0,0,100,.25);} #cards .panel-heading {padding: 12px 24px 10px 16px;} #cards .panel-body {padding: 0 16px 16px;} -#cards .panel-actions {padding: 7px 0;} +#cards .panel-actions {padding: 7px 0;} #cards .panel-actions .dropdown-menu > li > a {padding-left: 5px; text-align: left;} #cards .panel-actions .dropdown-menu > li > a > i {opacity: .5; display: inline-block; margin-right: 4px; width: 18px; text-align: center;} -#cards .panel-actions .dropdown-menu > li > a:hover > i {opacity: 1;} +#cards .panel-actions .dropdown-menu > li > a:hover > i {opacity: 1;} #cards .program-type-label {padding: 1px 2px;} #cards .program-name {font-size: 16px; font-weight: normal; display: inline-block; max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle;} #cards .program-infos {font-size: 12px;} @@ -21,10 +21,13 @@ #cards .program-detail .progress-text-left .progress-text {width: 50px; left: -50px;} #cards .panel-heading {cursor: pointer;} #cards .program-stages-container {margin: 0 -16px -16px -16px; padding: 0 4px; height: 46px; overflow-x: auto; position: relative;} -#cards .program-stages:after {content: ' '; width: 30px; display: block; right: -16px; top: 16px; bottom: -6px; z-index: 1; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); position: absolute;}#cards .program-stages-row {position: relative; height: 30px; z-index: 0;} +#cards .program-stages:after {content: ' '; width: 30px; display: block; right: -16px; top: 16px; bottom: -6px; z-index: 1; background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); position: absolute;} +#cards .program-stages-row {position: relative; height: 30px; z-index: 0;} #cards .program-stage-item {white-space: nowrap; position: absolute; top: 0; min-width: 48px; padding-top: 13px; color: #838A9D;} #cards .program-stage-item > div {white-space: nowrap; overflow: visible; text-align: center; text-overflow: ellipsis;} -#cards .program-stage-item:before {content: ' '; display: block; width: 8px; height: 8px; border-radius: 50%; background: #D1D1D1; position: absolute; left: 50%; margin-left: -4px; top: 0; z-index: 1;}#cards .program-stage-item + .program-stage-item:after {content: ' '; display: block; left: -50%; right: 50%; height: 2px; background-color: #D1D1D1; top: 3px; position: absolute; z-index: 0;}#cards .program-stage-item.is-going {color: #333;} +#cards .program-stage-item:before {content: ' '; display: block; width: 8px; height: 8px; border-radius: 50%; background: #D1D1D1; position: absolute; left: 50%; margin-left: -4px; top: 0; z-index: 1;} +#cards .program-stage-item + .program-stage-item:after {content: ' '; display: block; left: -50%; right: 50%; height: 2px; background-color: #D1D1D1; top: 3px; position: absolute; z-index: 0;} +#cards .program-stage-item.is-going {color: #333;} #cards .program-stage-item.is-going::before {background-color: #0C64EB;}
@@ -115,11 +118,11 @@ $('.block-recentprogram #cards .program-stages-container').each(function() var $row = $container.children(); var totalWidth = 0; $row.children().each(function() - { + { var $item = $(this); $item.css('left', totalWidth); totalWidth += $item.width(); - }); + }); $row.css('minWidth', totalWidth); }); diff --git a/module/block/view/scrumoverallblock.html.php b/module/block/view/scrumoverallblock.html.php index e080d16be8..147f74a6bb 100644 --- a/module/block/view/scrumoverallblock.html.php +++ b/module/block/view/scrumoverallblock.html.php @@ -14,71 +14,76 @@
" . $lang->project->create, '', "class='btn btn-primary'")?>
-
总投入
+
block->totalInvestment;?>
-
我的任务
-
96 +
block->totalPeople;?>
+
+ teamCount ? html::a($this->createLink('program', 'manageMembers', 'programID=' . $programID), $totalData[$programID]->teamCount) : 0;?>
-
已消耗工时
-
96 +
block->consumedHours;?>
+
- 总预计 10 + block->estimatedHours;?> estimate;?>
-
已花费
-
¥200,00 +
block->spent;?>
+
- 预算 ¥1000,00 + block->budget;?> ¥budget;?>
-
-
总需求
- +
+
block->totalStory;?>
+
+ allStories ? html::a($this->createLink('project', 'story', 'projectID=' . $programID), $totalData[$programID]->allStories) : 0;?> +
-
+
-
- 已完成 - 0 +
+ block->done;?> + doneStories;?>
-
- 剩余 - 0 +
+ block->left;?> + leftStories;?>
-
-
总Bug
- +
+
block->totalBug;?>
+
+ allBugs ? html::a($this->createLink('qa', 'index', 'pgm=' . $programID), $totalData[$programID]->allBugs) : 0;?> +
-
+
-
- 已完成 - 0 +
+ block->done;?> + doneBugs;?>
-
- 剩余 - 0 +
+ block->left;?> + leftBugs;?>
diff --git a/module/block/view/scrumroadmapblock.html.php b/module/block/view/scrumroadmapblock.html.php index 98147b6d19..13dc70d7e0 100644 --- a/module/block/view/scrumroadmapblock.html.php +++ b/module/block/view/scrumroadmapblock.html.php @@ -10,19 +10,58 @@ * @link http://www.zentao.net */ ?> +
-
-
createLink('productplan', 'create', 'productID=' . $productID), ''. $lang->productplan->create, '', 'class="btn btn-mini" id="createPlan"');?>
+
+
createLink('productplan', 'create', 'productID=' . $productID), ''. $lang->productplan->create, '', 'class="btn btn-mini" id="createPlanLink"');?>
-
+ + + +
block->emptyTip;?>
+
    $mapBranches):?> @@ -51,4 +90,5 @@
-
+ + diff --git a/module/design/css/commit.css b/module/design/css/commit.css index 71e8d1ff9e..d1a2a856a5 100644 --- a/module/design/css/commit.css +++ b/module/design/css/commit.css @@ -1,3 +1,4 @@ +#mainContent {min-height: 350px;} .searchBox{min-height: 45px;} .searchBox .srearch-date{float: left; width: 20%} .searchBox h4{float:left;display: inline-block} diff --git a/module/design/lang/en.php b/module/design/lang/en.php index 2106dabc73..af6290403d 100644 --- a/module/design/lang/en.php +++ b/module/design/lang/en.php @@ -24,7 +24,6 @@ $lang->design->products = 'Linked Product'; $lang->design->story = 'Linked Story'; $lang->design->file = 'File'; $lang->design->id = 'ID'; -$lang->design->type = 'Type'; $lang->design->story = 'Story'; $lang->design->ditto = 'Ditto'; $lang->design->type = 'Type'; diff --git a/module/design/view/batchcreate.html.php b/module/design/view/batchcreate.html.php index b67cd556ae..5714675f90 100644 --- a/module/design/view/batchcreate.html.php +++ b/module/design/view/batchcreate.html.php @@ -21,8 +21,8 @@ design->id;?> design->story;?> - design->type;?> - design->name;?> + design->type;?> + design->name;?> diff --git a/module/program/control.php b/module/program/control.php index 6316a754fd..7b2e1a7ee2 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -86,12 +86,12 @@ class program extends control * Create a program. * * @param string $template - * @param int $programID + * @param int $parentProgramID * @param int $copyProgramID * @access public * @return void */ - public function create($template = 'cmmi', $programID = 0, $copyProgramID = '') + public function create($template = 'cmmi', $parentProgramID = 0, $copyProgramID = '') { if($_POST) { @@ -109,16 +109,16 @@ class program extends control $acl = 'open'; $privway = 'extend'; - if($programID) + if($parentProgramID) { - $program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch(); - if($this->program->checkHasContent($programID)) + $parentProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($parentProgramID)->fetch(); + if($this->program->checkHasContent($parentProgramID)) { echo js::alert($this->lang->program->cannotCreateChild); die(js::locate('back')); } - if(empty($template)) $template = $program->template; + if(empty($template)) $template = $parentProgram->template; } if($copyProgramID) @@ -145,7 +145,7 @@ class program extends control $this->view->acl = $acl; $this->view->privway = $privway; $this->view->whitelist = $whitelist; - $this->view->programID = $programID; + $this->view->parentProgram = $parentProgramID ? $parentProgram : ''; $this->view->copyProgramID = $copyProgramID; $this->display(); } diff --git a/module/program/css/create.css b/module/program/css/create.css index c6c42d376b..6400101703 100644 --- a/module/program/css/create.css +++ b/module/program/css/create.css @@ -7,3 +7,4 @@ #copyProjectModal a.active {border-color: #00da88; color: #00da88; background-color: #E5FFE6} #copyProjectModal a.active:after {position: absolute; content: '\e92f'; font-family: ZentaoIcon; font-size: 20px; right: 25px;} #copyProjectModal a.cancel {color: #ff5d5d} +#budget {border-right:0px;} diff --git a/module/program/lang/en.php b/module/program/lang/en.php index 8f88d6f2b4..d726527a92 100644 --- a/module/program/lang/en.php +++ b/module/program/lang/en.php @@ -35,17 +35,6 @@ $lang->program->begin = 'Begin'; $lang->program->end = 'End'; $lang->program->status = 'Status'; $lang->program->PM = 'Project Manager'; -$lang->program->create = 'Create'; -$lang->program->createGuide = 'Select the project template'; -$lang->program->browse = 'Program List'; -$lang->program->edit = 'Edit'; -$lang->program->all = 'All'; -$lang->program->start = 'Start'; -$lang->program->finish = 'Finish'; -$lang->program->suspend = 'Suspend'; -$lang->program->delete = 'Delete'; -$lang->program->close = 'Close'; -$lang->program->activate = 'Activate'; $lang->program->budget = 'Budget'; $lang->program->dateRange = 'Date Range'; $lang->program->to = ' to '; @@ -69,19 +58,12 @@ $lang->program->doneStories = 'Done stories'; $lang->program->leftStories = 'Left stories'; $lang->program->allInput = 'All Input'; $lang->program->weekly = 'Program Weekly'; - - $lang->program->pv = 'PV'; $lang->program->ev = 'EV'; $lang->program->sv = 'SV%'; $lang->program->ac = 'AC'; $lang->program->cv = 'CV%'; $lang->program->pm = 'PM'; - -$lang->program->manageGroupMember = 'Manage Group Members'; -$lang->program->durationEstimation = 'Workload estimate'; -$lang->program->noProgram = 'No projects'; -$lang->program->accessDenied = 'You do not have access to this project!'; $lang->program->teamCount = 'The Number Of Team'; $lang->program->unitList[''] = ''; @@ -112,27 +94,29 @@ $lang->program->statusList['doing'] = 'Doing'; $lang->program->statusList['suspended'] = 'Suspended'; $lang->program->statusList['closed'] = 'Closed'; -$lang->program->noProgram = 'No Program'; -$lang->program->accessDenied = 'Has No Access To The Program'; -$lang->program->chooseProgramType = 'Choose management type'; -$lang->program->nextStep = 'Next step'; -$lang->program->hoursUnit = '%s hours'; -$lang->program->membersUnit = '%s members'; -$lang->program->lastIteration = 'Latest iterations'; -$lang->program->ongoingStage = 'Ongoing stage'; -$lang->program->scrum = 'Scrum'; -$lang->program->scrumTitle = 'Scrum development full process project management'; -$lang->program->scrumDesc = 'Introduction: Iterate in small steps, release quickly
Contains function points: Project overview, iterations, plans, stories, etc.'; -$lang->program->cmmi = 'CMMI'; -$lang->program->cmmiTitle = 'CMMI management'; -$lang->program->cmmiDesc = 'Introduction: Standardized management by stages
Contains function points: Estimate, plan, stage, report, etc.'; -$lang->program->cannotCreateChild = 'The project already has actual content and can not add subprojects directly. You can create a parent project for the current project and then add a child project under the new parent project.'; -$lang->program->hasChildren = 'This project has a subproject and can not be deleted.'; -$lang->program->confirmDelete = 'Do you want to delete this project?'; -$lang->program->emptyPM = 'No program manager'; -$lang->program->hasChildren = 'This project has a subproject and can not be deleted.'; -$lang->program->confirmDelete = "Are you sure you want to delete the item [% s ] ?"; -$lang->program->cannotChangeToCat = "The project already has the actual content and can not be modified as a parent project"; -$lang->program->cannotCancelCat = "There are already children under this project. You can not unmark the parent project"; -$lang->program->cannotChangeToCat = "The project already has the actual content and can not be modified as a parent project"; -$lang->program->cannotCancelCat = "There are already children under this project. You can not unmark the parent project"; +$lang->program->noProgram = 'No Program'; +$lang->program->accessDenied = 'Has No Access To The Program'; +$lang->program->chooseProgramType = 'Choose management type'; +$lang->program->nextStep = 'Next step'; +$lang->program->hoursUnit = '%s hours'; +$lang->program->membersUnit = '%s members'; +$lang->program->lastIteration = 'Latest iterations'; +$lang->program->ongoingStage = 'Ongoing stage'; +$lang->program->scrum = 'Scrum'; +$lang->program->scrumTitle = 'Scrum development full process project management'; +$lang->program->scrumDesc = 'Introduction: Iterate in small steps, release quickly
Contains function points: Project overview, iterations, plans, stories, etc.'; +$lang->program->cmmi = 'CMMI'; +$lang->program->cmmiTitle = 'CMMI management'; +$lang->program->cmmiDesc = 'Introduction: Standardized management by stages
Contains function points: Estimate, plan, stage, report, etc.'; +$lang->program->cannotCreateChild = 'The project already has actual content and can not add subprojects directly. You can create a parent project for the current project and then add a child project under the new parent project.'; +$lang->program->hasChildren = 'This project has a subproject and can not be deleted.'; +$lang->program->confirmDelete = 'Do you want to delete this project?'; +$lang->program->emptyPM = 'No program manager'; +$lang->program->cannotChangeToCat = "The project already has the actual content and can not be modified as a parent project"; +$lang->program->cannotCancelCat = "There are already children under this project. You can not unmark the parent project"; +$lang->program->parentBeginEnd = "Begin and end date of parent project: %s ~ %s"; +$lang->program->parentBudget = "Parent project budget: %s"; +$lang->program->beginLetterParent = "Begin date of parent project: %s, Begin date cannot be less than the begin date of parent project."; +$lang->program->endGreaterParent = "End date of parent project: %s, End date cannot be greater than the end date of parent project."; +$lang->program->beginGreateChild = "Minimum begin date of child project: %s, the begin date of parent project cannot be greater than the minimum begin date of child project."; +$lang->program->endLetterChild = "Maximum end date of child project: %s, the end date of parent project cannot be less than the maximum end date of child project."; diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index b6b9e9faa1..7bc8390074 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -114,3 +114,9 @@ $lang->program->confirmDelete = "您确定删除项目[%s]吗?"; $lang->program->emptyPM = '暂无'; $lang->program->cannotChangeToCat = "该项目已经有实际的内容,无法修改为父项目"; $lang->program->cannotCancelCat = "该项目下已经有子项目,无法取消父项目标记"; +$lang->program->parentBeginEnd = "父项目起止时间:%s ~ %s"; +$lang->program->parentBudget = "父项目预算:%s"; +$lang->program->beginLetterParent = "父项目的开始日期:%s,开始日期不能小于父项目的开始日期"; +$lang->program->endGreaterParent = "父项目的完成日期:%s,完成日期不能大于父项目的完成日期"; +$lang->program->beginGreateChild = "子项目的最小开始日期:%s,父项目的开始日期不能大于子项目的最小开始日期"; +$lang->program->endLetterChild = "子项目的最大完成日期:%s,父项目的完成日期不能小于子项目的最大完成日期"; diff --git a/module/program/model.php b/module/program/model.php index fd3ac8fb60..241b941be5 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -3,12 +3,12 @@ class programModel extends model { /** * Get program list. - * + * * @param varchar $status * @param varchar $orderBy * @param object $pager * @access public - * @return void + * @return array */ public function getList($status = 'all', $orderBy = 'id_desc', $pager = NULL) { @@ -31,7 +31,7 @@ class programModel extends model /** * Get program pairs. - * + * * @access public * @return void */ @@ -47,7 +47,7 @@ class programModel extends model /** * Get program pairs by template. - * + * * @param varchar $template * @access public * @return void @@ -65,7 +65,7 @@ class programModel extends model /** * Get user programs for block. - * + * * @param varchar $status * @param varchar $orderBy * @param int $limit @@ -154,12 +154,12 @@ class programModel extends model foreach($programs as $programID => $program) { $program->teamCount = isset($teams[$programID]) ? $teams[$programID]->count : 0; - $program->consumed = isset($hours[$programID]) ? $hours[$programID]->consumed : 0; - $program->estimate = isset($hours[$programID]) ? $hours[$programID]->estimate : 0; - $program->leftTasks = isset($leftTasks[$programID]) ? $leftTasks[$programID]->leftTasks : 0; - $program->allStories = isset($allStories[$programID]) ? $allStories[$programID]->allStories : 0; - $program->doneStories = isset($doneStories[$programID]) ? $doneStories[$programID]->doneStories : 0; - $program->leftStories = isset($leftStories[$programID]) ? $leftStories[$programID]->leftStories : 0; + $program->consumed = isset($hours[$programID]) ? $hours[$programID]->consumed : 0; + $program->estimate = isset($hours[$programID]) ? $hours[$programID]->estimate : 0; + $program->leftTasks = isset($leftTasks[$programID]) ? $leftTasks[$programID]->leftTasks : 0; + $program->allStories = isset($allStories[$programID]) ? $allStories[$programID]->allStories : 0; + $program->doneStories = isset($doneStories[$programID]) ? $doneStories[$programID]->doneStories : 0; + $program->leftStories = isset($leftStories[$programID]) ? $leftStories[$programID]->leftStories : 0; $program->leftBugs = isset($leftBugs[$programID]) ? $leftBugs[$programID]->leftBugs : 0; $program->allBugs = isset($allBugs[$programID]) ? $allBugs[$programID]->allBugs : 0; $program->doneBugs = isset($doneBugs[$programID]) ? $doneBugs[$programID]->doneBugs : 0; @@ -247,13 +247,21 @@ class programModel extends model ->setIF($this->post->acl != 'custom', 'whitelist', '') ->setDefault('openedBy', $this->app->user->account) ->setDefault('openedDate', helper::now()) - ->setDefault('team', substr($this->post->name,0, 30)) + ->setDefault('team', substr($this->post->name, 0, 30)) ->join('whitelist', ',') ->cleanInt('budget') ->stripTags($this->config->program->editor->create['id'], $this->config->allowedTags) ->remove('products, workDays, delta, branch, uid, plans') ->get(); + if($project->parent) + { + $parentProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($project->parent)->fetch(); + if($project->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $parentProgram->begin); + if($project->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end); + if(dao::isError()) return false; + } + $project = $this->loadModel('file')->processImgURL($project, $this->config->program->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_PROJECT)->data($project) ->autoCheck() @@ -290,7 +298,7 @@ class programModel extends model else { $pgmAdminID = $this->dao->select('id')->from(TABLE_GROUP)->where('role')->eq('pgmadmin')->fetch('id'); - $groupPriv = new stdclass(); + $groupPriv = new stdclass(); $groupPriv->account = $this->app->user->account; $groupPriv->group = $pgmAdminID; $groupPriv->program = $programID; @@ -323,8 +331,8 @@ class programModel extends model /** * Update program. - * - * @param int $programID + * + * @param int $programID * @access public * @return array */ @@ -345,10 +353,25 @@ class programModel extends model ->get(); $program = $this->loadModel('file')->processImgURL($program, $this->config->program->editor->edit['id'], $this->post->uid); - if(!empty($program->isCat) and $this->checkHasContent($programID)) dao::$errors['isCat'] = $this->lang->program->cannotChangeToCat; - if(empty($program->isCat) and $this->checkHasChildren($programID)) dao::$errors['isCat'] = $this->lang->program->cannotCancelCat; - if(dao::isError()) return false; + if(!$oldProgram->isCat and !empty($program->isCat) and $this->checkHasContent($programID)) dao::$errors['isCat'] = $this->lang->program->cannotChangeToCat; + if($oldProgram->isCat and empty($program->isCat) and $this->checkHasChildren($programID)) dao::$errors['isCat'] = $this->lang->program->cannotCancelCat; + if(!empty($program->isCat)) + { + $minChildBegin = $this->dao->select('min(begin) as minBegin')->from(TABLE_PROJECT)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->fetch('minBegin'); + $maxChildEnd = $this->dao->select('max(end) as maxEnd')->from(TABLE_PROJECT)->where('id')->ne($programID)->andWhere('deleted')->eq(0)->andWhere('path')->like("%,{$programID},%")->fetch('maxEnd'); + + if($minChildBegin and $program->begin > $minChildBegin) dao::$errors['begin'] = sprintf($this->lang->program->beginGreateChild, $minChildBegin); + if($maxChildEnd and $program->end < $maxChildEnd) dao::$errors['end'] = sprintf($this->lang->program->endLetterChild, $maxChildEnd); + } + + if($program->parent) + { + $parentProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($program->parent)->fetch(); + if($parentProgram and $program->begin < $parentProgram->begin) dao::$errors['begin'] = sprintf($this->lang->program->beginLetterParent, $parentProgram->begin); + if($parentProgram and $program->end > $parentProgram->end) dao::$errors['end'] = sprintf($this->lang->program->endGreaterParent, $parentProgram->end); + } + if(dao::isError()) return false; $this->dao->update(TABLE_PROJECT)->data($program) ->autoCheck($skipFields = 'begin,end') @@ -388,20 +411,20 @@ class programModel extends model * @return void */ public function getSwapper($programs, $programID, $currentModule, $currentMethod, $extra = '') - { + { $this->loadModel('project'); $currentProgramName = ''; if($programID) - { + { setCookie("lastProgram", $programID, $this->config->cookieLife, $this->config->webRoot, '', false, true); $currentProgram = $this->project->getById($programID); $currentProgramName = $currentProgram->name; - } + } if($currentModule == 'program' && $currentMethod == 'browse') $currentProgramName = $this->lang->program->all; $dropMenuLink = helper::createLink('program', 'ajaxGetDropMenu', "objectID=$programID&module=$currentModule&method=$currentMethod&extra=$extra"); $output = "
"; //if($isMobile) $output = "{$currentProjectName} "; @@ -433,39 +456,39 @@ class programModel extends model /** * Check has content for program - * - * @param int $programID + * + * @param int $programID * @access public * @return bool */ public function checkHasContent($programID) { $count = 0; - $count += $this->dao->select('count(*) as count')->from(TABLE_BUDGET)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_BUG)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_CASE)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_DESIGN)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_DOC)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_DURATIONESTIMATION)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_ISSUE)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_RELATION)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_RELEASE)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_REPO)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_RISK)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_STORY)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_TESTREPORT)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_TESTSUITE)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_TESTTASK)->where('program')->eq($programID)->fetch('count'); - $count += $this->dao->select('count(*) as count')->from(TABLE_WORKESTIMATION)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_BUDGET)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_BUG)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_CASE)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_DESIGN)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_DOC)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_DURATIONESTIMATION)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_ISSUE)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_RELATION)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_RELEASE)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_REPO)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_RISK)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_STORY)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_TESTREPORT)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_TESTSUITE)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_TESTTASK)->where('program')->eq($programID)->fetch('count'); + $count += (int)$this->dao->select('count(*) as count')->from(TABLE_WORKESTIMATION)->where('program')->eq($programID)->fetch('count'); return $count > 0; } /** * Check has children project. - * - * @param int $programID + * + * @param int $programID * @access public * @return bool */ @@ -477,8 +500,8 @@ class programModel extends model /** * Set program tree path. - * - * @param int $programID + * + * @param int $programID * @access public * @return bool */ @@ -501,8 +524,8 @@ class programModel extends model } /** - * Get program parent pairs - * + * Get program parent pairs + * * @access public * @return array */ @@ -552,11 +575,11 @@ class programModel extends model /** * Move project node. - * - * @param int $programID - * @param int $parentID - * @param string $oldPath - * @param int $oldGrade + * + * @param int $programID + * @param int $parentID + * @param string $oldPath + * @param int $oldGrade * @access public * @return bool */ diff --git a/module/program/view/create.html.php b/module/program/view/create.html.php index 8e323842dd..7e067c6ff7 100644 --- a/module/program/view/create.html.php +++ b/module/program/view/create.html.php @@ -75,8 +75,14 @@ program->budget;?> - - program->unitList, 'yuan', "class='form-control'");?> + +
+ + + program->unitList, empty($parentProgram->budgetUnit) ? 'yuan' : $parentProgram->budgetUnit, "class='form-control'");?> +
+ + program->parentBudget, $parentProgram->budget . zget($lang->program->unitList, $parentProgram->budgetUnit, ''));?> program->dateRange;?> @@ -87,7 +93,7 @@ program->end . "' required");?>
- + program->parentBeginEnd, $parentProgram->begin, $parentProgram->end);?> @@ -137,7 +143,7 @@ id); ?> @@ -175,5 +181,5 @@
- +id);?> diff --git a/module/programplan/control.php b/module/programplan/control.php index 011e276f7f..477c082c4c 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -152,7 +152,7 @@ class programplan extends control $custom = empty($data->stageCustom) ? '' : implode(',', $data->stageCustom); $setting->setItem("$owner.$module.$section.$object", $custom); - $respone = array(); + $response = array(); $response['result'] = 'success'; $response['message'] = ''; $this->send($response); diff --git a/module/programplan/model.php b/module/programplan/model.php index 4eb96fe7b4..1a66e9cd71 100644 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -99,7 +99,17 @@ class programplanModel extends model return $pairs; } - public function getDataForGantt($programID, $productID, $baselineID = 0) + /** + * Get gantt data + * + * @param int $programID + * @param int $productID + * @param int $baselineID + * @param string $selectCustom + * @access public + * @return string + */ + public function getDataForGantt($programID, $productID, $baselineID = 0, $selectCustom = '') { $this->loadModel('stage'); @@ -161,7 +171,8 @@ class programplanModel extends model $section = 'browse'; $object = 'stageCustom'; $setting = $this->loadModel('setting'); - $selectCustom = $setting->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}"); + + if(empty($selectCustom)) $selectCustom = $setting->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}"); $tasks = array(); if(strpos($selectCustom, 'task') !== false) diff --git a/module/programplan/view/gantt.html.php b/module/programplan/view/gantt.html.php index cd22c791c4..ddcea655c9 100644 --- a/module/programplan/view/gantt.html.php +++ b/module/programplan/view/gantt.html.php @@ -27,13 +27,13 @@ form {display: block; margin-top: 0em; margin-block-end: 1em;}