1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
6 %# <sales@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 %# 02110-1301 or visit their web page on the internet at
27 %# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
30 %# CONTRIBUTION SUBMISSION POLICY:
32 %# (The following paragraph is not intended to limit the rights granted
33 %# to you to modify and distribute this software under the terms of
34 %# the GNU General Public License and is only of importance to you if
35 %# you choose to contribute your changes and enhancements to the
36 %# community by submitting them to Best Practical Solutions, LLC.)
38 %# By intentionally submitting any modifications, corrections or
39 %# derivatives to this work, or any other work intended for use with
40 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
41 %# you are the copyright holder for those contributions and you grant
42 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
43 %# royalty-free, perpetual, license to use, copy, create derivative
44 %# works based on those contributions, and sublicense and distribute
45 %# those contributions and any derivatives thereof.
47 %# END BPS TAGGED BLOCK }}}
50 <td valign="top" width="50%">
51 <h3><&|/l&>Current Links</&></h3>
54 <td class="labeltop"><&|/l&>Depends on</&>:</td>
56 % if ( $hash{DependsOn} ) {
57 % for my $link ( values %{$hash{DependsOn}} ) {
58 <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
59 <& /Elements/ShowLink, URI => $link->TargetURI &><br />
64 <td class="labeltop"><&|/l&>Depended on by</&>:</td>
66 % if ( $hash{DependedOnBy} ) {
67 % for my $link ( values %{$hash{DependedOnBy}} ) {
68 <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
69 <& /Elements/ShowLink, URI => $link->BaseURI &><br />
74 <td class="labeltop"><&|/l&>Parents</&>:</td>
76 % if ( $hash{MemberOf} ) {
77 % for my $link ( values %{$hash{MemberOf}} ) {
78 <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
79 <& /Elements/ShowLink, URI => $link->TargetURI &><br />
84 <td class="labeltop"><&|/l&>Children</&>:</td>
86 % if ( $hash{Members} ) {
87 % for my $link ( values %{$hash{Members}} ) {
88 <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
89 <& /Elements/ShowLink, URI => $link->BaseURI &><br />
94 <td class="labeltop"><&|/l&>Refers to</&>:</td>
96 % if ( $hash{RefersTo} ) {
97 % for my $link ( values %{$hash{RefersTo}} ) {
98 <input type="checkbox" class="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
99 <& /Elements/ShowLink, URI => $link->TargetURI &><br />
104 <td class="labeltop"><&|/l&>Referred to by</&>:</td>
106 % if ( $hash{ReferredToBy} ) {
107 % for my $link ( values %{$hash{ReferredToBy}} ) {
109 % next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket') && $link->BaseObj->Type eq 'reminder');
110 <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
111 <& /Elements/ShowLink, URI => $link->BaseURI &><br />
117 <td><i><&|/l&>(Check box to delete)</&></i></td>
122 <h3><&|/l&>New Links</&></h3>
123 <i><&|/l&>Enter tickets or URIs to link tickets to. Separate multiple entries with spaces.</&>
127 <td class="label"><&|/l&>Merge into</&>:</td>
128 <td class="entry"><input name="Ticket-MergeInto" value="<% $ARGS{'Ticket-MergeInto'} || '' %>" /> <i><&|/l&>(only one ticket)</&></i></td>
131 <td class="label"><&|/l&>Depends on</&>:</td>
132 <td class="entry"><input name="Ticket-DependsOn" value="<% $ARGS{'Ticket-DependsOn'} || '' %>" /></td>
135 <td class="label"><&|/l&>Depended on by</&>:</td>
136 <td class="entry"><input name="DependsOn-Ticket" value="<% $ARGS{'DependsOn-Ticket'} || '' %>" /></td>
139 <td class="label"><&|/l&>Parents</&>:</td>
140 <td class="entry"><input name="Ticket-MemberOf" value="<% $ARGS{'Ticket-MemberOf'} || '' %>" /></td>
143 <td class="label"><&|/l&>Children</&>:</td>
144 <td class="entry"> <input name="MemberOf-Ticket" value="<% $ARGS{'MemberOf-Ticket'} || '' %>" /></td>
147 <td class="label"><&|/l&>Refers to</&>:</td>
148 <td class="entry"><input name="Ticket-RefersTo" value="<% $ARGS{'Ticket-RefersTo'} || '' %>" /></td>
151 <td class="label"><&|/l&>Referred to by</&>:</td>
152 <td class="entry"> <input name="RefersTo-Ticket" value="<% $ARGS{'RefersTo-Ticket'} || '' %>" /></td>
165 if ( $Tickets && $Tickets->Count ) {
166 my $first_ticket = $Tickets->Next or last; #avoid errors on bulk delete
167 # we only show current links that eixst on all the tickets
168 for my $type ( qw/DependsOn DependedOnBy Members MemberOf RefersTo
171 $type =~ /DependsOn|MemberOf|RefersTo/ ? 'Target' : 'Base';
172 while ( my $link = $first_ticket->$type->Next ) {
173 $hash{$type}{$link->$target_or_base} = $link;
177 while ( my $ticket = $Tickets->Next ) {
178 for my $type ( qw/DependsOn DependedOnBy Members MemberOf RefersTo
181 $type =~ /DependsOn|MemberOf|RefersTo/ ? 'Target' : 'Base';
182 # if $hash{$type} is empty, no need to check any more
183 next unless $hash{$type} && keys %{$hash{$type}};
185 while ( my $link = $ticket->$type->Next ) {
186 $exists{$link->$target_or_base}++;
189 for ( keys %{$hash{$type}} ) {
190 delete $hash{$type}{$_} unless $exists{$_};