diff --git a/module/programplan/control.php b/module/programplan/control.php index aeb5713f72..c22213af94 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -212,8 +212,9 @@ class programplan extends control */ public function edit($planID = 0, $projectID = 0) { - $this->app->loadLang('project'); + $this->loadModel('project'); $this->app->loadLang('execution'); + $this->app->loadLang('stage'); $plan = $this->programplan->getByID($planID); global $lang; @@ -234,12 +235,14 @@ class programplan extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); } - $this->app->loadLang('stage'); - $this->view->title = $this->lang->programplan->edit; - $this->view->position[] = $this->lang->programplan->edit; - $this->view->parentStage = $this->programplan->getParentStageList($this->session->project, $planID, $plan->product); - $this->view->isCreateTask = $this->programplan->isCreateTask($planID); - $this->view->plan = $plan; + $parentStage = $this->project->getByID($plan->parent, 'stage'); + + $this->view->title = $this->lang->programplan->edit; + $this->view->position[] = $this->lang->programplan->edit; + $this->view->isCreateTask = $this->programplan->isCreateTask($planID); + $this->view->plan = $plan; + $this->view->parentStageList = $this->programplan->getParentStageList($this->session->project, $planID, $plan->product); + $this->view->enableOptionalAttr = (empty($parentStage) or (!empty($parentStage) and $parentStage->attribute == 'mix')); $this->display(); } @@ -328,4 +331,19 @@ class programplan extends control return $this->send(array('result' => 'success')); } } + + public function ajaxGetAttribute($stageID) + { + $this->app->loadLang('stage'); + + $attribute = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute'); + if(empty($attribute) or $attribute == 'mix') + { + return print(html::select('attribute', $this->lang->stage->typeList, $attribute, "class='form-control chosen'")); + } + else + { + return print(zget($this->lang->stage->typeList, $attribute)); + } + } } diff --git a/module/programplan/js/edit.js b/module/programplan/js/edit.js new file mode 100644 index 0000000000..25d3eb9efc --- /dev/null +++ b/module/programplan/js/edit.js @@ -0,0 +1,10 @@ +function changeParentStage(stageID) +{ + $.get(createLink('programplan', 'ajaxGetAttribute', 'stageID=' + stageID), function(attribute) + { + $('#attributeType td').html(attribute); + $("#attribute" + "_chosen").remove(); + $("#attribute").next('.picker').remove(); + $("#attribute").chosen(); + }) +} diff --git a/module/programplan/view/edit.html.php b/module/programplan/view/edit.html.php index 3cb46b97eb..f3669098b1 100644 --- a/module/programplan/view/edit.html.php +++ b/module/programplan/view/edit.html.php @@ -25,7 +25,7 @@