diff options
Diffstat (limited to 'rt/share/html/Elements/ShowLinks')
-rwxr-xr-x | rt/share/html/Elements/ShowLinks | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/rt/share/html/Elements/ShowLinks b/rt/share/html/Elements/ShowLinks index d674fea72..61628de4d 100755 --- a/rt/share/html/Elements/ShowLinks +++ b/rt/share/html/Elements/ShowLinks @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,12 +47,17 @@ %# END BPS TAGGED BLOCK }}} <table> <tr> - <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>: <span class="create">(<a href="<%$clone->{'DependsOn-new'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depends on'), Relation => 'DependsOn' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'DependsOn-new'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"> - <%PERL> -my ( @active, @inactive, @not_tickets ); -for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { +my ( $depends_on, @active, @inactive, @not_tickets ); +$depends_on = $Ticket->DependsOn; + +while ( my $link = $depends_on->Next ) { my $target = $link->TargetObj; if ( $target && $target->isa('RT::Ticket') ) { if ( $target->QueueObj->IsInactiveStatus( $target->Status ) ) { @@ -67,8 +72,6 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { } } </%PERL> - - <ul> % for my $Link (@not_tickets, @active, @inactive) { <li><& ShowLink, URI => $Link &></li> @@ -77,7 +80,11 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>: <span class="create">(<a href="<%$clone->{'new-DependsOn'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Depended on by'), Relation => 'DependedOnBy' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'new-DependsOn'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"> <ul> % while (my $Link = $Ticket->DependedOnBy->Next) { @@ -87,15 +94,27 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>: <span class="create">(<a href="<%$clone->{'MemberOf-new'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Parents'), Relation => 'Parents' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'MemberOf-new'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"><& /Ticket/Elements/ShowParents, Ticket => $Ticket &></td> </tr> <tr> - <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>: <span class="create">(<a href="<%$clone->{'new-MemberOf'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Children'), Relation => 'Children' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'new-MemberOf'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"><& /Ticket/Elements/ShowMembers, Ticket => $Ticket &></td> </tr> <tr> - <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>: <span class="create">(<a href="<%$clone->{'RefersTo-new'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Refers to'), Relation => 'RefersTo' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'RefersTo-new'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"> <ul> % while (my $Link = $Ticket->RefersTo->Next) { @@ -105,7 +124,11 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </td> </tr> <tr> - <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>: <span class="create">(<a href="<%$clone->{'new-RefersTo'}%>"><% loc('Create') %></a>)</span></td> + <td class="labeltop"><& ShowRelationLabel, id => $id, Label => loc('Referred to by'), Relation => 'ReferredToBy' &>:\ +% if ($can_create) { + <span class="create">(<a href="<%$clone->{'new-RefersTo'}%>"><% loc('Create') %></a>)</span> +% } + </td> <td class="value"> <ul> % while (my $Link = $Ticket->ReferredToBy->Next) { @@ -115,13 +138,9 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) { </ul> </td> </tr> - - % # Allow people to add more rows to the table % $m->callback( %ARGS ); - </table> - <%INIT> my $id = $Ticket->id; @@ -133,6 +152,7 @@ my $path . $Ticket->Queue . '&CloneTicket=' . $id; +my $can_create = $Ticket->QueueObj->CurrentUserHasRight('CreateTicket'); for my $relation ( qw(RefersTo ReferredToBy)) { @@ -154,7 +174,6 @@ for my $relation ( qw(MemberOf Members DependsOn DependedOnBy)) { } </%INIT> - <%ARGS> $Ticket => undef </%ARGS> |