I would like to warn the user before dropping a large attachment and
give them the opportunity to make a different selection.
I saw this in an earlier email (dated 2006-02-24 from Eric Shultz
"TruncateLongAttachments …"), where he had modified the RT code to do
just that. I’ve been attempting to do the same thing in Update.html,
but failing. I can’t seem to determine the filesize with the
information at hand. Can anyone point me in the right direction? Or is
Update.html not the place to be making these changes?
We’re using RT3.4.4
Karen Nyenhuis
I would like to warn the user before dropping a large attachment and
give them the opportunity to make a different selection.
I saw this in an earlier email (dated 2006-02-24 from Eric Shultz
“TruncateLongAttachments …”), where he had modified the RT
code to do
just that. I’ve been attempting to do the same thing in Update.html,
but failing. I can’t seem to determine the filesize with the
information at hand. Can anyone point me in the right
direction? Or is
Update.html not the place to be making these changes?
Hi Karen. Unfortunately, I’ve made a bunch of other changes to the
3.4.x code, so I can’t easily provide you with just a simple patch.
What I can provide is the code I added for this functionality, however,
and at about what point in the file share/html/Ticket/Update.html.
Note, however, that I did not set TruncateLongAttachments in
RT_SiteConfig.pm, I set DropLongAttachments to 1. Here are my changes:
#1:
<& /Ticket/Elements/Tabs,
Ticket => $TicketObj,
Title=> $title &>
- <& /Elements/ListActions, actions => @Actions &>
#2:
<%INIT>
my $CanRespond = 0;
my $CanComment = 0;
my $title;
#3:
$session{‘Attachments’} = { %{$session{‘Attachments’} || {}},
$ARGS{‘Attach’} => $attachment };
-
my $latest_attach = $ARGS{'Attach'};
-
# Check the length of all attachments put together, compensating
-
# for encoding overhead (* .75) like is done elsewhere in the
code.
${$session{‘Attachments’}}{$key}->stringify_body );
-
$total_length += int($length * .75 / 1024);
-
}
-
# If the total of all attachments exceeds the RT config parameter,
-
# and we're told to drop long attachments, drop all of them.
-
# But still allow a message update.
-
my $maxsize = int($RT::MaxAttachmentSize * .75 / 1024);
-
if ($total_length > $maxsize and $RT::DropLongAttachments) {
-
$RT::Logger->warning( "Exceeded maximum attachment size. Total
length: ${total_length}k (max: ${maxsize}k)" );
size of all attachments (${total_length}k) would exceed limit
(${maxsize}k)" );
only the latest one that tipped the scales
page
Let me know how that works for you.
Eric Schultz
United Online, Inc.
I would like to warn the user before dropping a large
attachment and
give them the opportunity to make a different selection.
I saw this in an earlier email (dated 2006-02-24 from Eric Shultz
“TruncateLongAttachments …”), where he had modified the RT
code to do
just that. I’ve been attempting to do the same thing in
Update.html,
but failing. I can’t seem to determine the filesize with the
information at hand. Can anyone point me in the right
direction? Or is
Update.html not the place to be making these changes?
Hi Karen. Unfortunately, I’ve made a bunch of other changes to the
3.4.x code, so I can’t easily provide you with just a simple patch.
What I can provide is the code I added for this
functionality, however,
and at about what point in the file share/html/Ticket/Update.html.
Note, however, that I did not set TruncateLongAttachments in
RT_SiteConfig.pm, I set DropLongAttachments to 1. Here are
my changes:
#1:
<& /Ticket/Elements/Tabs,
Ticket => $TicketObj,
Title=> $title &>
- <& /Elements/ListActions, actions => @Actions &>
-
#2:
<%INIT>
my $CanRespond = 0;
my $CanComment = 0;
my $title;
#3:
$session{'Attachments'} = { %{$session{'Attachments'} || {}},
$ARGS{'Attach'} => $attachment };
-
my $latest_attach = $ARGS{'Attach'};
-
# Check the length of all attachments put together, compensating
-
# for encoding overhead (* .75) like is done elsewhere in the
code.
${$session{‘Attachments’}}{$key}->stringify_body );
parameter,
-
# and we're told to drop long attachments, drop all of them.
-
# But still allow a message update.
-
my $maxsize = int($RT::MaxAttachmentSize * .75 / 1024);
-
if ($total_length > $maxsize and $RT::DropLongAttachments) {
-
$RT::Logger->warning( "Exceeded maximum attachment size. Total
length: ${total_length}k (max: ${maxsize}k)" );
uploaded: total
size of all attachments (${total_length}k) would exceed limit
(${maxsize}k)" );
only the latest one that tipped the scales
page
Let me know how that works for you.
Eric Schultz
United Online, Inc.
I neglected to mention that I also do pretty much the same thing in
Create.html, so people can’t make a ticket with too large of an
attachment. The only difference is I have a commitme flag:
my $commitme = 1;
If the $total_length exceeds $maxsize, I set $commitme = 0, then later I
have this:
if ( $commitme and (!exists $ARGS{‘AddMoreAttach’}) && ($ARGS{‘id’} eq
‘new’)) {
So I don’t go to Display.html yet (giving them another opportunity to
attach something smaller).
Eric Schultz
United Online, Inc.
Thanks Eric for all your help. Worked great.
Karen
Schultz, Eric wrote:
I would like to warn the user before dropping a large
attachment and
give them the opportunity to make a different selection.
I saw this in an earlier email (dated 2006-02-24 from Eric Shultz
"TruncateLongAttachments .."), where he had modified the RT
code to do
just that. I've been attempting to do the same thing in
Update.html,
but failing. I can't seem to determine the filesize with the
information at hand. Can anyone point me in the right
direction? Or is
Update.html not the place to be making these changes?
Hi Karen. Unfortunately, I've made a bunch of other changes to the
3.4.x code, so I can't easily provide you with just a simple patch.
What I can provide is the code I added for this
functionality, however,
and at about what point in the file share/html/Ticket/Update.html.
Note, however, that I did not set TruncateLongAttachments in
RT_SiteConfig.pm, I set DropLongAttachments to 1. Here are
my changes:
#1:
<& /Ticket/Elements/Tabs,
Ticket => $TicketObj,
Title=> $title &>
- <& /Elements/ListActions, actions => @Actions &>
<FORM ACTION=“Update.html” NAME=“TicketUpdate”
METHOD=POST enctype=“multipart/form-data”>
<input type=“hidden” name=“QuoteTransaction” value=“<%
$ARGS{QuoteTransaction} %>”>
#2:
<%INIT>
my $CanRespond = 0;
my $CanComment = 0;
my $title;
#3:
$session{‘Attachments’} = { %{$session{‘Attachments’} || {}},
$ARGS{‘Attach’} => $attachment };
-
my $latest_attach = $ARGS{'Attach'};
-
# Check the length of all attachments put together, compensating
-
# for encoding overhead (* .75) like is done elsewhere in the
code.
${$session{‘Attachments’}}{$key}->stringify_body );
parameter,
-
# and we're told to drop long attachments, drop all of them.
-
# But still allow a message update.
-
my $maxsize = int($RT::MaxAttachmentSize * .75 / 1024);
-
if ($total_length > $maxsize and $RT::DropLongAttachments) {
-
$RT::Logger->warning( "Exceeded maximum attachment size. Total
length: ${total_length}k (max: ${maxsize}k)" );
uploaded: total
size of all attachments (${total_length}k) would exceed limit
(${maxsize}k)" );
only the latest one that tipped the scales
page
Let me know how that works for you.
Eric Schultz
United Online, Inc.
I neglected to mention that I also do pretty much the same thing in
Create.html, so people can’t make a ticket with too large of an
attachment. The only difference is I have a commitme flag:
my $commitme = 1;
If the $total_length exceeds $maxsize, I set $commitme = 0, then later I
have this:
if ( $commitme and (!exists $ARGS{‘AddMoreAttach’}) && ($ARGS{‘id’} eq
‘new’)) {
So I don’t go to Display.html yet (giving them another opportunity to
attach something smaller).
Eric Schultz
United Online, Inc.
Hi,
I need the changes made to Create.html to notify users that the attachment
has not been added because it exceeds the Max size.
Thanks in advance.
For the Update.html, I used the code from Eric Shultz and it works fine.
My RT version is 3.8.1
Best regards.
Please Help.2009/6/11 samir marhoum samir.marhoum@gmail.com
Hi,
I need the changes made to Create.html to notify users that the attachment
has not been added because it exceeds the Max size.
Thanks in advance.
For the Update.html, I used the code from Eric Shultz and it works fine.
My RT version is 3.8.1
Best regards.
Hi,
Can anyone answer my request ? please.