1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2016 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" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
59 <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& /Elements/ShowLink, URI => $link->TargetURI &></label><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" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
69 <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><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" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
79 <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& /Elements/ShowLink, URI => $link->TargetURI &></label><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" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
89 <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><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" id="DeleteLink--<%$link->Type%>-<%$link->Target%>" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" value="1" />
99 <label for="DeleteLink--<%$link->Type%>-<%$link->Target%>"><& /Elements/ShowLink, URI => $link->TargetURI &></label><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->__Value('Type') eq 'reminder');
110 <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
111 <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><br />
117 <td><i><&|/l&>(Check box to delete)</&></i></td>
122 <h3><&|/l&>New Links</&></h3>
123 <em><&|/l&>Enter tickets or URIs to link to. Separate multiple entries with spaces.</&>
127 <td class="label"><&|/l&>Depends on</&>:</td>
128 <td class="entry"><input name="<% $record_type %>-DependsOn" data-autocomplete="Tickets" data-autocomplete-multiple="1" value="<% $ARGS{ $record_type .'-DependsOn' } || '' %>" /></td>
131 <td class="label"><&|/l&>Depended on by</&>:</td>
132 <td class="entry"><input name="DependsOn-<% $record_type %>" data-autocomplete="Tickets" data-autocomplete-multiple="1" value="<% $ARGS{ 'DependsOn-'. $record_type } || '' %>" /></td>
135 <td class="label"><&|/l&>Parents</&>:</td>
136 <td class="entry"><input name="<% $record_type %>-MemberOf" data-autocomplete="Tickets" data-autocomplete-multiple="1" value="<% $ARGS{ $record_type .'-MemberOf'} || '' %>" /></td>
139 <td class="label"><&|/l&>Children</&>:</td>
140 <td class="entry"> <input name="MemberOf-<% $record_type %>" data-autocomplete="Tickets" data-autocomplete-multiple="1" value="<% $ARGS{ 'MemberOf-'. $record_type } || '' %>" /></td>
143 <td class="label"><&|/l&>Refers to</&>:</td>
144 <td class="entry"><input name="<% $record_type %>-RefersTo" data-autocomplete="Tickets" data-autocomplete-multiple="1" value="<% $ARGS{ $record_type .'-RefersTo'} || '' %>" /></td>
147 <td class="label"><&|/l&>Referred to by</&>:</td>
148 <td class="entry"> <input name="RefersTo-<% $record_type %>" data-autocomplete="Tickets" data-autocomplete-multiple="1" value="<% $ARGS{ 'RefersTo-'. $record_type } || '' %>" /></td>
161 my @types = qw/DependsOn DependedOnBy Members MemberOf RefersTo ReferredToBy/;
163 my $record_type = $Collection->RecordClass;
164 $record_type =~ s/^RT:://; $record_type =~ s/::/-/g;
167 if ( $Collection->Count ) {
168 my $first_record = $Collection->Next;
169 # we only show current links that exist on all the records
170 for my $type ( @types ) {
172 $type =~ /DependsOn|MemberOf|RefersTo/ ? 'Target' : 'Base';
173 my $links = $first_record->$type;
174 while ( my $link = $links->Next ) {
175 $hash{$type}{$link->$target_or_base} = $link;
179 while ( my $record = $Collection->Next ) {
180 for my $type ( @types ) {
182 $type =~ /DependsOn|MemberOf|RefersTo/ ? 'Target' : 'Base';
183 # if $hash{$type} is empty, no need to check any more
184 next unless $hash{$type} && keys %{$hash{$type}};
187 while ( my $link = $record->$type->Next ) {
188 $exists{$link->$target_or_base}++;
191 for ( keys %{$hash{$type}} ) {
192 delete $hash{$type}{$_} unless $exists{$_};