summaryrefslogtreecommitdiff
path: root/rt/share/html/Elements/ShowRelationLabel
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-07-09 22:18:55 -0700
committerIvan Kohler <ivan@freeside.biz>2015-07-09 22:18:55 -0700
commit1c538bfabc2cd31f27067505f0c3d1a46cba6ef0 (patch)
tree96922ad4459eda1e649327fd391d60c58d454c53 /rt/share/html/Elements/ShowRelationLabel
parent4f5619288413a185e9933088d9dd8c5afbc55dfa (diff)
RT 4.2.11, ticket#13852
Diffstat (limited to 'rt/share/html/Elements/ShowRelationLabel')
-rw-r--r--rt/share/html/Elements/ShowRelationLabel30
1 files changed, 24 insertions, 6 deletions
diff --git a/rt/share/html/Elements/ShowRelationLabel b/rt/share/html/Elements/ShowRelationLabel
index 92d8fec8d..e1c684f09 100644
--- a/rt/share/html/Elements/ShowRelationLabel
+++ b/rt/share/html/Elements/ShowRelationLabel
@@ -45,18 +45,36 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<a href="<%$SearchURL |n %>"><%$Label%></a>
+% if ($SearchURL) {
+<a href="<% $SearchURL %>"><% $Label %></a>
+% } else {
+<% $Label %>
+% }
<%INIT>
-my $typemap = RT::Ticket->LINKTYPEMAP->{$Relation};
+my $typemap = $RT::Link::TYPEMAP{$Relation};
my $search_mode = $typemap->{Mode};
my $search_type = $typemap->{Type};
-my $search_relation = RT::Ticket->LINKDIRMAP->{$search_type}{$search_mode};
+my $search_relation = $RT::Link::DIRMAP{$search_type}->{$search_mode};
+my $SearchURL;
-my $Query = $search_relation . ' = ' . $id;
-my $SearchURL = RT->Config->Get('WebPath') . '/Search/Results.html?' . $m->comp('/Elements/QueryString', Query => $Query);
+if ($Object and $Object->id) {
+ my $id = $Object->id;
+
+ if ($Object->isa("RT::Ticket")) {
+ $SearchURL = RT->Config->Get('WebPath')
+ . '/Search/Results.html?'
+ . $m->comp('/Elements/QueryString', Query => "$search_relation = $id");
+ }
+}
+
+$m->callback(
+ CallbackName => "ModifySearchURL",
+ SearchURL => \$SearchURL,
+ ARGSRef => \%ARGS,
+);
</%INIT>
<%ARGS>
-$id
+$Object => undef
$Label
$Relation
</%ARGS>