From 11d80a5d93d299ba21cd287d5f8f9862bb70ed8e Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 14 Dec 2017 15:29:09 +0800 Subject: [PATCH] * finish task #3442. --- module/action/control.php | 17 +++++++++++++++++ module/action/lang/en.php | 1 + module/action/lang/zh-cn.php | 1 + module/bug/view/view.html.php | 2 +- module/common/model.php | 2 +- module/doc/view/view.html.php | 2 +- module/group/lang/resource.php | 3 +++ module/story/model.php | 2 +- module/story/view/view.html.php | 2 +- module/task/view/view.html.php | 2 +- module/testcase/view/view.html.php | 2 +- module/upgrade/model.php | 20 ++++++++++++++++++++ 12 files changed, 49 insertions(+), 7 deletions(-) diff --git a/module/action/control.php b/module/action/control.php index 4bfd85b965..5916f33db9 100755 --- a/module/action/control.php +++ b/module/action/control.php @@ -104,6 +104,23 @@ class action extends control } } + /** + * Comment. + * + * @param string $objectType + * @param int $objectID + * @access public + * @return void + */ + public function comment($objectType, $objectID) + { + $actionID = $this->action->create($objectType, $objectID, 'Commented', $this->post->comment); + + $moduleName = $objectType == 'case' ? 'testcase' : $objectType; + $this->loadModel($moduleName)->sendmail($objectID, $actionID); + die(js::reload('parent')); + } + /** * Edit comment of a action. * diff --git a/module/action/lang/en.php b/module/action/lang/en.php index c82640c395..34e6c6c784 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -25,6 +25,7 @@ $lang->action->undelete = 'Restore'; $lang->action->hideOne = 'Hide'; $lang->action->hideAll = 'Hide All'; $lang->action->editComment = 'Edit'; +$lang->action->comment = 'Comment'; $lang->action->trashTips = 'Note: Delete in ZenTao is logic.'; $lang->action->textDiff = 'Text Format'; diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index b03587b84c..7021b27d0d 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -25,6 +25,7 @@ $lang->action->undelete = '还原'; $lang->action->hideOne = '隐藏'; $lang->action->hideAll = '全部隐藏'; $lang->action->editComment = '修改备注'; +$lang->action->comment = '备注'; $lang->action->trashTips = '提示:为了保证系统的完整性,禅道系统的删除都是标记删除。'; $lang->action->textDiff = '文本格式'; diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 566e8e240b..1f26194dbf 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -89,7 +89,7 @@
deleted) echo $actionLinks;?>
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/common/model.php b/module/common/model.php index abb20b1c12..6a1d892c9e 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -631,7 +631,7 @@ class commonModel extends model global $lang; - if(!commonModel::hasPriv($module, 'edit', $object)) return false; + if(!commonModel::hasPriv('action', 'comment', $object)) return false; echo html::a('#commentBox', '', '', "title='$lang->comment' onclick='setComment()' class='btn'"); } diff --git a/module/doc/view/view.html.php b/module/doc/view/view.html.php index 284c3dbecd..b584f29a10 100644 --- a/module/doc/view/view.html.php +++ b/module/doc/view/view.html.php @@ -126,7 +126,7 @@
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index b075352107..437461f233 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1005,12 +1005,15 @@ $lang->resource->action->trash = 'trash'; $lang->resource->action->undelete = 'undelete'; $lang->resource->action->hideOne = 'hideOne'; $lang->resource->action->hideAll = 'hideAll'; +$lang->resource->action->comment = 'comment'; $lang->resource->action->editComment = 'editComment'; $lang->action->methodOrder[5] = 'trash'; $lang->action->methodOrder[10] = 'undelete'; $lang->action->methodOrder[15] = 'hideOne'; $lang->action->methodOrder[20] = 'hideAll'; +$lang->action->methodOrder[25] = 'comment'; +$lang->action->methodOrder[30] = 'editComment'; $lang->resource->backup = new stdclass(); $lang->resource->backup->index = 'index'; diff --git a/module/story/model.php b/module/story/model.php index d529a6db62..99373c4d66 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -479,7 +479,7 @@ class storyModel extends model ->join('mailto', ',') ->remove('linkStories,childStories,files,labels,comment') ->get(); - if(is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ','); + if(isset($story->plan) and is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ','); if(empty($_POST['product'])) $story->branch = $oldStory->branch; $this->dao->update(TABLE_STORY) diff --git a/module/story/view/view.html.php b/module/story/view/view.html.php index fb1993a93d..14efabf849 100644 --- a/module/story/view/view.html.php +++ b/module/story/view/view.html.php @@ -116,7 +116,7 @@
comment;?> -
id")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index 6513264aab..50b935fa13 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -156,7 +156,7 @@
deleted) echo $actionLinks;?>
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/testcase/view/view.html.php b/module/testcase/view/view.html.php index 8dfc0b1984..a240f2f97d 100644 --- a/module/testcase/view/view.html.php +++ b/module/testcase/view/view.html.php @@ -119,7 +119,7 @@
comment;?> -
id&comment=true")?>'> + id")?>' target='hiddenwin'>
diff --git a/module/upgrade/model.php b/module/upgrade/model.php index a5094c9664..a41e3331c2 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -1918,4 +1918,24 @@ class upgradeModel extends model return true; } + + /** + * Adjust Priv for 9.7 + * + * @access public + * @return bool + */ + public function adjustPriv9_7() + { + $groups = $this->dao->select('*')->from(TABLE_GROUPPRIV)->where('method')->eq('edit')->andWhere('module')->in('story,task,bug,testcase')->fetchPairs('group', 'group'); + foreach($groups as $groupID) + { + $groupPriv = new stdclass(); + $groupPriv->group = $groupID; + $groupPriv->module = 'action'; + $groupPriv->method = 'comment'; + $this->dao->replace(TABLE_GROUPPRIV)->data($groupPriv)->exec(); + } + return true; + } }