[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-196-g3d58212
Thomas Sibley
trs at bestpractical.com
Tue Nov 16 14:13:19 EST 2010
The branch, 3.8-trunk has been updated
via 3d58212c5e4317ead98b3773c3d0aa45d87aa7cc (commit)
via 90f5d4e382653f59ef1c48e1359cef40ed9a9b10 (commit)
from 5f5935fc820252672f798fc285bff45d5068ca0f (commit)
Summary of changes:
share/html/Admin/Elements/EditQueueWatchers | 3 +-
share/html/Dashboards/Elements/SelectPrivacy | 22 ++++++++++++-------
share/html/Elements/MyReminders | 2 +-
share/html/Elements/QuickCreate | 2 +-
share/html/Elements/SelectOwner | 2 +-
share/html/Elements/ShowLink | 2 +-
share/html/Elements/ShowUserVerbose | 2 +-
share/html/Search/Elements/SearchPrivacy | 16 ++++++++++----
share/html/Search/Elements/SelectSearchObject | 6 +----
.../html/Search/Elements/SelectSearchesForObjects | 10 ++------
share/html/Ticket/Elements/Reminders | 2 +-
share/html/Ticket/Elements/ShowAttachments | 3 +-
share/html/Ticket/Elements/ShowDates | 6 ++--
share/html/Ticket/Elements/ShowDependencies | 5 ++-
share/html/Ticket/Update.html | 2 +-
t/web/attachment_encoding.t | 2 +-
16 files changed, 47 insertions(+), 40 deletions(-)
- Log -----------------------------------------------------------------
commit 90f5d4e382653f59ef1c48e1359cef40ed9a9b10
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 16 13:23:19 2010 -0500
Silence some uninit warnings
diff --git a/share/html/Elements/ShowUserVerbose b/share/html/Elements/ShowUserVerbose
index 7bba394..3f1e6c9 100644
--- a/share/html/Elements/ShowUserVerbose
+++ b/share/html/Elements/ShowUserVerbose
@@ -59,7 +59,7 @@ if ($User) {
$Address = Email::Address->new( $phrase, $address, $comment );
}
-$Address->comment('') if $comment && lc $Address->user eq lc $comment;
+$Address->comment('') if $comment and defined $Address->user and lc $Address->user eq lc $comment;
if ( $phrase and my ( $l, $r ) = ( $phrase =~ /^(\w+) (\w+)$/ ) ) {
$Address->phrase('')
if $Address->user =~ /^\Q$l\E.\Q$r\E$/
commit 3d58212c5e4317ead98b3773c3d0aa45d87aa7cc
Author: Thomas Sibley <trs at bestpractical.com>
Date: Tue Nov 16 14:11:17 2010 -0500
Use the ShowUser element more often for consistent user display
This fixes most of the places where we were outputting the user names
directly. It _doesn't_ fix the places in the ColumnMap code where we
use $User->Name, but that requires more thinking since ShowUser outputs
HTML. Surprisingly, this breaks only one test (which I've fixed).
diff --git a/share/html/Admin/Elements/EditQueueWatchers b/share/html/Admin/Elements/EditQueueWatchers
index 732f828..bbe6ece 100755
--- a/share/html/Admin/Elements/EditQueueWatchers
+++ b/share/html/Admin/Elements/EditQueueWatchers
@@ -56,12 +56,13 @@
unchecked />
% if ($watcher->MemberObj->IsUser) {
<a href="<%RT->Config->Get('WebPath')%>/Admin/Users/Modify.html?id=<%$watcher->MemberObj->ObjectId%>">
+<& /Elements/ShowUser, User => $watcher->MemberObj->Object &></a>
% } else {
<a href="<%RT->Config->Get('WebPath')%>/Admin/Groups/Modify.html?id=<%$watcher->MemberObj->ObjectId%>">
-% }
<%$watcher->MemberObj->Object->Name%></a>
% }
% }
+% }
</ul>
<i><&|/l&>(Check box to delete)</&></i><br /><br />
diff --git a/share/html/Dashboards/Elements/SelectPrivacy b/share/html/Dashboards/Elements/SelectPrivacy
index feff6c1..7af9413 100644
--- a/share/html/Dashboards/Elements/SelectPrivacy
+++ b/share/html/Dashboards/Elements/SelectPrivacy
@@ -51,14 +51,20 @@ $Name => undef
$Default => undef
</%args>
<select name="<%$Name%>">
-% foreach my $object (@Objects) {
-% my $privacy = ref($object) . '-' . $object->id;
-% my $selected = $privacy eq ($Default || '') ? 'selected="selected"' : '';
+<%perl>
+foreach my $object (@Objects) {
+ my $privacy = ref($object) . '-' . $object->id;
+ my $selected = $privacy eq ($Default || '') ? 'selected="selected"' : '';
-% if (ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id) {
-<option <%$selected|n%> value="<%$privacy%>"><&|/l&>My dashboards</&></option>
-% } else {
-<option <%$selected|n%> value="<%$privacy%>"><&|/l, $object->Name&>[_1]'s dashboards</&></option>
-% }
+ my $label;
+ if (ref($object) eq 'RT::User') {
+ $label = $object->id == $session{'CurrentUser'}->Id
+ ? loc("My dashboards")
+ : loc("[_1]'s dashboards", $m->scomp('/Elements/ShowUser', User => $object));
+ } else {
+ $label = loc("[_1]'s dashboards", $m->interp->apply_escapes($object->Name, 'h'));
+ }
+</%perl>
+<option <%$selected|n%> value="<%$privacy%>"><% $label |n %></option>
% }
</select>
diff --git a/share/html/Elements/MyReminders b/share/html/Elements/MyReminders
index fc2bcf9..24a2a96 100755
--- a/share/html/Elements/MyReminders
+++ b/share/html/Elements/MyReminders
@@ -59,7 +59,7 @@
<tr class="<%$i%2 ? 'evenline' : 'oddline'%>"><td><a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$ticket->id%>"><%$reminder->Subject%></a><br />
<blockquote>
#<%$ticket->id%>: <%$ticket->Subject%><br />
-<%$reminder->OwnerObj->Name %> <%$reminder->DueObj->Unix >0 ? '• '.$reminder->DueObj->AgeAsString : '' |n %>
+<& /Elements/ShowUser, User => $reminder->OwnerObj &> <%$reminder->DueObj->Unix >0 ? '• '.$reminder->DueObj->AgeAsString : '' |n %>
</blockquote>
</td>
</tr>
diff --git a/share/html/Elements/QuickCreate b/share/html/Elements/QuickCreate
index 551c9b0..2620651 100644
--- a/share/html/Elements/QuickCreate
+++ b/share/html/Elements/QuickCreate
@@ -57,7 +57,7 @@
</td>
<td class="label"><&|/l&>Owner</&>:</td><td class="value">
<select type="select" name="Owner">
-<option value="<%$session{'CurrentUser'}->id%>" selected="selected"><%$session{'CurrentUser'}->Name %></option>
+<option value="<%$session{'CurrentUser'}->id%>" selected="selected"><&|/l&>Me</&></option>
<option value="<%$RT::Nobody->id%>"><%loc('Nobody')%></option>
</select>
</td>
diff --git a/share/html/Elements/SelectOwner b/share/html/Elements/SelectOwner
index ee1d981..25b63e2 100755
--- a/share/html/Elements/SelectOwner
+++ b/share/html/Elements/SelectOwner
@@ -47,7 +47,7 @@
%# END BPS TAGGED BLOCK }}}
<select name="<%$Name%>" id="<%$Name%>">
%if ($DefaultValue) {
-<option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel%></option>
+<option value=""<% !$Default ? qq[ selected="selected"] : '' |n %>><%$DefaultLabel |n%></option>
%}
% $Default = 0 unless defined $Default && $Default =~ /^\d+$/;
% my @formatednames = sort {lc $a->[1] cmp lc $b->[1]} map {[$_, $m->scomp('/Elements/ShowUser', User => $_)]} grep { $_->id != $RT::Nobody->id } @users;
diff --git a/share/html/Elements/ShowLink b/share/html/Elements/ShowLink
index 6401da4..a4e5fe5 100644
--- a/share/html/Elements/ShowLink
+++ b/share/html/Elements/ShowLink
@@ -52,7 +52,7 @@
% my $inactive = $member->QueueObj->IsInactiveStatus($member->Status);
<span class="<% $inactive ? 'ticket-inactive' : '' %>">
-<%$member->Id%>: (<%$member->OwnerObj->Name%>) <%$member->Subject%> [<% loc($member->Status) %>]
+<%$member->Id%>: (<& /Elements/ShowUser, User => $member->OwnerObj &>) <%$member->Subject%> [<% loc($member->Status) %>]
</span>
% } elsif ( UNIVERSAL::can($member, 'Name')) {
diff --git a/share/html/Search/Elements/SearchPrivacy b/share/html/Search/Elements/SearchPrivacy
index 5ac631f..1d9033b 100644
--- a/share/html/Search/Elements/SearchPrivacy
+++ b/share/html/Search/Elements/SearchPrivacy
@@ -48,8 +48,14 @@
<%args>
$Object => undef
</%args>
-% if (ref($Object) eq 'RT::User' && $Object->id == $session{'CurrentUser'}->Id) {
-<&|/l&>My saved searches</&>
-% } else {
-<&|/l, $Object->Name&>[_1]'s saved searches</&>
-% }
+<%init>
+my $label;
+if (ref($Object) eq 'RT::User') {
+ $label = $Object->id == $session{'CurrentUser'}->Id
+ ? loc("My saved searches")
+ : loc("[_1]'s saved searches", $m->scomp('/Elements/ShowUser', User => $Object));
+} else {
+ $label = loc("[_1]'s saved searches", $m->interp->apply_escapes($Object->Name, 'h'));
+}
+</%init>
+<% $label |n %>\
diff --git a/share/html/Search/Elements/SelectSearchObject b/share/html/Search/Elements/SelectSearchObject
index 5028ddd..955360b 100644
--- a/share/html/Search/Elements/SelectSearchObject
+++ b/share/html/Search/Elements/SelectSearchObject
@@ -59,10 +59,6 @@ if ( $Object && $Object->Id ) {
<select id="<%$Name%>" name="<%$Name%>">
% foreach my $object (@Objects) {
% my $privacy = ref($object).'-'.$object->id;
-% if (ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id) {
-<option value="<%$privacy%>" <% ( $privacy eq $default_privacy ) ? "selected='selected'" : '' |n %> ><&|/l&>My saved searches</&></option>
-% } else {
-<option value="<%$privacy%>" <% ( $privacy eq $default_privacy ) ? "selected='selected'" : '' |n %> ><&|/l, $object->Name&>[_1]'s saved searches</&></option>
-% }
+<option value="<%$privacy%>" <% ( $privacy eq $default_privacy ) ? "selected='selected'" : '' |n %>><& SearchPrivacy, Object => $object &></option>
% }
</select>
diff --git a/share/html/Search/Elements/SelectSearchesForObjects b/share/html/Search/Elements/SelectSearchesForObjects
index dd30bcb..1366d5d 100644
--- a/share/html/Search/Elements/SelectSearchesForObjects
+++ b/share/html/Search/Elements/SelectSearchesForObjects
@@ -52,18 +52,14 @@ $SearchType => 'Ticket',
</%args>
<select id="<%$Name%>" name="<%$Name%>">
% foreach my $object (@Objects) {
-% if (ref($object) eq 'RT::User' && $object->id == $session{'CurrentUser'}->Id) {
-<option value=""><&|/l&>My saved searches</&></option>
-% } else {
-<option value=""></option>
-<option value=""><&|/l, $object->Name&>[_1]'s saved searches</&></option>
-% }
+<optgroup label="<& SearchPrivacy, Object => $object &>">
% my @searches = $object->Attributes->Named('SavedSearch');
% foreach my $search (@searches) {
% # Skip it if it is not of search type we want.
% next if ($search->SubValue('SearchType')
% && $search->SubValue('SearchType') ne $SearchType);
-<option value="<%ref($object)%>-<%$object->id%>-SavedSearch-<%$search->Id%>"> -<%$search->Description||loc('Unnamed search')%></option>
+<option value="<%ref($object)%>-<%$object->id%>-SavedSearch-<%$search->Id%>"><%$search->Description||loc('Unnamed search')%></option>
% }
+</optgroup>
% }
</select>
diff --git a/share/html/Ticket/Elements/Reminders b/share/html/Ticket/Elements/Reminders
index 25a69db..52a55ff 100644
--- a/share/html/Ticket/Elements/Reminders
+++ b/share/html/Ticket/Elements/Reminders
@@ -174,6 +174,6 @@ $Ticket
<% $Reminder->Status eq 'resolved' ? 'checked="checked"' : '' %>
/>
<%$Reminder->Subject%> •
- <%$Reminder->OwnerObj->Name%>
+ <& /Elements/ShowUser, User => $Reminder->OwnerObj &>
<%$Reminder->DueObj->Unix>0 ? "• ". $Reminder->DueObj->AgeAsString : '' |n%><br />
</%method>
diff --git a/share/html/Ticket/Elements/ShowAttachments b/share/html/Ticket/Elements/ShowAttachments
index 1f476be..0f52ce7 100755
--- a/share/html/Ticket/Elements/ShowAttachments
+++ b/share/html/Ticket/Elements/ShowAttachments
@@ -83,7 +83,8 @@ if ($size) {
<li><font size="-2">
<a href="<%RT->Config->Get('WebPath')%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | u%>">
-<&|/l, $rev->CreatedAsString, $size, $rev->CreatorObj->Name &>[_1] ([_2]) by [_3]</&>
+% my $desc = loc("[_1] ([_2]) by [_3]", $rev->CreatedAsString, $size, $m->scomp('/Elements/ShowUser', User => $rev->CreatorObj));
+<% $desc |n%>
</a>
</font></li>
% }
diff --git a/share/html/Ticket/Elements/ShowDates b/share/html/Ticket/Elements/ShowDates
index 3946ed1..7595341 100755
--- a/share/html/Ticket/Elements/ShowDates
+++ b/share/html/Ticket/Elements/ShowDates
@@ -77,11 +77,11 @@
</tr>
<tr>
<td class="label date updated"><&|/l&>Updated</&>:</td>
-% my $UpdatedString = $Ticket->LastUpdated ? loc("[_1] by [_2]", $Ticket->LastUpdatedAsString, $Ticket->LastUpdatedByObj->Name) : loc("Never");
+% my $UpdatedString = $Ticket->LastUpdated ? loc("[_1] by [_2]", $Ticket->LastUpdatedAsString, $m->scomp('/Elements/ShowUser', User => $Ticket->LastUpdatedByObj)) : loc("Never");
% if ($UpdatedLink) {
- <td class="value date updated"><a href="#lasttrans"><% $UpdatedString | h %></a></td>
+ <td class="value date updated"><a href="#lasttrans"><% $UpdatedString |n%></a></td>
% } else {
- <td class="value date updated"><% $UpdatedString | h %></td>
+ <td class="value date updated"><% $UpdatedString |n%></td>
% }
</tr>
% $m->callback( %ARGS, CallbackName => 'EndOfList', TicketObj => $Ticket );
diff --git a/share/html/Ticket/Elements/ShowDependencies b/share/html/Ticket/Elements/ShowDependencies
index 87913f4..1f6f6fd 100755
--- a/share/html/Ticket/Elements/ShowDependencies
+++ b/share/html/Ticket/Elements/ShowDependencies
@@ -48,14 +48,15 @@
<&|/l&>Depends on</&>:<br />
% while (my $Link = $Ticket->DependsOn->Next) {
% my $member = $Link->TargetObj;
-<a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+<a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<& /Elements/ShowUser, User => $member->OwnerObj &>) <%$member->Subject%>
+
[<%$member->Status%>]
<br />
% }
<&|/l&>Depended on by</&>:<br />
% while (my $Link = $Ticket->DependedOnBy->Next) {
% my $member = $Link->TargetObj;
-<a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<%$member->OwnerObj->Name%>) <%$member->Subject%>
+<a href="<%RT->Config->Get('WebPath')%>/Ticket/Display.html?id=<%$member->Id%>"><%$member->Id%></a>: (<& /Elements/ShowUser, User => $member->OwnerObj &>) <%$member->Subject%>
[<%$member->Status%>]
<br />
% }
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index beca4c1..c669c48 100755
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -73,7 +73,7 @@
Name => "Owner",
TicketObj => $TicketObj,
QueueObj => $TicketObj->QueueObj,
- DefaultLabel => loc("[_1] (Unchanged)", $TicketObj->OwnerObj->Name),
+ DefaultLabel => loc("[_1] (Unchanged)", $m->scomp('/Elements/ShowUser', User => $TicketObj->OwnerObj)),
Default => $ARGS{'Owner'}
&>
<span class="label"><&|/l&>Worked</&>:</span>
diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index ce83509..6796c99 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -82,7 +82,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
$m->back;
$m->back;
- $m->follow_link_ok( { text_regex => qr/by root/ },
+ $m->follow_link_ok( { text_regex => qr/by Enoch Root/ },
'-> /Ticket/Attachment/...' );
$m->content_contains( 'é件', 'has content é件' );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list