Revision 56

Date:
2010/09/09 12:10:20
Author:
ahitrov@rambler.ru
Revision Log:
Удаление аттачей по структуре вложения
Бага с кропом без кропа
Протаскивается класс параграфа в text_format
Files:

Legend:

 
Added
 
Removed
 
Modified
  • koi8/core/comps/contenido/components/set_image.msn

     
    101 101 if (length $result > 0) {
    102 102 print "Contenido Error: ��� ������ '$c_line' ��������� ������ '$result' ($@)\n";
    103 103 }
    104 } else {
    105 my $c_line = "cp $filename_tmp.$extension $filename_tmp.shaved.$extension";
    106 my $result = `$c_line`;
    107 if (length $result > 0) {
    108 print "Contenido Error: ��� ������ '$c_line' ��������� ������ '$result' ($@)\n";
    109 }
    104 110 }
    105 111
    106 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'!\' -quality 80 '.$filename_tmp.'.shaved.'.$extension.' '.$filename_tmp.'.'.$suffix.'.'.$extension;
    107 my $result = `$c_line`;
    112 my $c_line = $state->{'convert_binary'}.' -geometry \''.$suffix.'!\' -quality 80 '.$filename_tmp.'.shaved.'.$extension.' '.$filename_tmp.'.'.$suffix.'.'.$extension;
    113 my $result = `$c_line`;
    108 114
    109 if (length $result > 0) {
    110 warn 'Contenido Error: ��� ������ "'.$c_line.'" ��������� ������ "'.$result.'" ('.$@.")\n";
    111 return undef;
    112 }
    115 if (length $result > 0) {
    116 warn 'Contenido Error: ��� ������ "'.$c_line.'" ��������� ������ "'.$result.'" ('.$@.")\n";
    117 return undef;
    118 }
    113 119 @{$IMAGE->{'mini'}{$suffix}}{'filename', 'width', 'height'} = (
    114 120 $filename.'.'.$suffix.'.'.$extension,
    115 121 Image::Size::imgsize($filename_tmp.'.'.$suffix.'.'.$extension),
  • koi8/core/comps/inc/text_format.msn

     
    6 6 $text => undef
    7 7 $imagefield => 'pictures'
    8 8 $imageclass => ''
    9 $pclass => undef
    9 10 $rel => undef
    10 11 $target => undef
    11 12 $onclick => undef
     
    18 19 my $body = $text || $doc->$field;
    19 20 $body =~ s/\r//sgi;
    20 21 $body =~ s/[\n\t\ ]*$//sgi;
    22 $pclass = $pclass ? ' class="'.$pclass.'"' : '';
    21 23 if ($body !~ /(<br|<p)/i) {
    22 24 $body =~ s/([^\n])\n([^\n])/$1<br>\n$2/gi;
    23 $body =~ s/\n{2,}/<\/p>\n\n<p>/gi;
    25 $body =~ s/\n{2,}/<\/p>\n\n<p$pclass>/gi;
    24 26 }
    25 27 $body =~ s/\[br\]/<br>/gi;
    26 28 if ( ref $doc ) {
  • koi8/core/lib/Contenido/Object.pm

     
    612 612 if ( ref $att && exists $att->{filename} && $att->{filename} ) {
    613 613 Contenido::File::remove( $att->{filename} );
    614 614 }
    615 if ( exists $prop->{preview} && exists $att->{mini} ) {
    616 if ( ref $prop->{preview} eq 'ARRAY' ) {
    617 foreach my $size ( @{ $prop->{preview} } ) {
    618 if ( exists $att->{mini}{$size}{filename} && $att->{mini}{$size}{filename} ) {
    619 Contenido::File::remove( $att->{mini}{$size}{filename} );
    620 }
    615 if ( exists $att->{mini} && ref $att->{mini} eq 'HASH' ) {
    616 Contenido::File::remove( $att->{mini}{filename} ) if exists $att->{mini}{filename};
    617 foreach my $val ( values %{ $att->{mini} } ) {
    618 if ( ref $val && exists $val->{filename} && $val->{filename} && ($val->{filename} ne $att->{mini}{filename}) ) {
    619 Contenido::File::remove( $val->{filename} );
    621 620 }
    622 } else {
    623 Contenido::File::remove( $att->{mini}{filename} );
    624 621 }
    625 622 }
    626 623
     
    631 628 if ( ref $img && exists $img->{filename} && $img->{filename} ) {
    632 629 Contenido::File::remove( $img->{filename} );
    633 630 }
    634 if ( exists $prop->{preview} && exists $img->{mini} ) {
    635 if ( ref $prop->{preview} eq 'ARRAY' ) {
    636 foreach my $size ( @{ $prop->{preview} } ) {
    637 if ( exists $img->{mini}{$size}{filename} && $img->{mini}{$size}{filename} ) {
    638 Contenido::File::remove( $img->{mini}{$size}{filename} );
    639 }
    631 if ( exists $img->{mini} && ref $img->{mini} eq 'HASH' ) {
    632 Contenido::File::remove( $img->{mini}{filename} ) if exists $img->{mini}{filename};
    633 foreach my $val ( values %{ $img->{mini} } ) {
    634 if ( ref $val && exists $val->{filename} && $val->{filename} && ($val->{filename} ne $img->{mini}{filename}) ) {
    635 Contenido::File::remove( $val->{filename} );
    640 636 }
    641 } else {
    642 Contenido::File::remove( $img->{mini}{filename} );
    643 637 }
    644 638 }
    645 639 }
     
    652 646 }
    653 647 }
    654 648 do { $log->warning("����� ������ delete() ��� �������� �������������� ��� ��������"); return undef }
    655 unless ($self->{id});
    649 unless ($self->{id});
    656 650 $keeper->t_connect() || do { $keeper->error(); return undef; };
    657 651 $keeper->TSQL->do("DELETE FROM ".$self->class_table->db_table." WHERE id = ?", {}, $self->id) || return $self->t_abort();
    658 652
     
    716 710 $opts{$check} = $self->id();
    717 711
    718 712 if (defined($lclass) && (length($lclass) > 0)) {
    719 $opts{class} = $lclass;
    713 $opts{class} = $lclass;
    720 714 }
    721 715
    722 716 my @links = $self->keeper->get_links(%opts);
     
    767 761 $link->source_class($self->class());
    768 762
    769 763 while (my ($k,$v) = each %opts) {
    770 $link->{$k} = $v;
    764 $link->{$k} = $v;
    771 765 }
    772 766
    773 767 if ($link->store())
    774 768 {
    775 return $link->id;
    769 return $link->id;
    776 770 } else {
    777 return undef;
    771 return undef;
    778 772 }
    779 773 }
    780 774
     
    789 783 my $hash = {};
    790 784
    791 785 foreach ( $self->structure() ) {
    792 $hash->{$_->{attr}} = $self->{$_->{attr}} if defined $self->{$_->{attr}};
    786 $hash->{$_->{attr}} = $self->{$_->{attr}} if defined $self->{$_->{attr}};
    793 787 }
    794 788 bless $hash, $self->class();
    795 789 return $hash;