diff --git a/trunk/module/action/lang/zh-cn.php b/trunk/module/action/lang/zh-cn.php index 866af20b67..33305b314d 100644 --- a/trunk/module/action/lang/zh-cn.php +++ b/trunk/module/action/lang/zh-cn.php @@ -31,3 +31,4 @@ $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
'; +$lang->action->label->space = ' '; diff --git a/trunk/module/action/model.php b/trunk/module/action/model.php index 81b70cba26..a466d5af37 100644 --- a/trunk/module/action/model.php +++ b/trunk/module/action/model.php @@ -136,17 +136,23 @@ class actionModel extends model /* 打印修改记录。*/ public function printChanges($objectType, $histories) { + $maxLength = 0; foreach($histories as $history) { $fieldName = $history->field; - $fieldLabel = isset($this->lang->$objectType->$fieldName) ? $this->lang->$objectType->$fieldName : $fieldName; + $history->fieldLabel = isset($this->lang->$objectType->$fieldName) ? $this->lang->$objectType->$fieldName : $fieldName; + if(($length = strlen($history->fieldLabel)) > $maxLength) $maxLength = $length; + } + foreach($histories as $history) + { + $history->fieldLabel = str_pad($history->fieldLabel, $maxLength, $this->lang->action->label->space); if($history->diff != '') { - printf($this->lang->action->label->diff2, $fieldLabel, nl2br($history->diff)); + printf($this->lang->action->label->diff2, $history->fieldLabel, nl2br($history->diff)); } else { - printf($this->lang->action->label->diff1, $fieldLabel, $history->old, $history->new); + printf($this->lang->action->label->diff1, $history->fieldLabel, $history->old, $history->new); } } }