*** Comment.pm.orig Fri Feb 25 09:58:34 2005 --- Comment.pm Fri May 5 14:25:52 2006 *************** *** 243,248 **** --- 243,252 ---- my $location = $query->param( 'comment_location' ); my $silent = $query->param( 'comment_quietly' ); + # PankajPant: new options to delete comment prompt + my $removeprompt = $query->param( 'comment_removeprompt' ); + my $postandremoveprompt = $query->param( 'comment_postandremoveprompt' ); + my $output = _getTemplate( "OUTPUT:$type", $topic, $web ); if ( $output =~ m/^%RED%/o ) { return $output; *************** *** 284,319 **** } } ! if ( $position eq "TOP" ) { ! $text = "$output$text"; ! } elsif ( $position eq "BOTTOM" ) { ! # Awkward newlines here, to avoid running into meta-data. ! # This should _not_ be a problem. ! $text =~ s/[\r\n]+$//; ! $text .= "\n" unless $output =~ /^\n/;; ! $text .= $output; ! $text .= "\n" unless $text =~ m/\n$/; ! } else { ! if ( $location ) { ! if ( $position eq "BEFORE" ) { ! $text =~ s/($location)/$output$1/m; ! } else { # AFTER ! $text =~ s/($location)/$1$output/m; ! } ! } elsif ( $anchor ) { ! # position relative to anchor ! if ( $position eq "BEFORE" ) { ! # OlivierBerger: put newline after comment to ! # keep anchor left justified ! $text =~ s/^($anchor)/$output\n$1/m; ! } else { # AFTER ! # put newline before comments so don't merge with anchor ! $text =~ s/^($anchor)/$1\n$output/m; ! } ! } else { ! # Position relative to index'th comment ! my $idx = 0; ! $text =~ s/(%COMMENT({.*?})?%.*\n)/&_nth($1,\$idx,$position,$index,$output)/eg; } } $text =~ s/ {3}/\t/go; --- 288,336 ---- } } ! if ($removeprompt) { ! # If comment_removeprompt was specified, ! # delete box without doing anything else ! my $idx = 0; # Position relative to index'th comment ! $text =~ s/(%COMMENT({.*?})?%)/&_delete_nth($1,\$idx,$index)/ego; ! } ! else { ! if ( $position eq "TOP" ) { ! $text = "$output$text"; ! } elsif ( $position eq "BOTTOM" ) { ! # Awkward newlines here, to avoid running into meta-data. ! # This should _not_ be a problem. ! $text =~ s/[\r\n]+$//; ! $text .= "\n" unless $output =~ /^\n/;; ! $text .= $output; ! $text .= "\n" unless $text =~ m/\n$/; ! } else { ! if ( $location ) { ! if ( $position eq "BEFORE" ) { ! $text =~ s/($location)/$output$1/m; ! } else { # AFTER ! $text =~ s/($location)/$1$output/m; ! } ! } elsif ( $anchor ) { ! # position relative to anchor ! if ( $position eq "BEFORE" ) { ! # OlivierBerger: put newline after comment to ! # keep anchor left justified ! $text =~ s/^($anchor)/$output\n$1/m; ! } else { # AFTER ! # put newline before comments so don't merge with anchor ! $text =~ s/^($anchor)/$1\n$output/m; ! } ! } else { ! # Position relative to index'th comment ! my $idx = 0; ! $text =~ s/(%COMMENT({.*?})?%.*\n)/&_nth($1,\$idx,$position,$index,$output)/eg; ! } ! } ! if ($postandremoveprompt) { ! # If comment_postandremoveprompt was specified, delete box ! my $idx = 0; # Position relative to index'th comment ! $text =~ s/(%COMMENT({.*?})?%)/&_delete_nth($1,\$idx,$index)/ego; } } $text =~ s/ {3}/\t/go; *************** *** 327,337 **** my ( $tag, $pidx, $position, $index, $output ) = @_; if ( $$pidx == $index) { ! if ( $position eq "BEFORE" ) { ! $tag = "$output$tag"; ! } else { # AFTER $tag .= $output; ! } } $$pidx++; return $tag; --- 344,365 ---- my ( $tag, $pidx, $position, $index, $output ) = @_; if ( $$pidx == $index) { ! if ( $position eq "BEFORE" ) { ! $tag = "$output$tag"; ! } else { # AFTER $tag .= $output; ! ! } ! $$pidx++; ! return $tag; ! } ! ! # PRIVATE delete this comment box ! sub _delete_nth { ! my ( $tag, $pidx, $index ) = @_; ! ! if ( $$pidx == $index) { ! $tag = ""; } $$pidx++; return $tag;