diff --git a/module/programplan/control.php b/module/programplan/control.php index c22213af94..d2672c8921 100644 --- a/module/programplan/control.php +++ b/module/programplan/control.php @@ -215,6 +215,7 @@ class programplan extends control $this->loadModel('project'); $this->app->loadLang('execution'); $this->app->loadLang('stage'); + $plan = $this->programplan->getByID($planID); global $lang; @@ -332,6 +333,13 @@ class programplan extends control } } + /** + * AJAX: Get attributes. + * + * @param int $stageID + * @access public + * @return int + */ public function ajaxGetAttribute($stageID) { $this->app->loadLang('stage'); @@ -346,4 +354,17 @@ class programplan extends control return print(zget($this->lang->stage->typeList, $attribute)); } } + + /** + * AJAX: Get stage's attribute. + * + * @param int $stageID + * @access public + * @return int + */ + public function ajaxGetStageAttr($stageID) + { + $stage = $this->dao->select('attribute')->from(TABLE_EXECUTION)->where('id')->eq($stageID)->fetch('attribute'); + return print($stage); + } } diff --git a/module/programplan/js/edit.js b/module/programplan/js/edit.js index 25d3eb9efc..2a527ca7ea 100644 --- a/module/programplan/js/edit.js +++ b/module/programplan/js/edit.js @@ -8,3 +8,42 @@ function changeParentStage(stageID) $("#attribute").chosen(); }) } + +$(function() +{ + $("#parent").change(function() + { + var parent = $(this).children("option:selected").val(); + + if(parent == 0) + { + $("#acl").attr('disabled', false); + } + else + { + $("#acl").attr('disabled', true); + } + + changeParentStage(parent); + }); + + $('#submit').click(function(event) + { + if(plan.parent != $('#parent').val() && $('#parent').val() != 0) + { + var result = true; + + $.ajaxSettings.async = false; + $.get(createLink('programplan', 'ajaxGetStageAttr', 'stageID=' + $('#parent').val()), function(attribute) + { + if(attribute != 'mix' && plan.attribute != attribute) + { + result = confirm(changeAttrLang.replace('%s', stageTypeList[attribute])); + } + }) + $.ajaxSettings.async = true; + + if(!result) return false; + } + }) +}) diff --git a/module/programplan/lang/de.php b/module/programplan/lang/de.php index a6c2630c12..ab7bc6afe7 100644 --- a/module/programplan/lang/de.php +++ b/module/programplan/lang/de.php @@ -79,11 +79,12 @@ $lang->programplan->delayList = array(); $lang->programplan->delayList[1] = 'Yes'; $lang->programplan->delayList[0] = 'No'; -$lang->programplan->noData = 'No Data'; -$lang->programplan->children = 'Sub Plan'; -$lang->programplan->childrenAB = 'Child'; -$lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; -$lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; +$lang->programplan->noData = 'No Data'; +$lang->programplan->children = 'Sub Plan'; +$lang->programplan->childrenAB = 'Child'; +$lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; +$lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; +$lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; $lang->programplan->stageCustom = new stdClass(); $lang->programplan->stageCustom->date = 'Show Date'; diff --git a/module/programplan/lang/en.php b/module/programplan/lang/en.php index fd55b5ec75..8dbeee0a81 100644 --- a/module/programplan/lang/en.php +++ b/module/programplan/lang/en.php @@ -79,11 +79,12 @@ $lang->programplan->delayList = array(); $lang->programplan->delayList[1] = 'Yes'; $lang->programplan->delayList[0] = 'No'; -$lang->programplan->noData = 'No Data'; -$lang->programplan->children = 'Sub Plan'; -$lang->programplan->childrenAB = 'Child'; -$lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; -$lang->programplan->workloadTips = 'The workload of the sub stage is divided by 100%.'; +$lang->programplan->noData = 'No Data'; +$lang->programplan->children = 'Sub Plan'; +$lang->programplan->childrenAB = 'Child'; +$lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; +$lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; +$lang->programplan->workloadTips = 'The workload of the sub stage is divided by 100%.'; $lang->programplan->stageCustom = new stdClass(); $lang->programplan->stageCustom->date = 'Show Date'; diff --git a/module/programplan/lang/fr.php b/module/programplan/lang/fr.php index a6c2630c12..ab7bc6afe7 100644 --- a/module/programplan/lang/fr.php +++ b/module/programplan/lang/fr.php @@ -79,11 +79,12 @@ $lang->programplan->delayList = array(); $lang->programplan->delayList[1] = 'Yes'; $lang->programplan->delayList[0] = 'No'; -$lang->programplan->noData = 'No Data'; -$lang->programplan->children = 'Sub Plan'; -$lang->programplan->childrenAB = 'Child'; -$lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; -$lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; +$lang->programplan->noData = 'No Data'; +$lang->programplan->children = 'Sub Plan'; +$lang->programplan->childrenAB = 'Child'; +$lang->programplan->confirmDelete = 'Do you want to delete the current plan?'; +$lang->programplan->confirmChangeAttr = 'The type of the sub-stage will be adjusted to "%s" synchronously according to the type of the parent stage after modification. Do you want to save?'; +$lang->programplan->workloadTips = 'The proportion of the sub stage workload is divided by 100%.'; $lang->programplan->stageCustom = new stdClass(); $lang->programplan->stageCustom->date = 'Show Date'; diff --git a/module/programplan/lang/zh-cn.php b/module/programplan/lang/zh-cn.php index 255cba9d23..2ce10f6371 100644 --- a/module/programplan/lang/zh-cn.php +++ b/module/programplan/lang/zh-cn.php @@ -79,11 +79,12 @@ $lang->programplan->delayList = array(); $lang->programplan->delayList[1] = '是'; $lang->programplan->delayList[0] = '否'; -$lang->programplan->noData = '暂无数据。'; -$lang->programplan->children = '二级计划'; -$lang->programplan->childrenAB = '子'; -$lang->programplan->confirmDelete = '确定要删除当前计划吗?'; -$lang->programplan->workloadTips = '子阶段工作量占比按百分百的比例进行拆分'; +$lang->programplan->noData = '暂无数据。'; +$lang->programplan->children = '二级计划'; +$lang->programplan->childrenAB = '子'; +$lang->programplan->confirmDelete = '确定要删除当前计划吗?'; +$lang->programplan->confirmChangeAttr = '修改后子阶段的类型将根据父阶段类型同步调整为“%s”,是否保存?'; +$lang->programplan->workloadTips = '子阶段工作量占比按百分百的比例进行拆分'; $lang->programplan->stageCustom = new stdClass(); $lang->programplan->stageCustom->date = '显示日期'; diff --git a/module/programplan/view/edit.html.php b/module/programplan/view/edit.html.php index f3669098b1..c2f7c23ac4 100644 --- a/module/programplan/view/edit.html.php +++ b/module/programplan/view/edit.html.php @@ -12,6 +12,9 @@ ?> + +stage->typeList);?> +programplan->confirmChangeAttr);?>