Revision 485

Date:
2015/03/05 14:45:04
Author:
ahitrov
Revision Log:
Data encoding for extra_fields

Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/tag/comps/contenido/components/outputs/tagset.msn

     
    24 24 my ($prop) = grep { $_->{attr} eq $name } $object->structure;
    25 25 return undef if exists $prop->{virtual} && $prop->{virtual};
    26 26 my $class = $object->class;
    27 my $is_extra = grep { ref $_ && $_->{attr} eq $name } $class->extra_properties ? 1 : 0;
    27 my $is_extra = scalar( grep { ref $_ && $_->{attr} eq $name } $class->class_table->required_properties ) ? 0 : 1;
    28 28
    29 29 my $result;
    30 30 my @tags;
     
    38 38 if ( @tags ) {
    39 39 $result = [];
    40 40 foreach my $tag ( @tags ) {
    41 push @$result, { id => $tag->id, name => Encode::decode('utf-8', $tag->name) };
    41 push @$result, { id => $tag->id, name => $is_extra ? $tag->name : Encode::decode('utf-8', $tag->name) };
    42 42 }
    43 unless ( $is_extra ) {
    44 $result = Encode::encode('utf-8', $json->encode( $result ));
    45 }
    43 46 }
    44 unless ( $is_extra ) {
    45 $result = Encode::encode('utf-8', $json->encode( $result ));
    46 }
    47 47 warn Dumper $result if $DEBUG;
    48 48 return $result;
    49 49 } else {