* adjust the UI of action logs.

This commit is contained in:
wangchunsheng
2010-02-09 07:48:21 +00:00
parent 5a619e0d8e
commit c9a7361259
33 changed files with 130 additions and 47 deletions

View File

@@ -0,0 +1,33 @@
<?php
/**
* The action module zh-cn file of ZenTaoMS.
*
* ZenTaoMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ZenTaoMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
*
* @copyright Copyright: 2009 Chunsheng Wang
* @author Chunsheng Wang <wwccss@263.net>
* @package bug
* @version $Id$
* @link http://www.zentao.cn
*/
$lang->action->label->common = '$date, <strong>$action</strong> by <strong>$actor</strong>';
$lang->action->label->extra = '$date, <strong>$action</strong> as <strong>$extra</strong> by <strong>$actor</strong>';
$lang->action->label->opened = '$date, 由 <strong>$actor</strong> 创建。';
$lang->action->label->changed = '$date, 由 <strong>$actor</strong> 变更。';
$lang->action->label->edited = '$date, 由 <strong>$actor</strong> 编辑。';
$lang->action->label->closed = '$date, 由 <strong>$actor</strong> 关闭。';
$lang->action->label->commented = '$date, 由 <strong>$actor</strong> 发表评论。';
$lang->action->label->activated = '$date, 由 <strong>$actor</strong> 激活。';
$lang->action->label->diff1 = '修改了 <strong><i>%s</i></strong>,旧值为 "%s",新值为 "%s"。<br />';
$lang->action->label->diff2 = '修改了 <strong><i>%s</i></strong>,区别为<blockquote>%s</blockquote>';

View File

@@ -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);
}
}
}
}

View File

@@ -36,7 +36,7 @@
<th><?php echo $lang->company->backyard;?></th>
<th><?php echo $lang->company->pms;?></th>
<th><?php echo $lang->company->guest;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
<?php foreach($companies as $company):?>
<tr>

View File

@@ -36,7 +36,7 @@
<th><?php echo $lang->group->name;?></th>
<th><?php echo $lang->group->desc;?></th>
<th><?php echo $lang->group->users;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
<?php foreach($groups as $group):?>
<tr>

View File

@@ -42,7 +42,7 @@
<th><?php echo $lang->user->phone;?></th>
<th><?php echo $lang->user->join;?></th>
<th><?php echo $lang->user->visits;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -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);

View File

@@ -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, 由 <strong>$actor</strong> 解决,方案为 <strong>$extra</strong>。', 'extra' => $lang->bug->resolutionList);

View File

@@ -2,33 +2,18 @@
<fieldset>
<legend onclick='$("#historyItem li").reverseOrder();' class='hand'><?php echo $lang->history . $lang->reverse;?></legend>
<ol id='historyItem'>
<?php $i = 1;?>
<?php $i = 1; ?>
<?php foreach($actions as $action):?>
<li value='<?php echo $i ++;?>'>
<?php
if(isset($users[$action->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";
?>
<span><?php echo "$action->date, <strong>$action->action</strong> by <strong>$action->actor</strong>"; ?></span>
<span><?php $this->action->printAction($action);?>
<?php if(!empty($action->comment) or !empty($action->history)):?>
<div class='history'>
<?php
foreach($action->history as $history)
{
if($history->diff != '')
{
echo "CHANGE <strong>$history->field</strong>, the diff is: <blockquote>" . nl2br($history->diff) . "</blockquote>";
}
else
{
echo "CHANGE <strong>$history->field</strong> FROM '$history->old' TO '$history->new' . <br />";
}
}
echo nl2br($action->comment);
?>
<div id='changes'><?php echo $this->action->printChanges($action->objectType, $action->history);?></div>
<?php if($action->comment and $action->history) echo '<br />'; echo nl2br($action->comment);?>
</div>
<?php endif;?>
</li>

View File

@@ -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';

View File

@@ -56,7 +56,7 @@ include '../../common/tablesorter.html.php';
<th><?php echo $lang->user->join;?></th>
<th><?php echo $lang->user->visits;?></th>
<th><?php echo $lang->user->status;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -30,7 +30,7 @@
<th><?php echo $lang->group->name;?></th>
<th><?php echo $lang->group->desc;?></th>
<th class='w-p60'><?php echo $lang->group->users;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
<?php foreach($groups as $group):?>
<tr class='a-center'>

View File

@@ -38,7 +38,7 @@
<th><?php echo $lang->story->estimate;?></th>
<th><?php echo $lang->story->status;?></th>
<th class='w-100px'><?php echo $lang->story->lastEditedDate;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -36,7 +36,7 @@
<th><?php echo $lang->task->consumed;?></th>
<th class='w-p30'><?php echo $lang->task->story;?></th>
<th><?php echo $lang->task->status;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -60,7 +60,7 @@ function changeDate(date)
<th><?php echo $lang->todo->begin;?></th>
<th><?php echo $lang->todo->end;?></th>
<th><?php echo $lang->todo->status;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>

View File

@@ -93,7 +93,7 @@ function search(active)
<th><?php common::printOrderLink('closedBy', $orderBy, $vars, $lang->story->closedBy);?></th>
<th><?php common::printOrderLink('closedReason', $orderBy, $vars, $lang->story->closedReason);?></th>
<th class='w-100px'><?php common::printOrderLink('lastEditedDate', $orderBy, $vars, $lang->story->lastEdited);?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -36,7 +36,7 @@
<th class='w-p20'><?php echo $lang->productplan->title;?></th>
<th><?php echo $lang->productplan->begin;?></th>
<th><?php echo $lang->productplan->end;?></th>
<th class='w-p20'><?php echo $lang->action;?></th>
<th class='w-p20'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -65,7 +65,7 @@
<th class='w-p5'><?php echo $lang->story->pri;?></th>
<th class='w-p10'><?php echo $lang->story->product;?></th>
<th><?php echo $lang->story->title;?></th>
<th class='w-p10'><?php echo $lang->action?></th>
<th class='w-p10'><?php echo $lang->actions?></th>
</tr>
</thead>
<tbody>

View File

@@ -56,7 +56,7 @@
<th class='w-p5'><?php echo $lang->story->pri;?></th>
<th class='w-p10'><?php echo $lang->story->product;?></th>
<th><?php echo $lang->story->title;?></th>
<th class='w-p10'><?php echo $lang->action?></th>
<th class='w-p10'><?php echo $lang->actions?></th>
</tr>
</thead>
<tbody>

View File

@@ -111,7 +111,7 @@ function selectProject(projectID)
<th><?php echo $lang->team->role;?></th>
<th><?php echo $lang->team->joinDate;?></th>
<th><?php echo $lang->team->workingHour;?></th>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->action</th>";?>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->actions</th>";?>
</tr>
</thead>
<tbody>

View File

@@ -39,7 +39,7 @@
<th class='w-p20'><?php echo $lang->build->filePath;?></th>
<th><?php echo $lang->build->date;?></th>
<th><?php echo $lang->build->builder;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -107,7 +107,7 @@
<th><?php echo $lang->team->role;?></th>
<th><?php echo $lang->team->joinDate;?></th>
<th><?php echo $lang->team->workingHour;?></th>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->action</th>";?>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->actions</th>";?>
</tr>
</thead>
<tbody>

View File

@@ -53,7 +53,7 @@ $(document).ready(function()
<th><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->story->openedBy);?></th>
<th><?php common::printOrderLink('estimate', $orderBy, $vars, $lang->story->estimate);?></th>
<th><?php common::printOrderLink('status', $orderBy, $vars, $lang->story->status);?></th>
<th class='w-150px'><?php echo $lang->action;?></th>
<th class='w-150px'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -50,7 +50,7 @@
<th><?php common::printOrderLink('type', $orderBy, $vars, $lang->task->type);?></th>
<th><?php common::printOrderLink('status', $orderBy, $vars, $lang->task->status);?></th>
<th class='w-p30'><?php common::printOrderLink('story', $orderBy, $vars, $lang->task->story);?></th>
<th class='w-100px'><?php echo $lang->action;?></th>
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -33,7 +33,7 @@
<th><?php echo $lang->team->role;?></th>
<th><?php echo $lang->team->joinDate;?></th>
<th><?php echo $lang->team->workingHour;?></th>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->action</th>";?>
<?php if(common::hasPriv('project', 'unlinkmember')) echo "<th>$lang->actions</th>";?>
</tr>
</thead>
<tbody>

View File

@@ -38,7 +38,7 @@
<th><?php echo $lang->release->name;?></th>
<th><?php echo $lang->release->build;?></th>
<th><?php echo $lang->release->date;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -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);
}

View File

@@ -128,3 +128,6 @@ $lang->story->childStories = '细分需求';
$lang->story->duplicateStory = '重复需求';
$lang->story->reviewResult = '评审结果';
$lang->story->preVersion = '之前版本';
$lang->story->action->reviewed = array('main' => '$date, 由 <strong>$actor</strong> 评审,结果为 <strong>$extra</strong>。', 'extra' => $lang->story->reviewResultList);
$lang->story->action->closed = array('main' => '$date, 由 <strong>$actor</strong> 关闭,原因为 <strong>$extra</strong>。', 'extra' => $lang->story->reasonList);

View File

@@ -37,7 +37,7 @@
<th><?php echo $lang->task->type;?></th>
<th><?php echo $lang->task->status;?></th>
<th class='w-p30'><?php echo $lang->task->story;?></th>
<th class='w-100px'><?php echo $lang->action;?></th>
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -50,7 +50,7 @@
<th class='w-30px'><?php echo $lang->testcase->stepID;?></th>
<th><?php echo $lang->testcase->stepDesc;?></th>
<th><?php echo $lang->testcase->stepExpect;?></th>
<th class='w-100px'><?php echo $lang->action;?></th>
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
<?php
for($i = 1; $i <= 5; $i ++)

View File

@@ -46,7 +46,7 @@
<th class='w-30px'><?php echo $lang->testcase->stepID;?></th>
<th><?php echo $lang->testcase->stepDesc;?></th>
<th><?php echo $lang->testcase->stepExpect;?></th>
<th class='w-100px'><?php echo $lang->action;?></th>
<th class='w-100px'><?php echo $lang->actions;?></th>
</tr>
<?php
foreach($case->steps as $stepID => $step)

View File

@@ -40,7 +40,7 @@
<th><?php echo $lang->testtask->begin;?></th>
<th><?php echo $lang->testtask->end;?></th>
<th><?php echo $lang->testtask->status;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -91,7 +91,7 @@ function checkall(checker)
<th><?php echo $lang->testtask->lastRun;?></th>
<th><?php echo $lang->testtask->lastResult;?></th>
<th><?php echo $lang->testtask->status;?></th>
<th class='{sorter: false}'><?php echo $lang->action;?></th>
<th class='{sorter: false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>

View File

@@ -36,7 +36,7 @@
<th><?php echo $lang->task->consumed;?></th>
<th class='w-p30'><?php echo $lang->task->story;?></th>
<th><?php echo $lang->task->status;?></th>
<th><?php echo $lang->action;?></th>
<th><?php echo $lang->actions;?></th>
</tr>
</thead>
<tbody>