[Rt-commit] r5887 - in rt/branches/3.6-RELEASE: . html/Ticket/Elements lib/RT

jesse at bestpractical.com jesse at bestpractical.com
Fri Sep 8 16:50:51 EDT 2006


Author: jesse
Date: Fri Sep  8 16:50:50 2006
New Revision: 5887

Modified:
   rt/branches/3.6-RELEASE/   (props changed)
   rt/branches/3.6-RELEASE/etc/RT_Config.pm.in
   rt/branches/3.6-RELEASE/html/Ticket/Elements/LoadTextAttachments
   rt/branches/3.6-RELEASE/html/Ticket/Elements/ShowTransactionAttachments
   rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm

Log:
 r27290 at pinglin:  jesse | 2006-09-08 13:50:04 -0400
 Patch from Kevin Murphy to support the following features:
 
 # If $SuppressInlineTextFiles is set to a true value, then uploaded
 # text files (text-type attachments with file names) are prevented
 # from being displayed in-line when viewing a ticket's history.
 
 Set($SuppressInlineTextFiles, undef);
 
 # If $DontSearchFileAttachments is set to a true value, then uploaded
 # files (attachments with file names) are not searched during full-content
 # ticket searches.
 
 Set($DontSearchFileAttachments, undef);
  


Modified: rt/branches/3.6-RELEASE/etc/RT_Config.pm.in
==============================================================================
--- rt/branches/3.6-RELEASE/etc/RT_Config.pm.in	(original)
+++ rt/branches/3.6-RELEASE/etc/RT_Config.pm.in	Fri Sep  8 16:50:50 2006
@@ -479,6 +479,18 @@
    '<small>__LastUpdatedRelative__</small>',
    '<small>__TimeLeft__</small>'});
 
+# If $SuppressInlineTextFiles is set to a true value, then uploaded
+# text files (text-type attachments with file names) are prevented
+# from being displayed in-line when viewing a ticket's history.
+
+Set($SuppressInlineTextFiles, undef);
+
+# If $DontSearchFileAttachments is set to a true value, then uploaded
+# files (attachments with file names) are not searched during full-content
+# ticket searches.
+
+Set($DontSearchFileAttachments, undef);
+
 
 # }}}
 

Modified: rt/branches/3.6-RELEASE/html/Ticket/Elements/LoadTextAttachments
==============================================================================
--- rt/branches/3.6-RELEASE/html/Ticket/Elements/LoadTextAttachments	(original)
+++ rt/branches/3.6-RELEASE/html/Ticket/Elements/LoadTextAttachments	Fri Sep  8 16:50:50 2006
@@ -80,7 +80,9 @@
     $attachments->Limit ( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text/plain');
     $attachments->Limit ( FIELD => 'ContentType', OPERATOR => 'STARTSWITH', VALUE => 'message/');
     $attachments->Limit ( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text');
-
+    if ($RT::SuppressInlineTextFiles) {
+        $attachments->Limit ( FIELD => 'Filename', OPERATOR => 'IS', VALUE => 'NULL');
+    }
 }
 return ($attachments);
 </%INIT>

Modified: rt/branches/3.6-RELEASE/html/Ticket/Elements/ShowTransactionAttachments
==============================================================================
--- rt/branches/3.6-RELEASE/html/Ticket/Elements/ShowTransactionAttachments	(original)
+++ rt/branches/3.6-RELEASE/html/Ticket/Elements/ShowTransactionAttachments	Fri Sep  8 16:50:50 2006
@@ -95,6 +95,7 @@
 
     # If it's text
     if (   $message->ContentType =~ m{^(text|message)}i
+ 	&& !($RT::SuppressInlineTextFiles && $message->Filename)
         && $message->ContentLength <= $RT::MaxInlineBody )
     {
 

Modified: rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm	(original)
+++ rt/branches/3.6-RELEASE/lib/RT/Tickets_Overlay.pm	Fri Sep  8 16:50:50 2006
@@ -679,14 +679,36 @@
     $self->_OpenParen;
 
     #Search for the right field
-    $self->_SQLLimit(
-        ALIAS         => $self->{_sql_trattachalias},
-        FIELD         => $field,
-        OPERATOR      => $op,
-        VALUE         => $value,
-        CASESENSITIVE => 0,
-        @rest
-    );
+    if ($field eq 'Content' and $RT::DontSearchFileAttachments) {
+       $self->_SQLLimit(
+			ALIAS         => $self->{_sql_trattachalias},
+			FIELD         => 'Filename',
+			OPERATOR      => 'IS',
+			VALUE         => 'NULL',
+			SUBCLAUSE     => 'contentquery',
+			ENTRYAGGREGATOR => 'AND',
+		       );
+       $self->_SQLLimit(
+			ALIAS         => $self->{_sql_trattachalias},
+			FIELD         => $field,
+			OPERATOR      => $op,
+			VALUE         => $value,
+			CASESENSITIVE => 0,
+			@rest,
+			ENTRYAGGREGATOR => 'AND',
+			SUBCLAUSE     => 'contentquery',
+		       );
+    } else {
+       $self->_SQLLimit(
+			ALIAS         => $self->{_sql_trattachalias},
+			FIELD         => $field,
+			OPERATOR      => $op,
+			VALUE         => $value,
+			CASESENSITIVE => 0,
+			ENTRYAGGREGATOR => 'AND',
+			@rest
+		       );
+    }
 
     $self->_SQLJoin(
         ALIAS1 => $self->{_sql_trattachalias},


More information about the Rt-commit mailing list