From c9a7361259da76172318740af593b623755d30a0 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Tue, 9 Feb 2010 07:48:21 +0000 Subject: [PATCH] * adjust the UI of action logs. --- trunk/module/action/lang/zh-cn.php | 33 +++++++++++ trunk/module/action/model.php | 59 +++++++++++++++++++ .../module/admin/view/browsecompany.html.php | 2 +- trunk/module/admin/view/browsegroup.html.php | 2 +- trunk/module/admin/view/browseuser.html.php | 2 +- trunk/module/bug/control.php | 2 +- trunk/module/bug/lang/zh-cn.php | 2 + trunk/module/common/action.html.php | 23 ++------ trunk/module/common/lang/zh-cn.php | 3 +- trunk/module/company/view/browse.html.php | 2 +- trunk/module/group/view/browse.html.php | 2 +- trunk/module/my/view/story.html.php | 2 +- trunk/module/my/view/task.html.php | 2 +- trunk/module/my/view/todo.html.php | 2 +- trunk/module/product/view/browse.html.php | 2 +- trunk/module/productplan/view/browse.html.php | 2 +- .../productplan/view/linkstory.html.php | 2 +- trunk/module/productplan/view/view.html.php | 2 +- trunk/module/project/view/browse.html.php | 2 +- trunk/module/project/view/build.html.php | 2 +- trunk/module/project/view/index.html.php | 2 +- trunk/module/project/view/story.html.php | 2 +- trunk/module/project/view/task.html.php | 2 +- trunk/module/project/view/team.html.php | 2 +- trunk/module/release/view/browse.html.php | 2 +- trunk/module/story/control.php | 2 +- trunk/module/story/lang/zh-cn.php | 3 + trunk/module/task/view/import.html.php | 2 +- trunk/module/testcase/view/create.html.php | 2 +- trunk/module/testcase/view/edit.html.php | 2 +- trunk/module/testtask/view/browse.html.php | 2 +- trunk/module/testtask/view/view.html.php | 2 +- trunk/module/user/view/task.html.php | 2 +- 33 files changed, 130 insertions(+), 47 deletions(-) create mode 100644 trunk/module/action/lang/zh-cn.php diff --git a/trunk/module/action/lang/zh-cn.php b/trunk/module/action/lang/zh-cn.php new file mode 100644 index 0000000000..7f03019109 --- /dev/null +++ b/trunk/module/action/lang/zh-cn.php @@ -0,0 +1,33 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package bug + * @version $Id$ + * @link http://www.zentao.cn + */ +$lang->action->label->common = '$date, $action by $actor'; +$lang->action->label->extra = '$date, $action as $extra by $actor'; +$lang->action->label->opened = '$date, 由 $actor 创建。'; +$lang->action->label->changed = '$date, 由 $actor 变更。'; +$lang->action->label->edited = '$date, 由 $actor 编辑。'; +$lang->action->label->closed = '$date, 由 $actor 关闭。'; +$lang->action->label->commented = '$date, 由 $actor 发表评论。'; +$lang->action->label->activated = '$date, 由 $actor 激活。'; +$lang->action->label->diff1 = '修改了 %s,旧值为 "%s",新值为 "%s"。
'; +$lang->action->label->diff2 = '修改了 %s,区别为
%s
'; diff --git a/trunk/module/action/model.php b/trunk/module/action/model.php index 17224b9176..56d8f7c0a2 100644 --- a/trunk/module/action/model.php +++ b/trunk/module/action/model.php @@ -83,4 +83,63 @@ class actionModel extends model $this->dao->insert(TABLE_HISTORY)->data($change)->exec(); } } + + /* 打印action标题。*/ + public function printAction($action) + { + $objectType = $action->objectType; + $actionType = strtolower($action->action); + if(isset($this->lang->$objectType->action->$actionType)) + { + $label = $this->lang->$objectType->action->$actionType; + } + elseif(isset($this->lang->action->label->$actionType)) + { + $label = $this->lang->action->label->$actionType; + } + else + { + $label = $action->extra ? $this->lang->action->label->extra : $this->lang->action->label->common; + } + + foreach($action as $key => $value) + { + if($key == 'history') continue; + if(is_array($label)) + { + if($key == 'extra') continue; + $label['main'] = str_replace('$' . $key, $value, $label['main']); + } + else + { + $label = str_replace('$' . $key, $value, $label); + } + } + if(is_array($label)) + { + echo str_replace('$extra', $label['extra'][strtolower($action->extra)], $label['main']); + } + else + { + echo $label; + } + } + + /* 打印修改记录。*/ + public function printChanges($objectType, $histories) + { + foreach($histories as $history) + { + $fieldName = $history->field; + $fieldLabel = isset($this->lang->$objectType->$fieldName) ? $this->lang->$objectType->$fieldName : $fieldName; + if($history->diff != '') + { + printf($this->lang->action->label->diff2, $fieldLabel, nl2br($history->diff)); + } + else + { + printf($this->lang->action->label->diff1, $fieldLabel, $history->old, $history->new); + } + } + } } diff --git a/trunk/module/admin/view/browsecompany.html.php b/trunk/module/admin/view/browsecompany.html.php index 1c2beabd28..84d3c3cc94 100644 --- a/trunk/module/admin/view/browsecompany.html.php +++ b/trunk/module/admin/view/browsecompany.html.php @@ -36,7 +36,7 @@ company->backyard;?> company->pms;?> company->guest;?> - action;?> + actions;?> diff --git a/trunk/module/admin/view/browsegroup.html.php b/trunk/module/admin/view/browsegroup.html.php index 0dd21cf096..96a4f2bb72 100644 --- a/trunk/module/admin/view/browsegroup.html.php +++ b/trunk/module/admin/view/browsegroup.html.php @@ -36,7 +36,7 @@ group->name;?> group->desc;?> group->users;?> - action;?> + actions;?> diff --git a/trunk/module/admin/view/browseuser.html.php b/trunk/module/admin/view/browseuser.html.php index 6c1957417c..6495f6b750 100644 --- a/trunk/module/admin/view/browseuser.html.php +++ b/trunk/module/admin/view/browseuser.html.php @@ -42,7 +42,7 @@ user->phone;?> user->join;?> user->visits;?> - action;?> + actions;?> diff --git a/trunk/module/bug/control.php b/trunk/module/bug/control.php index 113317472e..043b98d0c0 100644 --- a/trunk/module/bug/control.php +++ b/trunk/module/bug/control.php @@ -232,7 +232,7 @@ class bug extends control { $action = !empty($changes) ? 'Edited' : 'Commented'; $fileAction = ''; - if(!empty($files)) $fileAction = "Add Files " . join(',', $files) . "\n" ; + if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ; $actionID = $this->action->create('bug', $bugID, $action, $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); $this->sendmail($bugID, $actionID); diff --git a/trunk/module/bug/lang/zh-cn.php b/trunk/module/bug/lang/zh-cn.php index 60d3d767ec..127b19dc02 100644 --- a/trunk/module/bug/lang/zh-cn.php +++ b/trunk/module/bug/lang/zh-cn.php @@ -164,3 +164,5 @@ $lang->bug->files = '附件'; $lang->bug->tblStep = "[步骤]\n"; $lang->bug->tblResult = "[结果]\n"; $lang->bug->tblExpect = "[期望]\n"; + +$lang->bug->action->resolved = array('main' => '$date, 由 $actor 解决,方案为 $extra。', 'extra' => $lang->bug->resolutionList); diff --git a/trunk/module/common/action.html.php b/trunk/module/common/action.html.php index fb83755066..234aa1d0b8 100644 --- a/trunk/module/common/action.html.php +++ b/trunk/module/common/action.html.php @@ -2,33 +2,18 @@
history . $lang->reverse;?>
    - +
  1. actor])) $action->actor = $users[$action->actor]; if(strpos($action->actor, ':') !== false) $action->actor = substr($action->actor, strpos($action->actor, ':') + 1); - if($action->objectType == 'bug' and $action->action == 'Resolved') $action->action .= " as $action->extra"; - if($action->objectType == 'story' and $action->action == 'Reviewed') $action->action .= " as $action->extra"; - if($action->objectType == 'story' and $action->action == 'Closed') $action->action .= " for $action->extra"; ?> - date, $action->action by $action->actor"; ?> + action->printAction($action);?> comment) or !empty($action->history)):?>
    - history as $history) - { - if($history->diff != '') - { - echo "CHANGE $history->field, the diff is:
    " . nl2br($history->diff) . "
    "; - } - else - { - echo "CHANGE $history->field FROM '$history->old' TO '$history->new' .
    "; - } - } - echo nl2br($action->comment); - ?> +
    action->printChanges($action->objectType, $action->history);?>
    + comment and $action->history) echo '
    '; echo nl2br($action->comment);?>
  2. diff --git a/trunk/module/common/lang/zh-cn.php b/trunk/module/common/lang/zh-cn.php index 8c132c8bd3..90ee44f049 100644 --- a/trunk/module/common/lang/zh-cn.php +++ b/trunk/module/common/lang/zh-cn.php @@ -36,7 +36,7 @@ $lang->close = '关闭'; $lang->activate = '激活'; $lang->delete = '删除'; $lang->save = '保存'; -$lang->action = '操作'; +$lang->actions = '操作'; $lang->comment = '备注'; $lang->history = '历史记录'; $lang->welcome = "欢迎使用%s{$lang->colon}{$lang->zentaoMS}"; @@ -51,6 +51,7 @@ $lang->goback = '返回'; $lang->selectAll = '全选'; $lang->attatch = '附件'; $lang->reverse = '(切换顺序)'; +$lang->addFiles = '上传了附件 '; /* 主导航菜单。*/ $lang->menu->index = '首页|index|index'; diff --git a/trunk/module/company/view/browse.html.php b/trunk/module/company/view/browse.html.php index 7cb1d0a8e2..c73e91f37e 100644 --- a/trunk/module/company/view/browse.html.php +++ b/trunk/module/company/view/browse.html.php @@ -56,7 +56,7 @@ include '../../common/tablesorter.html.php'; user->join;?> user->visits;?> user->status;?> - action;?> + actions;?> diff --git a/trunk/module/group/view/browse.html.php b/trunk/module/group/view/browse.html.php index 0a32a9188a..204d585b93 100644 --- a/trunk/module/group/view/browse.html.php +++ b/trunk/module/group/view/browse.html.php @@ -30,7 +30,7 @@ group->name;?> group->desc;?> group->users;?> - action;?> + actions;?> diff --git a/trunk/module/my/view/story.html.php b/trunk/module/my/view/story.html.php index 9513408b76..5038a3d779 100644 --- a/trunk/module/my/view/story.html.php +++ b/trunk/module/my/view/story.html.php @@ -38,7 +38,7 @@ story->estimate;?> story->status;?> story->lastEditedDate;?> - action;?> + actions;?> diff --git a/trunk/module/my/view/task.html.php b/trunk/module/my/view/task.html.php index 6dfd7dda08..2a20424b23 100644 --- a/trunk/module/my/view/task.html.php +++ b/trunk/module/my/view/task.html.php @@ -36,7 +36,7 @@ task->consumed;?> task->story;?> task->status;?> - action;?> + actions;?> diff --git a/trunk/module/my/view/todo.html.php b/trunk/module/my/view/todo.html.php index 73b982bbbe..9731f73cb3 100644 --- a/trunk/module/my/view/todo.html.php +++ b/trunk/module/my/view/todo.html.php @@ -60,7 +60,7 @@ function changeDate(date) todo->begin;?> todo->end;?> todo->status;?> - action;?> + actions;?> diff --git a/trunk/module/product/view/browse.html.php b/trunk/module/product/view/browse.html.php index fe85bdd326..a70824c5ec 100644 --- a/trunk/module/product/view/browse.html.php +++ b/trunk/module/product/view/browse.html.php @@ -93,7 +93,7 @@ function search(active) story->closedBy);?> story->closedReason);?> story->lastEdited);?> - action;?> + actions;?> diff --git a/trunk/module/productplan/view/browse.html.php b/trunk/module/productplan/view/browse.html.php index 50744a31cf..240e8bb6df 100644 --- a/trunk/module/productplan/view/browse.html.php +++ b/trunk/module/productplan/view/browse.html.php @@ -36,7 +36,7 @@ productplan->title;?> productplan->begin;?> productplan->end;?> - action;?> + actions;?> diff --git a/trunk/module/productplan/view/linkstory.html.php b/trunk/module/productplan/view/linkstory.html.php index 30dedd3546..18b4738d85 100644 --- a/trunk/module/productplan/view/linkstory.html.php +++ b/trunk/module/productplan/view/linkstory.html.php @@ -65,7 +65,7 @@ story->pri;?> story->product;?> story->title;?> - action?> + actions?> diff --git a/trunk/module/productplan/view/view.html.php b/trunk/module/productplan/view/view.html.php index 53563e596e..d9ac9c8a02 100644 --- a/trunk/module/productplan/view/view.html.php +++ b/trunk/module/productplan/view/view.html.php @@ -56,7 +56,7 @@ story->pri;?> story->product;?> story->title;?> - action?> + actions?> diff --git a/trunk/module/project/view/browse.html.php b/trunk/module/project/view/browse.html.php index d02fba9ddc..d3be10a388 100644 --- a/trunk/module/project/view/browse.html.php +++ b/trunk/module/project/view/browse.html.php @@ -111,7 +111,7 @@ function selectProject(projectID) team->role;?> team->joinDate;?> team->workingHour;?> - $lang->action";?> + $lang->actions";?> diff --git a/trunk/module/project/view/build.html.php b/trunk/module/project/view/build.html.php index 0b19a732f2..82736ba90e 100644 --- a/trunk/module/project/view/build.html.php +++ b/trunk/module/project/view/build.html.php @@ -39,7 +39,7 @@ build->filePath;?> build->date;?> build->builder;?> - action;?> + actions;?> diff --git a/trunk/module/project/view/index.html.php b/trunk/module/project/view/index.html.php index 80f8efa9fc..1d10be7d4a 100644 --- a/trunk/module/project/view/index.html.php +++ b/trunk/module/project/view/index.html.php @@ -107,7 +107,7 @@ team->role;?> team->joinDate;?> team->workingHour;?> - $lang->action";?> + $lang->actions";?> diff --git a/trunk/module/project/view/story.html.php b/trunk/module/project/view/story.html.php index d71ba6f384..181efaf4f4 100644 --- a/trunk/module/project/view/story.html.php +++ b/trunk/module/project/view/story.html.php @@ -53,7 +53,7 @@ $(document).ready(function() story->openedBy);?> story->estimate);?> story->status);?> - action;?> + actions;?> diff --git a/trunk/module/project/view/task.html.php b/trunk/module/project/view/task.html.php index 9f665ae877..ba874057ea 100644 --- a/trunk/module/project/view/task.html.php +++ b/trunk/module/project/view/task.html.php @@ -50,7 +50,7 @@ task->type);?> task->status);?> task->story);?> - action;?> + actions;?> diff --git a/trunk/module/project/view/team.html.php b/trunk/module/project/view/team.html.php index 334452c917..22e619392b 100644 --- a/trunk/module/project/view/team.html.php +++ b/trunk/module/project/view/team.html.php @@ -33,7 +33,7 @@ team->role;?> team->joinDate;?> team->workingHour;?> - $lang->action";?> + $lang->actions";?> diff --git a/trunk/module/release/view/browse.html.php b/trunk/module/release/view/browse.html.php index 4505ac6d44..0b3aca43cf 100644 --- a/trunk/module/release/view/browse.html.php +++ b/trunk/module/release/view/browse.html.php @@ -38,7 +38,7 @@ release->name;?> release->build;?> release->date;?> - action;?> + actions;?> diff --git a/trunk/module/story/control.php b/trunk/module/story/control.php index 11754c834c..f8d0d8722d 100644 --- a/trunk/module/story/control.php +++ b/trunk/module/story/control.php @@ -129,7 +129,7 @@ class story extends control { $action = (!empty($changes) or !empty($files)) ? 'Changed' : 'Commented'; $fileAction = ''; - if(!empty($files)) $fileAction = "Add Files " . join(',', $files) . "\n" ; + if(!empty($files)) $fileAction = $this->lang->addFiles . join(',', $files) . "\n" ; $actionID = $this->action->create('story', $storyID, $action, $fileAction . $this->post->comment); $this->action->logHistory($actionID, $changes); } diff --git a/trunk/module/story/lang/zh-cn.php b/trunk/module/story/lang/zh-cn.php index af3233c71e..804976c37a 100644 --- a/trunk/module/story/lang/zh-cn.php +++ b/trunk/module/story/lang/zh-cn.php @@ -128,3 +128,6 @@ $lang->story->childStories = '细分需求'; $lang->story->duplicateStory = '重复需求'; $lang->story->reviewResult = '评审结果'; $lang->story->preVersion = '之前版本'; + +$lang->story->action->reviewed = array('main' => '$date, 由 $actor 评审,结果为 $extra。', 'extra' => $lang->story->reviewResultList); +$lang->story->action->closed = array('main' => '$date, 由 $actor 关闭,原因为 $extra。', 'extra' => $lang->story->reasonList); diff --git a/trunk/module/task/view/import.html.php b/trunk/module/task/view/import.html.php index 0e840aa8cf..4997de5aac 100644 --- a/trunk/module/task/view/import.html.php +++ b/trunk/module/task/view/import.html.php @@ -37,7 +37,7 @@ task->type;?> task->status;?> task->story;?> - action;?> + actions;?> diff --git a/trunk/module/testcase/view/create.html.php b/trunk/module/testcase/view/create.html.php index c04578ba5e..76ecef3040 100644 --- a/trunk/module/testcase/view/create.html.php +++ b/trunk/module/testcase/view/create.html.php @@ -50,7 +50,7 @@ testcase->stepID;?> testcase->stepDesc;?> testcase->stepExpect;?> - action;?> + actions;?> testcase->stepID;?> testcase->stepDesc;?> testcase->stepExpect;?> - action;?> + actions;?> steps as $stepID => $step) diff --git a/trunk/module/testtask/view/browse.html.php b/trunk/module/testtask/view/browse.html.php index 65e56a4b9f..ab0810cd3f 100644 --- a/trunk/module/testtask/view/browse.html.php +++ b/trunk/module/testtask/view/browse.html.php @@ -40,7 +40,7 @@ testtask->begin;?> testtask->end;?> testtask->status;?> - action;?> + actions;?> diff --git a/trunk/module/testtask/view/view.html.php b/trunk/module/testtask/view/view.html.php index 16df22aea7..fcace678ca 100644 --- a/trunk/module/testtask/view/view.html.php +++ b/trunk/module/testtask/view/view.html.php @@ -91,7 +91,7 @@ function checkall(checker) testtask->lastRun;?> testtask->lastResult;?> testtask->status;?> - action;?> + actions;?> diff --git a/trunk/module/user/view/task.html.php b/trunk/module/user/view/task.html.php index 6dfd7dda08..2a20424b23 100644 --- a/trunk/module/user/view/task.html.php +++ b/trunk/module/user/view/task.html.php @@ -36,7 +36,7 @@ task->consumed;?> task->story;?> task->status;?> - action;?> + actions;?>