[Rt-commit] r2418 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: .
lib/RT
jesse at bestpractical.com
jesse at bestpractical.com
Mon Mar 14 02:58:13 EST 2005
Author: jesse
Date: Mon Mar 14 02:58:12 2005
New Revision: 2418
Modified:
rt/branches/PLATANO-EXPERIMENTAL-CSS/ (props changed)
rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/ObjectCustomFieldValue_Overlay.pm
Log:
r8578 at hualien: jesse | 2005-03-14 02:41:05 -0500
r8465 at hualien: jesse | 2005-03-14 02:25:15 -0500
r4672 at hualien: jesse | 2005-02-10 16:19:40 -0500
Fixes to handle large text custom fields gracefully
Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/ObjectCustomFieldValue_Overlay.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/ObjectCustomFieldValue_Overlay.pm (original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/ObjectCustomFieldValue_Overlay.pm Mon Mar 14 02:58:12 2005
@@ -62,7 +62,19 @@
ContentEncoding => '',
@_);
- ($args{'ContentEncoding'}, $args{'LargeContent'}) = $self->_EncodeLOB($args{'LargeContent'}, $args{'ContentType'}) if ($args{'LargeContent'});
+
+
+ if( $args{'Content'} && length($args{'Content'}) > 255 && !$args{'LargeContent'} ) {
+
+ $args{'LargeContent'} = $args{'Content'};
+ $args{'Content'} = '';
+ $args{'ContentType'} = 'text/plain';
+ }
+
+ ( $args{'ContentEncoding'}, $args{'LargeContent'} ) =
+ $self->_EncodeLOB( $args{'LargeContent'}, $args{'ContentType'} )
+ if ( $args{'LargeContent'} );
+
$self->SUPER::Create(
CustomField => $args{'CustomField'},
ObjectType => $args{'ObjectType'},
@@ -134,6 +146,25 @@
}
+
+=head2 Content
+
+Return this custom field's content. If there's no "regular"
+content, try "LargeContent"
+
+=cut
+
+
+sub Content {
+ my $self = shift;
+ my $content = $self->SUPER::Content();
+ if (!$content && $self->ContentType eq 'text/plain') {
+ $content = $self->LargeContent();
+ }
+ return($content);
+}
+
+
sub Delete {
my $self = shift;
$self->SetDisabled(1);
More information about the Rt-commit
mailing list