[Rt-commit] rtir branch, 2.5-trunk, updated. 76e3420a6ed69ef9cff2c734b135baca5ea5063f
Jesse Vincent
jesse at bestpractical.com
Thu Sep 16 10:11:08 EDT 2010
The branch, 2.5-trunk has been updated
via 76e3420a6ed69ef9cff2c734b135baca5ea5063f (commit)
from 903cc39f9fed1b2e9970504e7ba88087fc240a3b (commit)
Summary of changes:
html/Callbacks/RTIR/Elements/ColumnMap/Once | 26 ++++++++++++++++++++
.../RTIR/Elements/RT__Ticket/ColumnMap/Once | 22 ++++++++++++++++
html/RTIR/Create.html | 11 +++++++-
html/RTIR/Elements/ShowRTIRField | 17 +++++++++++-
html/RTIR/Elements/UpdateData | 2 +-
html/RTIR/Incident/Create.html | 8 +++++-
html/RTIR/Investigation/Elements/Create | 4 ++-
html/RTIR/Tools/Lookup.html | 4 ++-
8 files changed, 86 insertions(+), 8 deletions(-)
create mode 100644 html/Callbacks/RTIR/Elements/ColumnMap/Once
- Log -----------------------------------------------------------------
commit 76e3420a6ed69ef9cff2c734b135baca5ea5063f
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Thu Aug 12 16:24:37 2010 -0400
merge forward from 2.4
diff --git a/html/Callbacks/RTIR/Elements/ColumnMap/Once b/html/Callbacks/RTIR/Elements/ColumnMap/Once
new file mode 100644
index 0000000..2dc4202
--- /dev/null
+++ b/html/Callbacks/RTIR/Elements/ColumnMap/Once
@@ -0,0 +1,26 @@
+<%ARGS>
+$COLUMN_MAP => undef
+</%ARGS>
+<%INIT>
+# RTIR's custom fields have _RTIR_ prefix and we should delete
+# that on display. However in RT 3.8.8 we moved CustomFields from
+# Tickets' map to generic
+if ( $COLUMN_MAP->{'CustomField'} ) {
+ my $rtir_cfs = RT::CustomFields->new( $RT::SystemUser );
+ $rtir_cfs->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => '_RTIR_' );
+ while ( my $cf = $rtir_cfs->Next ) {
+ my $name = $cf->Name;
+ my ($display_name) = $name =~ /^_RTIR_(.*)/i;
+ next if exists $COLUMN_MAP->{ "CustomField.{$name}" };
+
+ my %h = (
+ title => $display_name,
+ value => sub {
+ return $COLUMN_MAP->{ "CustomField" }->{'value'}->(@_, $name)
+ },
+ );
+ $COLUMN_MAP->{ "CF.{$name}" } =
+ $COLUMN_MAP->{ "CustomField.{$name}" } = \%h;
+ }
+}
+</%INIT>
diff --git a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
index b1912af..5c7a7bf 100644
--- a/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
+++ b/html/Callbacks/RTIR/Elements/RT__Ticket/ColumnMap/Once
@@ -1,6 +1,28 @@
<%INIT>
use RT::Crypt::GnuPG;
+# RTIR's custom fields have _RTIR_ prefix and we should delete
+# that on display. However in RT 3.8.8 we moved CustomFields from
+# Tickets' map to generic
+if ( $COLUMN_MAP->{'CustomField'} ) {
+ my $rtir_cfs = RT::CustomFields->new( $RT::SystemUser );
+ $rtir_cfs->Limit( FIELD => 'Name', OPERATOR => 'STARTSWITH', VALUE => '_RTIR_' );
+ while ( my $cf = $rtir_cfs->Next ) {
+ my $name = $cf->Name;
+ my ($display_name) = $name =~ /^_RTIR_(.*)/i;
+ next if exists $COLUMN_MAP->{ "CustomField.{$name}" };
+
+ my %h = (
+ title => $display_name,
+ value => sub {
+ return $COLUMN_MAP->{ "CustomField" }->{'value'}->(@_, $name)
+ },
+ );
+ $COLUMN_MAP->{ "CF.{$name}" } =
+ $COLUMN_MAP->{ "CustomField.{$name}" } = \%h;
+ }
+}
+
$COLUMN_MAP->{'Take'} = {
title => 'Take',
value => sub {
diff --git a/html/RTIR/Create.html b/html/RTIR/Create.html
index 638c097..4094f3f 100644
--- a/html/RTIR/Create.html
+++ b/html/RTIR/Create.html
@@ -196,7 +196,8 @@
<tr>
<td class="labeltop"><&|/l&>Message</&>:</td>
<td colspan="2">
-% if (!exists $ARGS{Content}) {
+% my $include_signature = 1;
+% unless (exists $ARGS{Content}) {
% my $Transactions;
% if ($TicketObj) {
% $Transactions = $TicketObj->Transactions;
@@ -217,9 +218,15 @@
% QuoteText => $quote);
% $ARGS{Content} =~ s/\>/>/g;
% }
+% } else {
+% $include_signature = 0;
% }
% $m->callback( %ARGS, CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' );
-<& /Elements/MessageBox, Default => $ARGS{Content}, QuoteTransaction => $QuoteTransaction &>
+% if ( $ARGS{Content} ) {
+<& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => $include_signature &>
+% } else {
+<& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
+% }
</td>
</tr>
<tr>
diff --git a/html/RTIR/Elements/ShowRTIRField b/html/RTIR/Elements/ShowRTIRField
index 31b79a9..971ac8f 100644
--- a/html/RTIR/Elements/ShowRTIRField
+++ b/html/RTIR/Elements/ShowRTIRField
@@ -26,17 +26,30 @@
<span class="cf-value novalue"><&|/l&>no value</&></class>
% return;
% } elsif ( $count == 1 ) {
-<span class="cf-value"><% $values->First->Content %></span>
+<span class="cf-value"><% $show_cb->( $values->First ) |n %></span>
% } else {
<ul class="cf-values">
% while ( my $value = $values->Next ) {
-<li class="cf-value"><% $value->Content %></li>
+<li class="cf-value"><% $show_cb->( $value ) |n %></li>
% }
</ul>
% }
<%INIT>
my $values = $Ticket->CustomFieldValues( $Name );
my $count = $values->Count;
+
+my $show_cb = sub {
+ my $value = shift;
+ my $linked = $value->LinkValueTo;
+ if ( $linked ) {
+ $m->out('<a href="'. $m->interp->apply_escapes( $value->LinkValueTo, 'h' ) .'" target="_new">');
+ }
+ $m->out( $m->interp->apply_escapes( $value->Content, 'h' ) );
+ if ( $linked ) {
+ $m->out('</a>');
+ }
+ return '';
+};
</%INIT>
<%ARGS>
$Ticket => undef
diff --git a/html/RTIR/Elements/UpdateData b/html/RTIR/Elements/UpdateData
index 6e21371..1b1a66c 100644
--- a/html/RTIR/Elements/UpdateData
+++ b/html/RTIR/Elements/UpdateData
@@ -46,7 +46,7 @@
% $m->callback( %ARGS, CallbackPage => '/Ticket/Update.html', CallbackName => 'BeforeMessageBox' );
% if ( exists $ARGS{'UpdateContent'} ) {
% delete $ARGS{'QuoteTransaction'};
-<& /Elements/MessageBox, Name => "UpdateContent", Default => $ARGS{'UpdateContent'}, %ARGS &>
+<& /Elements/MessageBox, Name => "UpdateContent", Default => $ARGS{'UpdateContent'}, IncludeSignature => 0, %ARGS &>
% } else {
<& /Elements/MessageBox, Name => "UpdateContent", %ARGS &>
% }
diff --git a/html/RTIR/Incident/Create.html b/html/RTIR/Incident/Create.html
index 6c8a38d..9cbc609 100644
--- a/html/RTIR/Incident/Create.html
+++ b/html/RTIR/Incident/Create.html
@@ -106,6 +106,7 @@ if ( $ChildObj && !$ChildObj->CurrentUserHasRight('ModifyTicket') ) {
<tr><td class="labeltop"><&|/l&>Message</&>:</td>
<td>
<%PERL>
+my $include_signature = 1;
unless ( exists $ARGS{'Content'} ) {
my $Transactions;
if ( $TicketObj ) {
@@ -121,9 +122,14 @@ unless ( exists $ARGS{'Content'} ) {
) || '';
$ARGS{'Content'} =~ s/\>/>/g;
}
+} else {
+ $include_signature = 0;
}
</%PERL>
-<& /Elements/MessageBox, Default => $ARGS{'Content'} &>
+<& /Elements/MessageBox,
+ Default => $ARGS{'Content'},
+ IncludeSignature => $include_signature,
+&>
</td></tr>
diff --git a/html/RTIR/Investigation/Elements/Create b/html/RTIR/Investigation/Elements/Create
index 06e1b31..3af49af 100644
--- a/html/RTIR/Investigation/Elements/Create
+++ b/html/RTIR/Investigation/Elements/Create
@@ -83,9 +83,11 @@ email addresses. These people <b>will</b> receive future updates.)</&></font></i
<td>
% $m->callback( %ARGS, MessageBoxName => $NamePrefix .'Content',
% CallbackPage => '/Ticket/Create.html', CallbackName => 'BeforeMessageBox' );
+% my $content = $value_cb->('Content');
<& /Elements/MessageBox,
Name => $NamePrefix .'Content',
- Default => $value_cb->('Content'),
+ Default => $content,
+ IncludeSignature => !$content,
QuoteTransaction => $value_cb->('QuoteTransaction'),
&></td></tr>
% }
diff --git a/html/RTIR/Tools/Lookup.html b/html/RTIR/Tools/Lookup.html
index 2e349c6..0100b80 100644
--- a/html/RTIR/Tools/Lookup.html
+++ b/html/RTIR/Tools/Lookup.html
@@ -254,8 +254,10 @@ if ( $q ) {
. "OR ContentType = 'text' "
. "OR ContentType = 'text/html' )"
. " AND Content LIKE '$q'";
+ # apply transaction date search only if it's FTS as otherwise
+ # it can ruin performance of mysql optimizer rather than help
+ $query = "( $query ) AND TransactionDate > '". $now->ISO ."'"
}
- $query = "( $query ) AND TransactionDate > '". $now->ISO ."'";
my ($val, $msg) = $session{'tickets'}->FromSQL( $query );
$RT::Logger->warning( $msg ) unless $val;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list