* adjust the UI, aligen the field name left.
This commit is contained in:
@@ -31,3 +31,4 @@ $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>';
|
||||
$lang->action->label->space = ' ';
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user