[rt-users] Don't display attachments

Schultz, Eric ESchultz at corp.untd.com
Mon Apr 3 11:59:46 EDT 2006


> -----Original Message-----
> From: rt-users-bounces at lists.bestpractical.com 
> [mailto:rt-users-bounces at lists.bestpractical.com] On Behalf 
> Of Ruslan Zakirov
> Sent: Monday, April 03, 2006 3:25 AM
> To: Lewis Bergman
> Cc: rt-users at lists.bestpractical.com
> Subject: Re: [rt-users] Don't display attachments
> 
> On 4/3/06, Lewis Bergman <lbergman at wtxs.net> wrote:
> > RT-3.4.4
> > I have read the RT book, config files, and perused the list. This
> > message: 
> http://www.gossamer-threads.com/lists/rt/users/36052 details my
> > same question but there was no response.
> >
> > I am looking for a way to get rt to upload an attachment, 
> note that an
> > attachment is there, but not display the attachment in line. Did I
> > overlook a config var or do I need a script or maybe modify 
> a template
> > somewhere.
> 
> Yep, it's a problem in RT code and require fix, patches are 
> really welcome.
> 
> > --
> > Lewis Bergman
> > Texas Communications
> > 4309 Maple St.
> > Abilene, TX 79602-8044
> > Off. 325-691-3301
> > Cell 325-439-0533
> > fax  325-695-6841
> 
> --
> Best regards, Ruslan.

In share/html/Ticket/Elements/ShowTransactionAttachments, here are the
changes I made:

----------------------------------
@@ -138,13 +138,13 @@

             # if it's a text/html clean the body and show it
             if ( $message->ContentType =~ m{^text/(?:html|enriched)$}i
) {
-                $content =
-                  $m->comp( '/Elements/ScrubHTML', Content => $content
);
-                $m->out($content);
+#                $content =
+#                  $m->comp( '/Elements/ScrubHTML', Content => $content
);
+#                $m->out($content);
             }

             # if it's a text/plain show the body
-            elsif ( $message->ContentType =~ m{^(text|message|text)}i )
{
+            elsif ( $message->ContentType =~ m{^(text|message|text)}i
and not $message->Filename ) {
----------------------------------

Your line numbers may vary, as I had made about 5 or so revisions before
this.  Basically, I just commented out those three lines of code that
scrub and print HTML, and later, I said to only print out something that
doesn't have a "filename", which makes sense - anything that is a reply
or comment won't have a filename, anything that is uploaded as an
attachment will.  I'm just now noticing that the code above is
redundant, since I don't do anything in the first block.  So the
following should be able to replace all of the above:

----------------------------------
# only show content inline that isn't an attachment
           if ( $message->ContentType =~ m{^(text|message|text)}i and
not $message->Filename ) {

                eval { $content = Text::Quoted::extract($content); };
                if ($@) { 1; }

                $m->comp(
                    'ShowMessageStanza',
                    Depth       => 0,
                    Message     => $content,
                    Transaction => $Transaction
                 );
            }
----------------------------------

Also, earlier in my revisions, I had disabled inline images by
commenting out this code:

----------------------------------
#    elsif ( $message->ContentType =~ /^image\//i ) {
#        $m->out('<img src="'
#              . $AttachPath . '/'
#              . $Transaction->Id . '/'
#              . $message->Id
#              . '/">' );
#    }
----------------------------------


Eric Schultz
United Online



More information about the rt-users mailing list