From: Chris W. <la...@us...> - 2005-02-28 00:54:49
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29265/comments/OpenInteract2/Action Modified Files: Comments.pm Log Message: OIN-128: use <ecode></ecode> to demarcate preformatted text Index: Comments.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Action/Comments.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Comments.pm 7 Dec 2004 22:44:20 -0000 1.10 --- Comments.pm 28 Feb 2005 00:54:30 -0000 1.11 *************** *** 10,13 **** --- 10,14 ---- use OpenInteract2::Constants qw( :log ); use OpenInteract2::Context qw( CTX ); + use OpenInteract2::Cookie; use OpenInteract2::Util; *************** *** 22,26 **** $log ||= get_logger( LOG_APP ); ! my $object = $self->param( 'object' ); my $obj_class = $self->param( 'class' ); my $obj_id = $self->param( 'object_id' ); --- 23,27 ---- $log ||= get_logger( LOG_APP ); ! my $object = $self->param( 'object' ); my $obj_class = $self->param( 'class' ); my $obj_id = $self->param( 'object_id' ); *************** *** 348,352 **** } ! # Get rid of any HTML tags $comment->{content} =~ s|<[^>]+>||gs; --- 349,368 ---- } ! # store the unescaped version for the re-editing (if preview) ! ! $self->param( pre_escaped => $comment->{content} ); ! ! # pull out any <ecode></ecode> sections for later ! ! my @code_sections = (); ! my $count = 0; ! $comment->{content} =~ s| ! (<ecode>(.*?)</ecode>) ! | ! push @code_sections, $2; ! 'CODECONTENT' . ++$count; ! |gisemx; ! ! # Get rid of any HTML tags (be sure this is after code sections) $comment->{content} =~ s|<[^>]+>||gs; *************** *** 355,363 **** # Escape any remaining HTMLisms - # ...but store the unescaped version for the re-editing (if this - # is a preview) - - $self->param( pre_escaped => $comment->{content} ); - $comment->{content} = HTML::Entities::encode( $comment->{content} ); $comment->{subject} = HTML::Entities::encode( $comment->{subject} ); --- 371,374 ---- *************** *** 371,374 **** --- 382,392 ---- $comment->{content} =~ s/(\r\n\r\n|\n\n)/$1<p>/g; + # put the code sections back in + $count = 1; + foreach my $section ( @code_sections ) { + $comment =~ s|CODESECTION$count|<pre class="commentCode">$section</pre>|gsm; + $count++; + } + # Non-object form widgets *************** *** 398,402 **** my $action = $request->param( 'action' ); ! if ( $action eq 'Preview' ) { return $self->_show_editable; } --- 416,420 ---- my $action = $request->param( 'action' ); ! if ( $action eq $self->_msg( 'comments.form.preview' ) ) { return $self->_show_editable; } *************** *** 471,475 **** } - my $action_info = CTX->lookup_action_info( 'comment' ); --- 489,492 ---- |