--- at/lib/TWiki/Plugins/ActionTrackerPlugin/Action.pm 2005-03-26 18:38:43.000000000 +0100
+++ lib/TWiki/Plugins/ActionTrackerPlugin/Action.pm 2005-07-20 00:23:07.000000000 +0200
@@ -26,6 +26,7 @@
use TWiki::Contrib::Attrs;
+use TWiki::Plugins::ActionTrackerPlugin; # NielsKoldso: 19-Jul-05 need the _getPref function
use TWiki::Plugins::ActionTrackerPlugin::AttrDef;
use TWiki::Plugins::ActionTrackerPlugin::Format;
@@ -174,8 +175,11 @@
$descr =~ s/\r+//o;
# Translate newlines in the description to XHTML tags
- $descr =~ s/\n\n/
/gos;
- $descr =~ s/\n/
/gos;
+ unless(TWiki::Plugins::ActionTrackerPlugin::_getPref('DISABLE_NEWLINE_TRANSLATION',0)) # NielsKoldso: 19-Jul-05 Allow non-translation of newlines
+ {
+ $descr =~ s/\n\n//gos;
+ $descr =~ s/\n/
/gos;
+ }
$descr =~ s/%(ACTION\w*)\{/%$1\{/gso;
$this->{text} = $descr;
@@ -324,8 +328,9 @@
foreach my $key ( keys %$this ) {
my $type = $types{$key};
if ( $key eq 'text') {
- $descr = $this->{text};
- $descr =~ s/^\s*(.*)\s*$/$1/os;
+ $descr = $this->{text};
+ $descr =~ s/ {3}/\t/g; # NielsKoldso 19-Jul-05: conform to TWiki 3-space=tab invariant
+ $descr =~ s/^\s*(.*)\s*$/$1/os;
} elsif ( defined( $type )) {
if ( $type->{type} eq 'date' ) {
$attrs .= " $key=\"" .
@@ -336,13 +341,17 @@
}
}
}
- if ( $descr =~ m/<(p|br)\s*\/>/io ) {
- $descr =~ s//\n\n/gio;
- $descr =~ s/
/\n/gio;
- my $term = "EOF";
- while ( $descr =~ m/^$term/m ) {
- $term .= "F";
+
+ # NielsKoldso: 19-Jul-05 Allow non-translation of newlines
+ my $newlineRE = (TWiki::Plugins::ActionTrackerPlugin::_getPref('DISABLE_NEWLINE_TRANSLATION',0)?'\n':'<(p|br)\s*\/>');
+ if ( $descr =~ m/$newlineRE/s ) {
+ unless(TWiki::Plugins::ActionTrackerPlugin::_getPref('DISABLE_NEWLINE_TRANSLATION',0))
+ {
+ $descr =~ s//\n\n/gio;
+ $descr =~ s/
/\n/gio;
}
+ my $term = "EOF";
+ while ( $descr =~ m/^$term/m ) { $term .= "F"; }
$descr = "<<$term\n$descr\n$term";
}
return "%ACTION{$attrs }% $descr";
@@ -515,7 +524,7 @@
if ( $val eq "late" ) {
return ( $this->secsToGo() < 0 && $this->{state} ne "closed" ) ? 1 : 0;
} else {
- return ( $this->{state} eq $val );
+ return ( $this->{state} =~ m/$val/); # Niels Koldso 19-Jul-2005 Make re match of states (except for state late)
}
}
@@ -589,8 +598,11 @@
my $text = $this->{text};
if ( $asHTML && defined( $type ) && $type eq "href" ) {
+
+ # Revert XHTML linebreaks to normal linebreaks (e.g. revert to normal TWiki syntax)
+ $text =~ s/
/\n/sgo unless(TWiki::Plugins::ActionTrackerPlugin::_getPref('DISABLE_NEWLINE_TRANSLATION',0));
+
# Generate a jump-to in wiki syntax
- $text =~ s/
/\n/sgo;
# Would be nice to do the goto as a button image....
my $jump = " ({web}, $this->{topic} ) .
@@ -815,8 +827,13 @@
sub createFromQuery {
my ( $web, $topic, $an, $query ) = @_;
my $desc = $query->param( "text" ) || "No description";
- $desc =~ s/\r?\n\r?\n/ /sgo;
- $desc =~ s/\r?\n/
/sgo;
+
+ # NielsKoldso: 19-Jul-05 Allow non-translation of newlines
+ unless(TWiki::Plugins::ActionTrackerPlugin::_getPref('DISABLE_NEWLINE_TRANSLATION',0))
+ {
+ $desc =~ s/\r?\n\r?\n/ /sgo;
+ $desc =~ s/\r?\n/
/sgo;
+ }
# for each of the legal attribute types, see if the query
# contains a value for that attribute. If it does, fill it