Revision 225

Date:
2012/06/27 17:59:40
Author:
ahitrov
Revision Log:
Serialize

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/core/comps/contenido/components/clone_attachments.msn

     
    14 14 return unless ref $object;
    15 15 return unless ref $source;
    16 16
    17 local $Data::Dumper::Indent = 0;
    18 17 my @properties = $source->structure();
    19 18 for (0..$#properties) {
    20 19 my $prop = $properties[$_];
     
    91 90 }
    92 91 }
    93 92 }
    94 $object->$name(Dumper($img));
    93 $object->$name( $object->_serialize($img) );
    95 94 warn "\nClone img complete: ".Dumper($img)."\n" if $DEBUG;
    96 95 }
    97 96 } elsif ( $prop->{type} eq 'images' ) {
     
    151 150 }
    152 151 if ( $attachment->{maxnumber} ) {
    153 152 $PICTURE->{maxnumber} = $attachment->{maxnumber};
    154 $object->$name(Dumper($PICTURE));
    153 $object->$name( $object->_serialize($PICTURE) );
    155 154 }
    156 155 warn "\nClone pics complete: ".Dumper($PICTURE)."\n" if $DEBUG;
    157 156 } elsif ( $prop->{type} eq 'multimedia_new' ) {
     
    168 167 atext => $attachment->{atext}
    169 168 };
    170 169 }
    171 $object->$name(Dumper($img));
    170 $object->$name( $object->_serialize($img) );
    172 171 warn "\nClone binary complete: ".Dumper($img)."\n" if $DEBUG;
    173 172 }
    174 173 }
  • utf8/core/comps/contenido/components/outputs/checkbox_fields.msn

     
    1 1 <%args>
    2 2
    3 $name => undef
    4 $SETS => undef
    3 $name => undef
    4 $SETS => undef
    5 $object => undef
    5 6
    6 7 </%args>
    7 8 <%init>
     
    18 19 $FIELDS->{$name.'_'.$1}->{rusname} = $m->comp('/contenido/components/filter.msn', str => $SETS->{$element});
    19 20 }
    20 21 }
    21 {
    22 local $Data::Dumper::Indent = 0;
    23 return Data::Dumper::Dumper($FIELDS);
    24 }
    22 return $object->_serialize($FIELDS);
    25 23
    26 24 </%init>
  • utf8/core/comps/contenido/components/outputs/hash.msn

     
    1 1 <%args>
    2 $name => undef
    3 $SETS => undef
    2
    3 $name => undef
    4 $SETS => undef
    5 $object => undef
    6
    4 7 </%args>
    5 8
    6 9 <%init>
    7 return undef if (! ref($SETS));
    8 return undef if (! $name);
    9 10
    10 my $FIELDS = {};
    11 while (my ($element,$value)=each %{$SETS}) {
    12 if ($element =~ /^${name}_key_(\d+)$/ && $SETS->{"${name}_value_$1"}) {
    13 $FIELDS->{$value}=$SETS->{"${name}_value_$1"};
    14 }
    15 }
    16 {
    17 local $Data::Dumper::Indent = 0;
    18 return Data::Dumper::Dumper($FIELDS);
    19 }
    11 return undef if (! ref($SETS));
    12 return undef if (! $name);
    13
    14 my $FIELDS = {};
    15 while (my ($element,$value)=each %{$SETS}) {
    16 if ($element =~ /^${name}_key_(\d+)$/ && $SETS->{"${name}_value_$1"}) {
    17 $FIELDS->{$value}=$SETS->{"${name}_value_$1"};
    18 }
    19 }
    20 return $object->_serialize($FIELDS);
    21
    20 22 </%init>
  • utf8/core/comps/contenido/components/outputs/pickup_multi.msn

     
    30 30 }
    31 31 }
    32 32 }
    33 warn "\n\nPickup form ($name)".Dumper(\%ids)."\n";
    33 warn "\n\nPickup form ($name)".Dumper(\%ids)."\n" if $DEBUG;
    34 34 my @ids = map { $_->{id} } grep { !exists $_->{delete} } values %ids;
    35 warn "What to leave ($name)".Dumper(\@ids)."\n\n";
    35 warn "What to leave ($name)".Dumper(\@ids)."\n\n" if $DEBUG;
    36 36
    37 37 return \@ids;
    38 38
  • utf8/core/comps/contenido/components/outputs/select_fields.msn

     
    1 1 <%args>
    2 2
    3 $name => undef
    4 $SETS => undef
    3 $name => undef
    4 $SETS => undef
    5 $object => undef
    5 6
    6 7 </%args>
    7 8 <%init>
     
    10 11 return undef if (! $name);
    11 12
    12 13 my $FIELDS = {};
    13 for my $element (%{ $SETS })
    14 {
    14 for my $element (%{ $SETS }) {
    15 15 if ($element =~ /^${name}_(\d+)\.selectrusname$/)
    16 16 {
    17 17 $FIELDS->{$name.'_'.$1} = {} if (! exists($FIELDS->{$name.'_'.$1}));
     
    25 25 $FIELDS->{$name.'_'.$1}->{values} = \@values;
    26 26 }
    27 27 }
    28 {
    29 local $Data::Dumper::Indent = 0;
    30 return Data::Dumper::Dumper($FIELDS);
    31 }
    28 return $object->_serialize($FIELDS);
    32 29
    33 30 </%init>
  • utf8/core/comps/contenido/components/set_image.msn

     
    1 <%once>
    2
    3 use IO::File;
    4
    5 </%once>
    1 6 <%args>
    2 7
    3 $SETS => undef
    4 $field => undef
    5 $default => undef
    6 $object => undef
    7 $prop => undef
    8 $SETS => undef
    9 $field => undef
    10 $default=> undef
    11 $object => undef
    12 $prop => undef
    8 13
    9 14 </%args>
    10
    11 15 <%init>
    12 use IO::File;
    13 use Data::Dumper;
    14 16
    15 17 return undef unless defined $SETS and defined $field;
    16 18
  • utf8/core/comps/contenido/components/set_properties.msn

     
    42 42 $IMAGE = ref $IMAGE ? $IMAGE : {};
    43 43 $IMAGE = $m->comp('/contenido/components/set_image.msn', default=>$IMAGE, field=>$name, SETS=>$SETS, object=>$object, prop => $prop);
    44 44 if ( exists $IMAGE->{filename} ) {
    45 local $Data::Dumper::Indent = 0;
    46 $object->$name( Data::Dumper::Dumper($IMAGE) );
    45 $object->$name( $object->_serialize($IMAGE) );
    47 46 }
    48 47 }
    49 48
     
    79 78 };
    80 79 $IMAGE = $m->comp('/contenido/components/set_image.msn', default=>$IMAGE, field=>$partname, SETS=>$SETS, object=>$object, prop => $prop);
    81 80 if (exists($IMAGE->{filename})) {
    82 local $Data::Dumper::Indent = 0;
    83 81 $IMAGE->{number} = $number;
    84 82 $IMAGES->{'image_'.$number} = $IMAGE;
    85 83 $IMAGES->{maxnumber} = $number if ($number > $IMAGES->{maxnumber});
     
    94 92 $maxnumber = $_ if exists $IMAGES->{"image_$_"} && $_ > $maxnumber;
    95 93 }
    96 94 $IMAGES->{maxnumber} = $maxnumber;
    97 local $Data::Dumper::Indent = 0;
    98 $object->$name( Data::Dumper::Dumper($IMAGES) );
    95 $object->$name( $object->_serialize($IMAGES) );
    99 96 }
    100 97
    101 98 } elsif ( $prop->{type} eq 'multimedia' ) {
     
    117 114 $MULTI = $m->comp('/contenido/components/set_multi.msn', default=>$MULTI, field=>$name, SETS=>$SETS, object=>$object);
    118 115 if (exists($MULTI->{filename}))
    119 116 {
    120 local $Data::Dumper::Indent = 0;
    121 $object->{$name} = Data::Dumper::Dumper($MULTI);
    117 $object->$name ( $object->_serialize($MULTI) );
    122 118 }
    123 119 }
    124 120
     
    141 137 $MULTI = $m->comp('/contenido/components/set_multimedia_new.msn', default=>$MULTI, field=>$name, SETS=>$SETS, object=>$object, prop => $prop);
    142 138 if (exists($MULTI->{filename}))
    143 139 {
    144 local $Data::Dumper::Indent = 0;
    145 $object->{$name} = Data::Dumper::Dumper($MULTI);
    140 $object->$name( $object->_serialize($MULTI) );
    146 141 }
    147 142 }
    148 143
     
    169 164 $MULTI = $m->comp('/contenido/components/set_audio.msn', default=>$MULTI, field=>$name, SETS=>$SETS, object=>$object, prop => $prop);
    170 165 if (exists($MULTI->{filename}))
    171 166 {
    172 local $Data::Dumper::Indent = 0;
    173 $object->{$name} = Data::Dumper::Dumper($MULTI);
    167 $object->$name( $object->_serialize($MULTI) );
    174 168 }
    175 169 }
    176 170