[Rt-commit] r10645 - in rt/branches/3.999-DANGEROUS: docs/design_docs lib/RT/Interface lib/RT/Model

ruz at bestpractical.com ruz at bestpractical.com
Thu Jan 31 21:26:07 EST 2008


Author: ruz
Date: Thu Jan 31 21:26:04 2008
New Revision: 10645

Modified:
   rt/branches/3.999-DANGEROUS/docs/design_docs/3.3-schema-redesign.txt
   rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm
   rt/branches/3.999-DANGEROUS/lib/RT/Record.pm

Log:
* LargeContent

Modified: rt/branches/3.999-DANGEROUS/docs/design_docs/3.3-schema-redesign.txt
==============================================================================
--- rt/branches/3.999-DANGEROUS/docs/design_docs/3.3-schema-redesign.txt	(original)
+++ rt/branches/3.999-DANGEROUS/docs/design_docs/3.3-schema-redesign.txt	Thu Jan 31 21:26:04 2008
@@ -33,9 +33,9 @@
   sort_order integer NOT NULL DEFAULT 0  ,   -- New: for Repeated fields
 
   Content varchar(255) NULL  ,
-  LargeContent LONGTEXT NULL,               -- New: data longer than 255 bytes
-  content_type varchar(80) NULL,             -- New: MIME type of LargeContent
-  content_encoding varchar(80) NULL  ,       -- New: for binary LargeContent
+  large_content LONGTEXT NULL,               -- New: data longer than 255 bytes
+  content_type varchar(80) NULL,             -- New: MIME type of large_content
+  content_encoding varchar(80) NULL  ,       -- New: for binary large_content
   disabled int2 NOT NULL DEFAULT 0 ,        -- New: whether this is deleted
 )
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm	Thu Jan 31 21:26:04 2008
@@ -1402,7 +1402,7 @@
 
 Takes a CGI parameter name; if a file is uploaded under that name,
 return a hash reference suitable for AddCustomFieldValue's use:
-C<( value => $filename, LargeContent => $content, content_type => $type )>.
+C<( value => $filename, large_content => $content, content_type => $type )>.
 
 Returns C<undef> if no files were uploaded in the C<$arg> field.
 
@@ -1420,7 +1420,7 @@
 
     return {
         value        => $filename,
-        LargeContent => do { local $/; scalar <$fh> },
+        large_content => do { local $/; scalar <$fh> },
         content_type  => $upload_info->{'Content-Type'},
     };
 }

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomField.pm	Thu Jan 31 21:26:04 2008
@@ -933,7 +933,7 @@
 
 Optional:
 
-    LargeContent
+    large_content
     content_type
 
 =cut
@@ -943,7 +943,7 @@
     my %args = (
         object       => undef,
         Content      => undef,
-        LargeContent => undef,
+        large_content => undef,
         content_type  => undef,
         @_
     );
@@ -986,7 +986,7 @@
         object_type  => ref($obj),
         object_id    => $obj->id,
         Content      => $args{'Content'},
-        LargeContent => $args{'LargeContent'},
+        large_content => $args{'large_content'},
         content_type  => $args{'content_type'},
         custom_field  => $self->id
     );

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldValue.pm	Thu Jan 31 21:26:04 2008
@@ -60,7 +60,7 @@
     column
         content_type => type is 'varchar(80)',
         max_length is 80, default is '';
-    column LargeContent => type is 'longtext', default is '';
+    column large_content => type is 'longtext', default is '';
     column Creator => type is 'int(11)', max_length is 11, default is '0';
     column object_id => type is 'int(11)', max_length is 11, default is '0';
     column
@@ -101,26 +101,26 @@
         object_id       => 0,
         disabled        => 0,
         Content         => '',
-        LargeContent    => undef,
+        large_content    => undef,
         content_type     => '',
         content_encoding => '',
         @_,
     );
 
     if ( defined $args{'Content'} && length( $args{'Content'} ) > 255 ) {
-        if ( defined $args{'LargeContent'} && length $args{'LargeContent'} ) {
+        if ( defined $args{'large_content'} && length $args{'large_content'} ) {
             Jifty->log->error(
-                "Content is longer than 255 and LargeContent specified");
+                "Content is longer than 255 and large_content specified");
         } else {
-            $args{'LargeContent'} = $args{'Content'};
+            $args{'large_content'} = $args{'Content'};
             $args{'Content'}      = '';
             $args{'content_type'} ||= 'text/plain';
         }
     }
 
-    ( $args{'content_encoding'}, $args{'LargeContent'} )
-        = $self->_encode_lob( $args{'LargeContent'}, $args{'content_type'} )
-        if defined $args{'LargeContent'};
+    ( $args{'content_encoding'}, $args{'large_content'} )
+        = $self->_encode_lob( $args{'large_content'}, $args{'content_type'} )
+        if defined $args{'large_content'};
 
     return $self->SUPER::create(
         custom_field     => $args{'custom_field'},
@@ -128,7 +128,7 @@
         object_id       => $args{'object_id'},
         disabled        => $args{'disabled'},
         Content         => $args{'Content'},
-        LargeContent    => $args{'LargeContent'},
+        large_content    => $args{'large_content'},
         content_type     => $args{'content_type'},
         content_encoding => $args{'content_encoding'},
     );
@@ -137,7 +137,7 @@
 sub large_content {
     my $self = shift;
     return $self->_decode_lob( $self->content_type, $self->content_encoding,
-        $self->_value( 'LargeContent', decode_utf8 => 0 ) );
+        $self->_value( 'large_content', decode_utf8 => 0 ) );
 }
 
 =head2 LoadByTicketContentAndCustomField { Ticket => TICKET, custom_field => customfield, Content => CONTENT }
@@ -187,7 +187,7 @@
 =head2 Content
 
 Return this custom field's content. If there's no "regular"
-content, try "LargeContent"
+content, try "large_content"
 
 =cut
 

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Ticket.pm	Thu Jan 31 21:26:04 2008
@@ -647,7 +647,7 @@
         {
             next unless defined $value && length $value;
 
-            # Allow passing in uploaded LargeContent etc by hash reference
+            # Allow passing in uploaded large_content etc by hash reference
             my ( $status, $msg ) = $self->add_custom_field_value(
                 (   UNIVERSAL::isa( $value => 'HASH' )
                     ? %$value

Modified: rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Record.pm	(original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Record.pm	Thu Jan 31 21:26:04 2008
@@ -1395,7 +1395,7 @@
     my %args = (
         Field              => undef,
         Value              => undef,
-        LargeContent       => undef,
+        large_content       => undef,
         content_type        => undef,
         record_transaction => 1,
         @_
@@ -1434,7 +1434,7 @@
     }
 
     # empty string is not correct value of any CF, so undef it
-    foreach (qw(Value LargeContent)) {
+    foreach (qw(Value large_content)) {
         $args{$_} = undef if defined $args{$_} && !length $args{$_};
     }
 
@@ -1498,10 +1498,10 @@
             }
             if ($is_the_same) {
                 my $old_content = $old_value->large_content;
-                if ( defined $args{'LargeContent'} ) {
+                if ( defined $args{'large_content'} ) {
                     $is_the_same = 0
                         unless defined $old_content
-                            && $old_content eq $args{'LargeContent'};
+                            && $old_content eq $args{'large_content'};
                 } else {
                     $is_the_same = 0 if defined $old_content;
                 }
@@ -1513,7 +1513,7 @@
         my ( $new_value_id, $value_msg ) = $cf->add_value_for_object(
             object       => $self,
             Content      => $args{'Value'},
-            LargeContent => $args{'LargeContent'},
+            large_content => $args{'large_content'},
             content_type  => $args{'content_type'},
         );
 
@@ -1564,7 +1564,7 @@
         my ( $new_value_id, $msg ) = $cf->add_value_for_object(
             object       => $self,
             Content      => $args{'Value'},
-            LargeContent => $args{'LargeContent'},
+            large_content => $args{'large_content'},
             content_type  => $args{'content_type'},
         );
 


More information about the Rt-commit mailing list