From e4f221bf59b9e2ef979dafbf292d7b3e8c4bc3dc Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Fri, 4 Jun 2021 16:41:38 +0800 Subject: [PATCH] * Finish task #38917. --- module/todo/config.php | 7 +++++ module/todo/js/common.js | 38 +++------------------------ module/todo/view/batchcreate.html.php | 3 ++- module/todo/view/batchedit.html.php | 2 ++ module/todo/view/create.html.php | 2 ++ module/todo/view/edit.html.php | 2 ++ 6 files changed, 18 insertions(+), 36 deletions(-) diff --git a/module/todo/config.php b/module/todo/config.php index e55b9366ce..70433368b4 100644 --- a/module/todo/config.php +++ b/module/todo/config.php @@ -28,3 +28,10 @@ $config->todo->custom->batchCreateFields = 'type,pri,desc,beginAndEnd'; $config->todo->custom->batchEditFields = 'pri,beginAndEnd,status'; $config->todo->moduleList = array('bug', 'task', 'story', 'review', 'testtask'); + +$config->todo->getUserObjectsMethod = array(); +$config->todo->getUserObjectsMethod['bug'] = 'ajaxGetUserBugs'; +$config->todo->getUserObjectsMethod['task'] = 'ajaxGetUserTasks'; +$config->todo->getUserObjectsMethod['story'] = 'ajaxGetUserStories'; +$config->todo->getUserObjectsMethod['testtask'] = 'ajaxGetUserTestTasks'; +$config->todo->getUserObjectsMethod['review'] = 'ajaxGetUserReviews'; diff --git a/module/todo/js/common.js b/module/todo/js/common.js index af797a3d15..bd8e00ce07 100644 --- a/module/todo/js/common.js +++ b/module/todo/js/common.js @@ -25,44 +25,12 @@ function loadList(type, id) var param = 'userID=' + userID; if(id) param += '&id=' + id; - if(type == 'bug') + if(moduleList.indexOf(type) !== -1) { - link = createLink('bug', 'ajaxGetUserBugs', param); - } - else if(type == 'task') - { - link = createLink('task', 'ajaxGetUserTasks', param); - } - else if(type == 'story') - { - link = createLink('story', 'ajaxGetUserStories', param); - } - else if(type == 'issue') - { - link = createLink('issue', 'ajaxGetUserIssues', param); - } - else if(type == 'risk') - { - link = createLink('risk', 'ajaxGetUserRisks', param); - } - else if(type == 'opportunity') - { - link = createLink('opportunity', 'ajaxGetUseropportunities', param); - } - else if(type == 'testtask') - { - link = createLink('testtask', 'ajaxGetUserTestTasks', param); - } - else if(type == 'review') - { - link = createLink('review', 'ajaxGetUserReviews', param); - } - else if(type == 'feedback') - { - link = createLink('feedback', 'ajaxGetUserFeedback', param); + link = createLink(type, objectsMethod[type], param); } - if(type == 'bug' || type == 'task' || type == 'story' || type == 'issue' || type == 'risk' || type == 'testtask' || type == 'review' || type == 'feedback' || type == 'opportunity') + if(moduleList.indexOf(type) !== -1) { $.get(link, function(data, status) { diff --git a/module/todo/view/batchcreate.html.php b/module/todo/view/batchcreate.html.php index fbe62153aa..1d1b307da9 100755 --- a/module/todo/view/batchcreate.html.php +++ b/module/todo/view/batchcreate.html.php @@ -12,7 +12,8 @@ ?> - +todo->moduleList)?> +todo->getUserObjectsMethod)?>
'>
diff --git a/module/todo/view/batchedit.html.php b/module/todo/view/batchedit.html.php index e5558709ad..2786648b85 100644 --- a/module/todo/view/batchedit.html.php +++ b/module/todo/view/batchedit.html.php @@ -12,6 +12,8 @@ ?> +todo->moduleList)?> +todo->getUserObjectsMethod)?>

todo->common . $lang->colon . $lang->todo->batchEdit;?>

diff --git a/module/todo/view/create.html.php b/module/todo/view/create.html.php index 746c8b9632..029dd74a8b 100644 --- a/module/todo/view/create.html.php +++ b/module/todo/view/create.html.php @@ -14,6 +14,8 @@ todo->noTodo);?> +todo->moduleList)?> +todo->getUserObjectsMethod)?>
diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index 478cf45269..bb6454d7bf 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -13,6 +13,8 @@ +todo->moduleList)?> +todo->getUserObjectsMethod)?>