Revision 127

Date:
2011/08/26 14:08:16
Author:
ahitrov
Revision Log:
Param 'rows => n' in notetext field type
Field 'multimedia_new' methods - store and delete
New TrivialSAX without warnings
Files:

Legend:

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

     
    45 45 </td><td align="right" valign="bottom">
    46 46 <a style="color:#000000" href="javascript: li()" title="�������� ������(ul-li)">�������� ������</a>&nbsp;&nbsp;
    47 47 </td></tr></table>
    48 <textarea name="<% $name %>" rows="30" cols="60" style="width:95%;font-family:arial;font-size:9pt;"><% $check %></textarea>
    48 <textarea name="<% $name %>" rows="<% $prop->{rows} || 30 %>" cols="60" style="width:95%;font-family:arial;font-size:9pt;"><% $check %></textarea>
    49 49 <%args>
    50 50
    51 $name => undef
    52 $check => undef
    51 $name => undef
    52 $check => undef
    53 $prop => {}
    53 54
    54 55 </%args>
  • koi8/core/lib/Contenido/File.pm

     
    186 186 } elsif ( $opts{filename} ) {
    187 187 $ext = $opts{filename} =~ /(jpe?g|gif|png)$/i ? lc $1 : 'bin';
    188 188 }
    189 if ( ref $fh eq 'IO::Scalar' ) {
    190 $size = length("$fh");
    191 }
    189 192 $ext ||= 'bin';
    190 193
    191 194 my $fh_tmp = IO::File->new('>'.$filename_tmp.'.'.$ext) || return;
     
    324 327 }
    325 328
    326 329
    330 sub store_binary {
    331 my $input = shift;
    332 my (%opts) = @_;
    333 my $object = delete $opts{object} || return;
    334 my $attr = delete $opts{attr} || return;
    335
    336 my ($prop) = grep { $_->{attr} eq $attr } $object->structure;
    337 return unless ref $prop;
    338
    339 my $filename = '/binary/'.$object->get_file_name() || return;
    340 my $filename_tmp = $state->{'tmp_dir'}.'/'.join('_', split('/', $filename));
    341
    342 my $fh = get_fh($input);
    343 return unless ref $fh;
    344
    345 my $ext;
    346 my $size = 1073741824;
    347 if ( not ref $input ) {
    348 $ext = $input =~ /(jpe?g|gif|png)$/i ? lc $1 : 'bin';
    349 if ( scheme($input) eq 'file' ) {
    350 $size = (stat $fh)[7];
    351 }
    352 } elsif ( ref $input eq 'Apache::Upload' ) {
    353 $ext = $input->filename() =~ /(jpe?g|gif|png)$/i ? lc $1 : 'bin';
    354 $size = (stat $fh)[7];
    355 } elsif ( $opts{filename} ) {
    356 $ext = $opts{filename} =~ /(jpe?g|gif|png)$/i ? lc $1 : 'bin';
    357 }
    358 if ( ref $fh eq 'IO::Scalar' ) {
    359 $size = length("$fh");
    360 }
    361 $ext ||= 'bin';
    362
    363 my $fh_tmp = IO::File->new('>'.$filename_tmp.'.'.$ext) || return;
    364 my $buffer;
    365
    366 $size = sysread $fh, $buffer, $size;
    367 syswrite $fh_tmp, $buffer, $size;
    368
    369 undef $fh_tmp;
    370
    371 my $BINARY;
    372 if ( store($filename.'.'.$ext, $filename_tmp.'.'.$ext) ) {
    373 $BINARY = { filename => $filename.'.'.$ext };
    374 unlink $filename_tmp.'.'.$ext if -e $filename_tmp.'.'.$ext;
    375 }
    376
    377 return $BINARY;
    378 }
    379
    380 sub remove_binary {
    381 my $BINARY = shift;
    382
    383 if ( ref $BINARY eq 'HASH' && exists $BINARY->{filename} ) {
    384 remove($BINARY->{'filename'}) || return;
    385 }
    386
    387 1;
    388 }
    389
    390
    327 391 1;
  • koi8/core/lib/Contenido/Object.pm

     
    1132 1132 }
    1133 1133
    1134 1134 # ----------------------------------------------------------------------------
    1135 # ����� _image_store() ������� ��������� �������, ����������� � ���� image ��� images
    1135 # ����� _store_image() ��������� �������, ����������� � ���� image ��� images
    1136 1136 #
    1137 1137 # ������ �������������:
    1138 # $document->_image_store( INPUT, attr => 'fieldname' )
    1138 # $document->_store_image( INPUT, attr => 'fieldname' )
    1139 1139 # ----------------------------------------------------------------------------
    1140 1140 sub _store_image {
    1141 1141 my $self = shift;
     
    1147 1147 return Contenido::File::store_image( $input, object => $self, attr => $opts{attr} );
    1148 1148 }
    1149 1149
    1150 # ----------------------------------------------------------------------------
    1151 # ����� _delete_image() ������� �����, ��������� � ����� image ��� images.
    1152 # �������� ��� ����-�����
    1153 #
    1154 # ������ �������������:
    1155 # $document->_store_image( $image_attr_structure )
    1156 # ----------------------------------------------------------------------------
    1150 1157 sub _delete_image {
    1151 1158 my $self = shift;
    1152 1159 my $IMAGE = shift;
     
    1154 1161 return Contenido::File::remove_image( $IMAGE );
    1155 1162 }
    1156 1163
    1164 # ----------------------------------------------------------------------------
    1165 # ����� _store_binary() ��������� ������������ �������� ����, ����������� � ���� multimedia ��� multimedia_new
    1166 #
    1167 # ������ �������������:
    1168 # $document->_store_binary( INPUT, attr => 'fieldname' )
    1169 # ----------------------------------------------------------------------------
    1170 sub _store_binary {
    1171 my $self = shift;
    1172 do { $log->error("����� delete() ����� �������� ������ � ��������, �� �� �������"); die } unless ref($self);
    1173
    1174 my $input = shift;
    1175 my (%opts) = @_;
    1176
    1177 return Contenido::File::store_binary( $input, object => $self, attr => $opts{attr} );
    1178 }
    1179
    1180 # ----------------------------------------------------------------------------
    1181 # ����� _delete_binary() ������� �����, ��������� � ����� multimedia ��� multimedia_new.
    1182 # �� �������� ������ ����-�����
    1183 #
    1184 # ������ �������������:
    1185 # $document->_delete_binary( $binary_attr_structure )
    1186 # ----------------------------------------------------------------------------
    1187 sub _delete_binary {
    1188 my $self = shift;
    1189 my $BINARY = shift;
    1190
    1191 return Contenido::File::remove_binary( $BINARY );
    1192 }
    1193
    1157 1194 1;
    1158 1195
  • koi8/core/ports/all/TrivialSAX/GNUmakefile

     
    1 1 ##############################################################################
    2 # $HeadURL: http://svn.dev.rambler.ru/Contenido/trunk/ports/all/TrivialSAX/GNUmakefile $
    3 # $Id: GNUmakefile 674 2007-02-02 10:18:58Z lonerr $
    2 # $HeadURL: http://svn.dev.rambler.ru/Contenido/branches/utf8/ports/all/TrivialSAX/GNUmakefile $
    3 # $Id: GNUmakefile 1489 2009-11-27 14:15:17Z abavykin $
    4 4 ###############################################################################
    5 5
    6 6 PORTVERSION = 0.03
     
    17 17 @test -d ${PREFIX}/lib/perl5/site_perl/${PERL_VER}/XML/TrivialSAX \
    18 18 || mkdir -p ${PREFIX}/lib/perl5/site_perl/${PERL_VER}/XML/TrivialSAX
    19 19 @cp -f ${WRKSRC}/*.pm ${PREFIX}/lib/perl5/site_perl/${PERL_VER}/XML/TrivialSAX/
    20 @sed -i '' -e 's/koi8-r/utf-8/g' ${PREFIX}/lib/perl5/site_perl/${PERL_VER}/XML/TrivialSAX/Handler.pm
    20 21
    21 22
    22 23 include ../../etc/ports.mk
  • koi8/core/ports/etc/ports.mk

     
    1 1 ##############################################################################
    2 # $HeadURL: http://svn.dev.rambler.ru/Contenido/trunk/ports/etc/ports.mk $
    3 # $Id: ports.mk 1509 2010-01-25 09:03:39Z lonerr $
    2 # $HeadURL: http://svn.dev.rambler.ru/Contenido/branches/utf8/ports/etc/ports.mk $
    3 # $Id: ports.mk 1526 2010-03-29 11:11:10Z ahitrov $
    4 4 ###############################################################################
    5 5
    6 6 PREFIX ?= ${error PREFIX must be defined}