[Rt-commit] rt branch, 3.9-moreaboutrequestor, created. rt-3.8.8-333-g764de56
Kevin Falcone
falcone at bestpractical.com
Tue Aug 17 15:28:10 EDT 2010
The branch, 3.9-moreaboutrequestor has been created
at 764de566b3d36f85a591c8e8f54fd86829117a6d (commit)
- Log -----------------------------------------------------------------
commit bd77538c86ded47bd82a798656fdb26982e04ede
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Aug 12 12:10:59 2010 -0400
Break out requestor ticket display into a component
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index 4952912..f45ffc7 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -46,13 +46,6 @@
%#
%# END BPS TAGGED BLOCK }}}
<%PERL>
-# Unsure sane default
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
-}
-my $rows = 10;
my $has_right_adminusers = $session{'CurrentUser'}->HasRight(
Object => $RT::System, Right => 'AdminUsers'
);
@@ -64,10 +57,6 @@ while ( my $requestor = $people->Next ) {
next if $requestor->Privileged;
my $name = $m->scomp('/Elements/ShowUser', User => $requestor);
- my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
- $tickets->FromSQL( "Requestor.id = ". $requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
- $tickets->RowsPerPage( $rows );
- $tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
</%PERL>
<&| /Widgets/TitleBox,
@@ -82,14 +71,7 @@ while ( my $requestor = $people->Next ) {
<span class="label"><&|/l&>Comments about this user</&>:</span><br />
<b class="value"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
-<span class="label"><&|/l, $rows &>This user's [_1] highest priority tickets</&>:</span>
-<ul>
-%while (my $w=$tickets->Next) {
-%my $uri = RT::URI->new( $session{'CurrentUser'} );
-%$uri->FromObject($w);
-<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
-%}
-</ul>
+<& ShowRequestorTickets, Requestor => $requestor, Ticket => $Ticket, conditions => $conditions &>
<&|/l&>Groups this user belongs to</&>:<br />
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestorTickets
old mode 100755
new mode 100644
similarity index 62%
copy from share/html/Ticket/Elements/ShowRequestor
copy to share/html/Ticket/Elements/ShowRequestorTickets
index 4952912..daddfb0
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -45,44 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<%PERL>
-# Unsure sane default
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
-}
-my $rows = 10;
-my $has_right_adminusers = $session{'CurrentUser'}->HasRight(
- Object => $RT::System, Right => 'AdminUsers'
-);
-$has_right_adminusers &&= $session{'CurrentUser'}->HasRight(
- Object => $RT::System, Right => 'ShowConfigTab'
-);
-my $people = $Ticket->Requestors->UserMembersObj;
-while ( my $requestor = $people->Next ) {
- next if $requestor->Privileged;
- my $name = $m->scomp('/Elements/ShowUser', User => $requestor);
-
- my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
- $tickets->FromSQL( "Requestor.id = ". $requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
- $tickets->RowsPerPage( $rows );
- $tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
-</%PERL>
-
-<&| /Widgets/TitleBox,
- title_href => $has_right_adminusers? RT->Config->Get('WebPath')."/Admin/Users/Modify.html?id=".$requestor->id: undef,
- title_raw => loc("More about [_1]", $name),
- class => 'ticket-info-requestor'
-&>
-
-%# Additional information about this user. Empty by default.
-% $m->callback( requestor => $requestor, %ARGS, CallbackName => 'AboutThisUser' );
-
-<span class="label"><&|/l&>Comments about this user</&>:</span><br />
-<b class="value"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
-
-<span class="label"><&|/l, $rows &>This user's [_1] highest priority tickets</&>:</span>
+<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
<ul>
%while (my $w=$tickets->Next) {
%my $uri = RT::URI->new( $session{'CurrentUser'} );
@@ -90,15 +53,22 @@ while ( my $requestor = $people->Next ) {
<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
%}
</ul>
+<%INIT>
+# Unsure sane default
+unless ( @$conditions ) {
+ foreach (RT::Queue->ActiveStatusArray()) {
+ push @$conditions, { cond => "Status = '$_'", name => loc($_) };
+ }
+}
-<&|/l&>Groups this user belongs to</&>:<br />
-
-<& /Elements/ShowMemberships, UserObj => $requestor &>
-
-</&>
-
-% }
+my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
+$tickets->FromSQL( "Requestor.id = ". $Requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
+$tickets->RowsPerPage( $Rows );
+$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
+</%INIT>
<%ARGS>
-$Ticket=>undef
+$Ticket => undef
+$Requestor => undef
$conditions => []
+$Rows => 10
</%ARGS>
commit 6b3f56e5c69a4a05ddd2be254c02444804f4ec78
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Aug 12 17:22:49 2010 -0400
Add some css so if you restyle this widget you can hide things
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index f45ffc7..bf96d0e 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -68,14 +68,16 @@ while ( my $requestor = $people->Next ) {
%# Additional information about this user. Empty by default.
% $m->callback( requestor => $requestor, %ARGS, CallbackName => 'AboutThisUser' );
-<span class="label"><&|/l&>Comments about this user</&>:</span><br />
-<b class="value"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
+<span class="label commentsaboutuser"><&|/l&>Comments about this user</&>:</span><br />
+<b class="value commentsaboutuser"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
<& ShowRequestorTickets, Requestor => $requestor, Ticket => $Ticket, conditions => $conditions &>
+<span class="moreaboutusergroups">
<&|/l&>Groups this user belongs to</&>:<br />
<& /Elements/ShowMemberships, UserObj => $requestor &>
+</span>
</&>
commit 78d4b4cec1932ad93337bb0ec988643d5a387d3a
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Aug 12 17:23:43 2010 -0400
Add ShowMoreAboutPrivilegedUsers config option
This lets you turn the More about requestor box on and off for
privileged users without overriding an entire element
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index d67fd4c..c1c01b4 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -862,6 +862,15 @@ EmailAddress.
Set($UsernameFormat, 'concise');
+=item C<$ShowMoreAboutPrivilegedUsers>
+
+This determines if the 'More about Requestor' box on Ticket/Display.html is
+shown for Privileged Users.
+
+=cut
+
+Set($ShowMoreAboutPrivilegedUsers, 0);
+
=item C<$WebDomain>
Domain name of the RT server, eg 'www.example.com'. It should not contain
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index bf96d0e..d921284 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -54,7 +54,7 @@ $has_right_adminusers &&= $session{'CurrentUser'}->HasRight(
);
my $people = $Ticket->Requestors->UserMembersObj;
while ( my $requestor = $people->Next ) {
- next if $requestor->Privileged;
+ next if !$show_privileged && $requestor->Privileged;
my $name = $m->scomp('/Elements/ShowUser', User => $requestor);
</%PERL>
@@ -82,6 +82,9 @@ while ( my $requestor = $people->Next ) {
</&>
% }
+<%INIT>
+my $show_privileged = RT->Config->Get('ShowMoreAboutPrivilegedUsers');
+</%INIT>
<%ARGS>
$Ticket=>undef
$conditions => []
commit c432991c3b8d9e2f0f2ec756af68bb2d5975f52b
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Thu Aug 12 17:24:23 2010 -0400
Refactor this into INIT
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index d921284..4884255 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -46,12 +46,6 @@
%#
%# END BPS TAGGED BLOCK }}}
<%PERL>
-my $has_right_adminusers = $session{'CurrentUser'}->HasRight(
- Object => $RT::System, Right => 'AdminUsers'
-);
-$has_right_adminusers &&= $session{'CurrentUser'}->HasRight(
- Object => $RT::System, Right => 'ShowConfigTab'
-);
my $people = $Ticket->Requestors->UserMembersObj;
while ( my $requestor = $people->Next ) {
next if !$show_privileged && $requestor->Privileged;
@@ -83,6 +77,13 @@ while ( my $requestor = $people->Next ) {
% }
<%INIT>
+my $has_right_adminusers = $session{'CurrentUser'}->HasRight(
+ Object => $RT::System, Right => 'AdminUsers'
+);
+$has_right_adminusers &&= $session{'CurrentUser'}->HasRight(
+ Object => $RT::System, Right => 'ShowConfigTab'
+);
+
my $show_privileged = RT->Config->Get('ShowMoreAboutPrivilegedUsers');
</%INIT>
<%ARGS>
commit 3c06ae8a814b5ba3b4c75d5587ea7b5d84a39fc4
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Aug 13 11:27:12 2010 -0400
Add new MoreAboutRequestorTicketList config var
Used to change which ticket list shows up in the More about requestor box
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index c1c01b4..44a0722 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -871,6 +871,16 @@ shown for Privileged Users.
Set($ShowMoreAboutPrivilegedUsers, 0);
+=item C<$MoreAboutRequestorTicketList>
+
+This can be set to Active, Inactive, All or None. It controls what ticket
+list will be displayed in the More about requestor box on Ticket/Display.html.
+This option can be controlled by users also.
+
+=cut
+
+Set($MoreAboutRequestorTicketList, 'Active');
+
=item C<$WebDomain>
Domain name of the RT server, eg 'www.example.com'. It should not contain
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 84f3b9c..4ced859 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -368,6 +368,22 @@ our %META = (
Hints => 'Use css rules to display text monospaced and with formatting preserved, but wrap as needed. This does not work well with IE6 and you should use the previous option', #loc
},
},
+ MoreAboutRequestorTicketList => {
+ Section => 'Ticket display', #loc
+ Overridable => 1,
+ SortOrder => 6,
+ Widget => '/Widgets/Form/Select',
+ WidgetArguments => {
+ Description => q|What tickets to display in the 'More about requestor' box|, #loc
+ Values => [qw(Active Inactive All None)],
+ ValuesLabel => {
+ Active => "Show the Requestor's 10 highest priority open tickets", #loc
+ Inactive => "Show the Requestor's 10 highest priority closed tickets", #loc
+ All => "Show the Requestor's 10 highest priority tickets", #loc
+ None => "Show no tickets for the Requestor", #loc
+ },
+ },
+ },
# User overridable locale options
DateTimeFormat => {
commit 9ab67c629b7dee9a7a1c13ba4a50169a9ea8eb28
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Aug 13 11:39:07 2010 -0400
Dispatch through a ShowRequestorTickets$Type template
This lets us easily provide a preference for users
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index 4884255..05a7e36 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -65,7 +65,7 @@ while ( my $requestor = $people->Next ) {
<span class="label commentsaboutuser"><&|/l&>Comments about this user</&>:</span><br />
<b class="value commentsaboutuser"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
-<& ShowRequestorTickets, Requestor => $requestor, Ticket => $Ticket, conditions => $conditions &>
+<& $TicketTemplate, Requestor => $requestor &>
<span class="moreaboutusergroups">
<&|/l&>Groups this user belongs to</&>:<br />
@@ -85,8 +85,11 @@ $has_right_adminusers &&= $session{'CurrentUser'}->HasRight(
);
my $show_privileged = RT->Config->Get('ShowMoreAboutPrivilegedUsers');
+
+$TicketTemplate ||= "ShowRequestorTickets".(RT->Config->Get('MoreAboutRequestorTicketList', $session{CurrentUser})||'Active');
+$TicketTemplate = "ShowRequestorTicketsActive" unless $m->comp_exists($TicketTemplate);
</%INIT>
<%ARGS>
$Ticket=>undef
-$conditions => []
+$TicketTemplate=>undef
</%ARGS>
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTickets
index daddfb0..5fff558 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -45,7 +45,6 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
<ul>
%while (my $w=$tickets->Next) {
%my $uri = RT::URI->new( $session{'CurrentUser'} );
@@ -54,21 +53,18 @@
%}
</ul>
<%INIT>
-# Unsure sane default
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
+my $sql = "Requestor.id = ". $Requestor->id;
+if (@$conditions) {
+ $sql .= " AND (".join( " OR ", map $_->{cond}, @$conditions).")";
}
-
my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$tickets->FromSQL( "Requestor.id = ". $Requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
+$tickets->FromSQL( $sql );
$tickets->RowsPerPage( $Rows );
$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
</%INIT>
<%ARGS>
$Ticket => undef
$Requestor => undef
-$conditions => []
+$conditions
$Rows => 10
</%ARGS>
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTicketsActive
similarity index 82%
copy from share/html/Ticket/Elements/ShowRequestorTickets
copy to share/html/Ticket/Elements/ShowRequestorTicketsActive
index daddfb0..021206e 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsActive
@@ -45,26 +45,14 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
-<ul>
-%while (my $w=$tickets->Next) {
-%my $uri = RT::URI->new( $session{'CurrentUser'} );
-%$uri->FromObject($w);
-<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
-%}
-</ul>
+<span class="label"><&|/l, $Rows &>This user's [_1] highest priority active tickets</&>:</span>
+<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<%INIT>
-# Unsure sane default
unless ( @$conditions ) {
foreach (RT::Queue->ActiveStatusArray()) {
push @$conditions, { cond => "Status = '$_'", name => loc($_) };
}
}
-
-my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$tickets->FromSQL( "Requestor.id = ". $Requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
-$tickets->RowsPerPage( $Rows );
-$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
</%INIT>
<%ARGS>
$Ticket => undef
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTicketsAll
similarity index 77%
copy from share/html/Ticket/Elements/ShowRequestorTickets
copy to share/html/Ticket/Elements/ShowRequestorTicketsAll
index daddfb0..5419f63 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsAll
@@ -46,26 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
-<ul>
-%while (my $w=$tickets->Next) {
-%my $uri = RT::URI->new( $session{'CurrentUser'} );
-%$uri->FromObject($w);
-<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
-%}
-</ul>
-<%INIT>
-# Unsure sane default
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
-}
-
-my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$tickets->FromSQL( "Requestor.id = ". $Requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
-$tickets->RowsPerPage( $Rows );
-$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
-</%INIT>
+<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<%ARGS>
$Ticket => undef
$Requestor => undef
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
similarity index 81%
copy from share/html/Ticket/Elements/ShowRequestorTickets
copy to share/html/Ticket/Elements/ShowRequestorTicketsInactive
index daddfb0..1fa5a0a 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
@@ -45,26 +45,14 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
-<ul>
-%while (my $w=$tickets->Next) {
-%my $uri = RT::URI->new( $session{'CurrentUser'} );
-%$uri->FromObject($w);
-<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
-%}
-</ul>
+<span class="label"><&|/l, $Rows &>This user's [_1] highest priority inactive tickets</&>:</span>
+<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<%INIT>
-# Unsure sane default
unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
+ foreach (RT::Queue->InactiveStatusArray()) {
push @$conditions, { cond => "Status = '$_'", name => loc($_) };
}
}
-
-my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$tickets->FromSQL( "Requestor.id = ". $Requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
-$tickets->RowsPerPage( $Rows );
-$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
</%INIT>
<%ARGS>
$Ticket => undef
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTicketsNone
similarity index 74%
copy from share/html/Ticket/Elements/ShowRequestorTickets
copy to share/html/Ticket/Elements/ShowRequestorTicketsNone
index daddfb0..6230298 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsNone
@@ -45,27 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
-<ul>
-%while (my $w=$tickets->Next) {
-%my $uri = RT::URI->new( $session{'CurrentUser'} );
-%$uri->FromObject($w);
-<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
-%}
-</ul>
-<%INIT>
-# Unsure sane default
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
-}
-
-my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$tickets->FromSQL( "Requestor.id = ". $Requestor->id ." AND (".join( " OR ", map $_->{cond}, @$conditions).")" );
-$tickets->RowsPerPage( $Rows );
-$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
-</%INIT>
+%# showing no tickets means doing no work
<%ARGS>
$Ticket => undef
$Requestor => undef
commit 2973c7a44a26cdc88b2a52331df1869b5d878662
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Aug 13 14:32:28 2010 -0400
turns out we don't use anywhere
diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTickets
index 5fff558..3d162da 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -63,7 +63,6 @@ $tickets->RowsPerPage( $Rows );
$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
</%INIT>
<%ARGS>
-$Ticket => undef
$Requestor => undef
$conditions
$Rows => 10
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Ticket/Elements/ShowRequestorTicketsActive
index 021206e..950f237 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsActive
@@ -55,7 +55,6 @@ unless ( @$conditions ) {
}
</%INIT>
<%ARGS>
-$Ticket => undef
$Requestor => undef
$conditions => []
$Rows => 10
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsAll b/share/html/Ticket/Elements/ShowRequestorTicketsAll
index 5419f63..5b6922e 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsAll
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsAll
@@ -48,7 +48,6 @@
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<%ARGS>
-$Ticket => undef
$Requestor => undef
$conditions => []
$Rows => 10
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsInactive b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
index 1fa5a0a..d5a3b57 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsInactive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
@@ -55,7 +55,6 @@ unless ( @$conditions ) {
}
</%INIT>
<%ARGS>
-$Ticket => undef
$Requestor => undef
$conditions => []
$Rows => 10
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsNone b/share/html/Ticket/Elements/ShowRequestorTicketsNone
index 6230298..6254c2f 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsNone
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsNone
@@ -47,7 +47,6 @@
%# END BPS TAGGED BLOCK }}}
%# showing no tickets means doing no work
<%ARGS>
-$Ticket => undef
$Requestor => undef
$conditions => []
$Rows => 10
commit 49f18dcedc9dc511d2d5afa4de920947b9d432f7
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Aug 13 14:34:20 2010 -0400
Add in links to toggle between different ticket lists
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Helpers/Toggle/ShowRequestor
similarity index 80%
copy from share/html/Ticket/Elements/ShowRequestorTicketsActive
copy to share/html/Helpers/Toggle/ShowRequestor
index 950f237..dd9fa96 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Helpers/Toggle/ShowRequestor
@@ -1,40 +1,40 @@
%# BEGIN BPS TAGGED BLOCK {{{
-%#
+%#
%# COPYRIGHT:
-%#
+%#
%# This software is Copyright (c) 1996-2010 Best Practical Solutions, LLC
%# <jesse at bestpractical.com>
-%#
+%#
%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
+%#
+%#
%# LICENSE:
-%#
+%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
-%#
+%#
%# This work 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
%# General Public License for more details.
-%#
+%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
+%#
+%#
%# CONTRIBUTION SUBMISSION POLICY:
-%#
+%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
-%#
+%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
@@ -43,19 +43,21 @@
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
-%#
+%#
%# END BPS TAGGED BLOCK }}}
-<span class="label"><&|/l, $Rows &>This user's [_1] highest priority active tickets</&>:</span>
-<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<%INIT>
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
+my $TicketTemplate = "/Ticket/Elements/ShowRequestorTickets$Status";
+$TicketTemplate = "/Ticket/Elements/ShowRequestorTicketsActive" unless $m->comp_exists($TicketTemplate);
+my $user_obj = RT::User->new($session{CurrentUser});
+my ($val, $msg) = $user_obj->Load($Requestor);
+unless ($val) {
+ $RT::Logger->error("Unable to load User $Requestor: $msg");
+} else {
+ $m->comp( $TicketTemplate, Requestor => $user_obj );
}
+$m->abort();
</%INIT>
<%ARGS>
-$Requestor => undef
-$conditions => []
-$Rows => 10
+$Status
+$Requestor
</%ARGS>
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Ticket/Elements/ShowRequestorTicketsActive
index 950f237..1830d52 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsActive
@@ -45,8 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+<span id="more-about-requestor-<%$Requestor->Id%>">
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority active tickets</&>:</span>
<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
+<& ShowRequestorToggleLinks, %ARGS, Status => 'Active' &>
+</span>
<%INIT>
unless ( @$conditions ) {
foreach (RT::Queue->ActiveStatusArray()) {
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsAll b/share/html/Ticket/Elements/ShowRequestorTicketsAll
index 5b6922e..d2a88e4 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsAll
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsAll
@@ -45,8 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+<span id="more-about-requestor-<%$Requestor->Id%>">
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
+<& ShowRequestorToggleLinks, %ARGS, Status => 'All' &>
+</span>
<%ARGS>
$Requestor => undef
$conditions => []
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsInactive b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
index d5a3b57..22ec747 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsInactive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
@@ -45,8 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+<span id="more-about-requestor-<%$Requestor->Id%>">
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority inactive tickets</&>:</span>
<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
+<& ShowRequestorToggleLinks, %ARGS, Status => 'Inactive' &>
+</span>
<%INIT>
unless ( @$conditions ) {
foreach (RT::Queue->InactiveStatusArray()) {
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsNone b/share/html/Ticket/Elements/ShowRequestorTicketsNone
index 6254c2f..e4688d7 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsNone
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsNone
@@ -45,7 +45,10 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+<span id="more-about-requestor-<%$Requestor->Id%>">
%# showing no tickets means doing no work
+<& ShowRequestorToggleLinks, %ARGS, Status => 'Inactive' &>
+</span>
<%ARGS>
$Requestor => undef
$conditions => []
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Ticket/Elements/ShowRequestorToggleLinks
similarity index 70%
copy from share/html/Ticket/Elements/ShowRequestorTicketsActive
copy to share/html/Ticket/Elements/ShowRequestorToggleLinks
index 950f237..788456d 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Ticket/Elements/ShowRequestorToggleLinks
@@ -45,17 +45,26 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<span class="label"><&|/l, $Rows &>This user's [_1] highest priority active tickets</&>:</span>
-<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
+% for my $status ( @$status_order ) {
+% my $url = RT->Config->Get('WebPath').'/Helpers/Toggle/ShowRequestor?'.
+% $m->comp('/Elements/QueryString', Requestor => $Requestor->Id , Status => $status);
+<a href="<% $url | n %>" onclick="jQuery('#more-about-requestor-<% $Requestor->Id %>').load('<% $url |n %>'); return false;" >
+<% $status_link_text->{$status} %>
+</a>
+% }
<%INIT>
-unless ( @$conditions ) {
- foreach (RT::Queue->ActiveStatusArray()) {
- push @$conditions, { cond => "Status = '$_'", name => loc($_) };
- }
+my $status_link_text = {Active => loc('Active Tickets'),
+ Inactive => loc('Inactive Tickets'),
+ All => loc('All Tickets')};
+my $status_order = [qw/Active Inactive All/];
+$m->callback( CallbackName => 'AddStatus', status_link_text => \$status_link_text, status_order => \$status_order );
+
+if ($Status) {
+ $status_order = [grep { $_ ne $Status } @$status_order];
+ delete $status_link_text->{$Status};
}
</%INIT>
<%ARGS>
-$Requestor => undef
-$conditions => []
-$Rows => 10
+$Requestor
+$Status => ''
</%ARGS>
commit c4d12c5fc3b29e7f452f6505a4bfeab410a07730
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Fri Aug 13 14:46:40 2010 -0400
Style the links a little
It looks better when they're not huge and running into the rest of the box
diff --git a/share/html/NoAuth/css/web2/ticket.css b/share/html/NoAuth/css/web2/ticket.css
index a82e029..acfe6ce 100644
--- a/share/html/NoAuth/css/web2/ticket.css
+++ b/share/html/NoAuth/css/web2/ticket.css
@@ -229,3 +229,9 @@ table.ticket-summary td.boxcontainer:first-child {
width: 50%;
}
+div.requestor-ticket-links {
+ text-align: left;
+ font-size: 0.8em;
+ padding-top: 0.25em;
+}
+
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsActive b/share/html/Ticket/Elements/ShowRequestorTicketsActive
index 1830d52..9c397e9 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsActive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsActive
@@ -47,8 +47,8 @@
%# END BPS TAGGED BLOCK }}}
<span id="more-about-requestor-<%$Requestor->Id%>">
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority active tickets</&>:</span>
-<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<& ShowRequestorToggleLinks, %ARGS, Status => 'Active' &>
+<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
</span>
<%INIT>
unless ( @$conditions ) {
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsAll b/share/html/Ticket/Elements/ShowRequestorTicketsAll
index d2a88e4..0c93577 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsAll
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsAll
@@ -47,8 +47,8 @@
%# END BPS TAGGED BLOCK }}}
<span id="more-about-requestor-<%$Requestor->Id%>">
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority tickets</&>:</span>
-<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<& ShowRequestorToggleLinks, %ARGS, Status => 'All' &>
+<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
</span>
<%ARGS>
$Requestor => undef
diff --git a/share/html/Ticket/Elements/ShowRequestorTicketsInactive b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
index 22ec747..1be0eb3 100644
--- a/share/html/Ticket/Elements/ShowRequestorTicketsInactive
+++ b/share/html/Ticket/Elements/ShowRequestorTicketsInactive
@@ -47,8 +47,8 @@
%# END BPS TAGGED BLOCK }}}
<span id="more-about-requestor-<%$Requestor->Id%>">
<span class="label"><&|/l, $Rows &>This user's [_1] highest priority inactive tickets</&>:</span>
-<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
<& ShowRequestorToggleLinks, %ARGS, Status => 'Inactive' &>
+<& ShowRequestorTickets, %ARGS, conditions => $conditions, Rows => $Rows &>
</span>
<%INIT>
unless ( @$conditions ) {
diff --git a/share/html/Ticket/Elements/ShowRequestorToggleLinks b/share/html/Ticket/Elements/ShowRequestorToggleLinks
index 788456d..a2fdfe0 100644
--- a/share/html/Ticket/Elements/ShowRequestorToggleLinks
+++ b/share/html/Ticket/Elements/ShowRequestorToggleLinks
@@ -45,13 +45,15 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
+<div class="requestor-ticket-links">
% for my $status ( @$status_order ) {
% my $url = RT->Config->Get('WebPath').'/Helpers/Toggle/ShowRequestor?'.
% $m->comp('/Elements/QueryString', Requestor => $Requestor->Id , Status => $status);
-<a href="<% $url | n %>" onclick="jQuery('#more-about-requestor-<% $Requestor->Id %>').load('<% $url |n %>'); return false;" >
+[<a href="<% $url | n %>" onclick="jQuery('#more-about-requestor-<% $Requestor->Id %>').load('<% $url |n %>'); return false;" >
<% $status_link_text->{$status} %>
-</a>
+</a>]
% }
+</div>
<%INIT>
my $status_link_text = {Active => loc('Active Tickets'),
Inactive => loc('Inactive Tickets'),
commit aac4182970b59abbda637ea549cbe478659275df
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Aug 17 12:36:53 2010 -0400
Add a new MoreAboutRequestorExtraInfo config option
Parses a columnmap format and shows user info in the 'More about
requesor' box, above the ticket listing.
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 44a0722..ff122c7 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -864,7 +864,7 @@ Set($UsernameFormat, 'concise');
=item C<$ShowMoreAboutPrivilegedUsers>
-This determines if the 'More about Requestor' box on Ticket/Display.html is
+This determines if the 'More about requestor' box on Ticket/Display.html is
shown for Privileged Users.
=cut
@@ -874,13 +874,24 @@ Set($ShowMoreAboutPrivilegedUsers, 0);
=item C<$MoreAboutRequestorTicketList>
This can be set to Active, Inactive, All or None. It controls what ticket
-list will be displayed in the More about requestor box on Ticket/Display.html.
+list will be displayed in the 'More about requestor' box on Ticket/Display.html.
This option can be controlled by users also.
=cut
Set($MoreAboutRequestorTicketList, 'Active');
+=item C<$MoreAboutRequestorExtraInfo>
+
+By default, the 'More about requestor' box on Ticket/Display.html shows
+the Requestor's name and ticket list. If you would like to see extra information
+about the user, this expects a Format string of user attributes. Please note that
+not all the attributes are supported in this display because we're not building a table.
+
+=cut
+
+Set($MoreAboutRequestorExtraInfo, '');
+
=item C<$WebDomain>
Domain name of the RT server, eg 'www.example.com'. It should not contain
diff --git a/share/html/NoAuth/css/web2/ticket.css b/share/html/NoAuth/css/web2/ticket.css
index acfe6ce..ad8e065 100644
--- a/share/html/NoAuth/css/web2/ticket.css
+++ b/share/html/NoAuth/css/web2/ticket.css
@@ -235,3 +235,11 @@ div.requestor-ticket-links {
padding-top: 0.25em;
}
+div.more-about-requestor-extra-info .label {
+ font-weight: bold;
+ padding-left: 0.5em;
+}
+
+div.more-about-requestor-extra-info .value {
+ padding-left: 0em;
+}
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestor
index 05a7e36..e8e455f 100755
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestor
@@ -61,6 +61,7 @@ while ( my $requestor = $people->Next ) {
%# Additional information about this user. Empty by default.
% $m->callback( requestor => $requestor, %ARGS, CallbackName => 'AboutThisUser' );
+<& ShowRequestorExtraInfo, Requestor => $requestor &>
<span class="label commentsaboutuser"><&|/l&>Comments about this user</&>:</span><br />
<b class="value commentsaboutuser"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
diff --git a/share/html/Ticket/Elements/ShowRequestor b/share/html/Ticket/Elements/ShowRequestorExtraInfo
old mode 100755
new mode 100644
similarity index 55%
copy from share/html/Ticket/Elements/ShowRequestor
copy to share/html/Ticket/Elements/ShowRequestorExtraInfo
index 05a7e36..cb8c337
--- a/share/html/Ticket/Elements/ShowRequestor
+++ b/share/html/Ticket/Elements/ShowRequestorExtraInfo
@@ -1,40 +1,40 @@
%# BEGIN BPS TAGGED BLOCK {{{
-%#
+%#
%# COPYRIGHT:
-%#
+%#
%# This software is Copyright (c) 1996-2010 Best Practical Solutions, LLC
%# <jesse at bestpractical.com>
-%#
+%#
%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
+%#
+%#
%# LICENSE:
-%#
+%#
%# This work is made available to you under the terms of Version 2 of
%# the GNU General Public License. A copy of that license should have
%# been provided with this software, but in any event can be snarfed
%# from www.gnu.org.
-%#
+%#
%# This work 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
%# General Public License for more details.
-%#
+%#
%# You should have received a copy of the GNU General Public License
%# along with this program; if not, write to the Free Software
%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
%# 02110-1301 or visit their web page on the internet at
%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
-%#
-%#
+%#
+%#
%# CONTRIBUTION SUBMISSION POLICY:
-%#
+%#
%# (The following paragraph is not intended to limit the rights granted
%# to you to modify and distribute this software under the terms of
%# the GNU General Public License and is only of importance to you if
%# you choose to contribute your changes and enhancements to the
%# community by submitting them to Best Practical Solutions, LLC.)
-%#
+%#
%# By intentionally submitting any modifications, corrections or
%# derivatives to this work, or any other work intended for use with
%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
@@ -43,53 +43,57 @@
%# royalty-free, perpetual, license to use, copy, create derivative
%# works based on those contributions, and sublicense and distribute
%# those contributions and any derivatives thereof.
-%#
+%#
%# END BPS TAGGED BLOCK }}}
-<%PERL>
-my $people = $Ticket->Requestors->UserMembersObj;
-while ( my $requestor = $people->Next ) {
- next if !$show_privileged && $requestor->Privileged;
- my $name = $m->scomp('/Elements/ShowUser', User => $requestor);
-
-</%PERL>
-
-<&| /Widgets/TitleBox,
- title_href => $has_right_adminusers? RT->Config->Get('WebPath')."/Admin/Users/Modify.html?id=".$requestor->id: undef,
- title_raw => loc("More about [_1]", $name),
- class => 'ticket-info-requestor'
-&>
-
-%# Additional information about this user. Empty by default.
-% $m->callback( requestor => $requestor, %ARGS, CallbackName => 'AboutThisUser' );
-
-<span class="label commentsaboutuser"><&|/l&>Comments about this user</&>:</span><br />
-<b class="value commentsaboutuser"><% ($requestor->Comments || loc("No comment entered about this user")) %></b><br />
-
-<& $TicketTemplate, Requestor => $requestor &>
+<div class="more-about-requestor-extra-info">
+% for my $column (@formats) {
+% my $title = $column->{title} || '';
+% unless (defined $column->{title}) {
+% my $attr = $column->{'attribute'} || $column->{'last_attribute'};
+% my $tmp = $m->comp( '/Elements/ColumnMap',
+% Class => $Class,
+% Name => $attr,
+% Attr => 'title',
+% );
+% $title = ProcessColumnMapValue( $tmp, Arguments => [ $attr ] );
+%
+% # in case title is not defined in ColumnMap
+% # the following regex changes $attr like from "ReferredToBy" to "Referred To By"
+% $title = join ' ', split /(?<=[a-z])(?=[A-Z])/, $attr unless defined $title;
+% }
+% $title = $m->comp('/Elements/ScrubHTML', Content => $title);
+<span>
+<span class="label"> <% $title %></span>
+% my @out;
+% foreach my $subcol ( @{ $column->{output} } ) {
+% my ($col) = ($subcol =~ /^__(.*?)__$/);
+% unless ( $col ) {
+% push @out, $subcol;
+% next;
+% }
-<span class="moreaboutusergroups">
-<&|/l&>Groups this user belongs to</&>:<br />
+% my $value = $m->comp(
+% "/Elements/ColumnMap",
+% Class => $Class,
+% Name => $col,
+% Attr => 'value'
+% );
-<& /Elements/ShowMemberships, UserObj => $requestor &>
+% push @out, ProcessColumnMapValue(
+% $value,
+% Arguments => [$Requestor],
+% );
+% }
+% @out = grep { defined $_ } @out;
+<span class="value"><% join(' ', at out) %></span>
</span>
-
-</&>
-
% }
+</div>
<%INIT>
-my $has_right_adminusers = $session{'CurrentUser'}->HasRight(
- Object => $RT::System, Right => 'AdminUsers'
-);
-$has_right_adminusers &&= $session{'CurrentUser'}->HasRight(
- Object => $RT::System, Right => 'ShowConfigTab'
-);
-
-my $show_privileged = RT->Config->Get('ShowMoreAboutPrivilegedUsers');
-
-$TicketTemplate ||= "ShowRequestorTickets".(RT->Config->Get('MoreAboutRequestorTicketList', $session{CurrentUser})||'Active');
-$TicketTemplate = "ShowRequestorTicketsActive" unless $m->comp_exists($TicketTemplate);
+my $format = RT->Config->Get('MoreAboutRequestorExtraInfo');
+my @formats = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $format);
</%INIT>
<%ARGS>
-$Ticket=>undef
-$TicketTemplate=>undef
+$Requestor => undef
+$Class => 'RT__User';
</%ARGS>
commit fee78549833d0057ae5a25961aa63afaeabaa27d
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Aug 17 15:12:41 2010 -0400
Move this awful repeated ColumnMap code into a subref
All of columnmap wants chopping into little bits without hardcoded
tables, but for now this at least minimizes my copying.
diff --git a/share/html/Ticket/Elements/ShowRequestorExtraInfo b/share/html/Ticket/Elements/ShowRequestorExtraInfo
index cb8c337..fcbaeb5 100644
--- a/share/html/Ticket/Elements/ShowRequestorExtraInfo
+++ b/share/html/Ticket/Elements/ShowRequestorExtraInfo
@@ -50,16 +50,8 @@
% my $title = $column->{title} || '';
% unless (defined $column->{title}) {
% my $attr = $column->{'attribute'} || $column->{'last_attribute'};
-% my $tmp = $m->comp( '/Elements/ColumnMap',
-% Class => $Class,
-% Name => $attr,
-% Attr => 'title',
-% );
-% $title = ProcessColumnMapValue( $tmp, Arguments => [ $attr ] );
-%
-% # in case title is not defined in ColumnMap
-% # the following regex changes $attr like from "ReferredToBy" to "Referred To By"
-% $title = join ' ', split /(?<=[a-z])(?=[A-Z])/, $attr unless defined $title;
+% unless (defined $column->{title}) {
+% $title = $fetch_columnmap->($attr,'title',[$attr]);
% }
% $title = $m->comp('/Elements/ScrubHTML', Content => $title);
<span>
@@ -71,18 +63,7 @@
% push @out, $subcol;
% next;
% }
-
-% my $value = $m->comp(
-% "/Elements/ColumnMap",
-% Class => $Class,
-% Name => $col,
-% Attr => 'value'
-% );
-
-% push @out, ProcessColumnMapValue(
-% $value,
-% Arguments => [$Requestor],
-% );
+% push @out, $fetch_columnmap->($col, 'value', [$Requestor]);
% }
% @out = grep { defined $_ } @out;
<span class="value"><% join(' ', at out) %></span>
@@ -92,6 +73,16 @@
<%INIT>
my $format = RT->Config->Get('MoreAboutRequestorExtraInfo');
my @formats = $m->comp('/Elements/CollectionAsTable/ParseFormat', Format => $format);
+
+my $fetch_columnmap = sub {
+ my ($name, $attr, $arguments) = @_;
+ my $tmp = $m->comp( '/Elements/ColumnMap',
+ Class => $Class,
+ Name => $name,
+ Attr => $attr,
+ );
+ return ProcessColumnMapValue( $tmp, Arguments => $arguments );
+};
</%INIT>
<%ARGS>
$Requestor => undef
commit 764de566b3d36f85a591c8e8f54fd86829117a6d
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Tue Aug 17 15:13:26 2010 -0400
Use the User Attribute in a css class so you can style individual tuples
diff --git a/share/html/Ticket/Elements/ShowRequestorExtraInfo b/share/html/Ticket/Elements/ShowRequestorExtraInfo
index fcbaeb5..b803a29 100644
--- a/share/html/Ticket/Elements/ShowRequestorExtraInfo
+++ b/share/html/Ticket/Elements/ShowRequestorExtraInfo
@@ -48,13 +48,12 @@
<div class="more-about-requestor-extra-info">
% for my $column (@formats) {
% my $title = $column->{title} || '';
-% unless (defined $column->{title}) {
% my $attr = $column->{'attribute'} || $column->{'last_attribute'};
% unless (defined $column->{title}) {
% $title = $fetch_columnmap->($attr,'title',[$attr]);
% }
% $title = $m->comp('/Elements/ScrubHTML', Content => $title);
-<span>
+<span class="more-about-requestor-extra-info <% $fetch_columnmap->($attr,'attribute',[$attr]) %>" >
<span class="label"> <% $title %></span>
% my @out;
% foreach my $subcol ( @{ $column->{output} } ) {
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list