[Rt-commit] [rtir] 15/18: Add a new Formats helper for RTIR ticket URLs
Jesse Vincent
jesse at bestpractical.com
Wed Mar 11 03:36:47 EDT 2015
This is an automated email from the git hooks/post-receive script.
jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.
commit 70407d6fc1c9d3aad813e0299566f3181d13cb03
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Mar 11 00:17:14 2015 -0700
Add a new Formats helper for RTIR ticket URLs
---
html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once | 13 +++++++++++++
lib/RT/IR/Web.pm | 16 ++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
index 2c3f31e..b3b27af 100644
--- a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
+++ b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
@@ -48,6 +48,19 @@
<%INIT>
use RT::Crypt::GnuPG;
+$COLUMN_MAP->{'RTIRTicketURI'} = {
+ value =>sub {
+ my $t = shift;
+ my $link;
+ if ($t->QueueObj->Lifecycle eq RT::IR->lifecycle_incident) {
+ $link = RT::IR->HREFTo('Incident/Display.html?id='.$t->id);
+ } else {
+ $link = RT::IR->HREFTo('Display.html?id='.$t->id);
+ }
+ return \$link;
+ }
+};
+
$COLUMN_MAP->{'Take'} = {
title => 'Take',
value => sub {
diff --git a/lib/RT/IR/Web.pm b/lib/RT/IR/Web.pm
new file mode 100644
index 0000000..410298d
--- /dev/null
+++ b/lib/RT/IR/Web.pm
@@ -0,0 +1,16 @@
+package RT::IR::Web;
+use warnings;
+use strict;
+
+use RT::Interface::Web;
+package HTML::Mason::Commands;
+
+# Extend RT's html scribber to allow the custom RTIR ticket url helper
+# If we set this in the ColumnMap callback, it's too late, as RT's scrubber
+# has already been initialized
+#
+$HTML::Mason::Commands::SCRUBBER_ALLOWED_ATTRIBUTES{'href'} = '^(?:'.$HTML::Mason::Commands::SCRUBBER_ALLOWED_ATTRIBUTES{'href'} . ')|(?:__RTIRTicketURI__)';
+
+package RT::IR::Web;
+RT::Base->_ImportOverlays();
+1;
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list