|
From: <jgr...@us...> - 2003-08-24 01:20:37
|
Update of /cvsroot/popfile/engine/UI
In directory sc8-pr-cvs1:/tmp/cvs-serv18961/UI
Modified Files:
HTML.pm
Log Message:
Added HTML interface tests for most of the History functions including the Single Message View, also covers Password and Shutdown handling and miscellaneous items like use of a bad session key, 404 errors; coverage is now at 88% for HTML.pm. Need to finish reclassification and deletion tests
Index: HTML.pm
===================================================================
RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v
retrieving revision 1.196
retrieving revision 1.197
diff -C2 -d -r1.196 -r1.197
*** HTML.pm 23 Aug 2003 00:48:24 -0000 1.196
--- HTML.pm 24 Aug 2003 01:20:33 -0000 1.197
***************
*** 2360,2370 ****
if ( ( $filter ne '' ) || ( $search ne '' ) ) {
foreach my $file (sort compare_mf keys %{$self->{history__}}) {
! if ( ( $filter eq '' ) ||
( $self->{history__}{$file}{bucket} eq $filter ) ||
( ( $filter eq '__filter__magnet' ) && ( $self->{history__}{$file}{magnet} ne '' ) ) ||
! ( ( $filter eq '__filter__no__magnet' ) && ( $self->{history__}{$file}{magnet} eq '' ) ) ) {
! if ( ( $search eq '' ) ||
( $self->{history__}{$file}{from} =~ /\Q$search\E/i ) ||
! ( $self->{history__}{$file}{subject} =~ /\Q$search\E/i ) ) {
if ( defined( $self->{history_keys__} ) ) {
@{$self->{history_keys__}} = (@{$self->{history_keys__}}, $file);
--- 2360,2370 ----
if ( ( $filter ne '' ) || ( $search ne '' ) ) {
foreach my $file (sort compare_mf keys %{$self->{history__}}) {
! if ( ( $filter eq '' ) || # PROFILE BLOCK START
( $self->{history__}{$file}{bucket} eq $filter ) ||
( ( $filter eq '__filter__magnet' ) && ( $self->{history__}{$file}{magnet} ne '' ) ) ||
! ( ( $filter eq '__filter__no__magnet' ) && ( $self->{history__}{$file}{magnet} eq '' ) ) ) { # PROFILE BLOCK STOP
! if ( ( $search eq '' ) || # PROFILE BLOCK START
( $self->{history__}{$file}{from} =~ /\Q$search\E/i ) ||
! ( $self->{history__}{$file}{subject} =~ /\Q$search\E/i ) ) { # PROFILE BLOCK STOP
if ( defined( $self->{history_keys__} ) ) {
@{$self->{history_keys__}} = (@{$self->{history_keys__}}, $file);
***************
*** 2392,2405 ****
}
! if ( ( $sort ne '' ) &&
# If the filter had no messages, this will be undefined
# and there are no ways to sort nothing
! defined @{$self->{history_keys__}} ) {
@{$self->{history_keys__}} = sort {
! my ($a1,$b1) = ($self->{history__}{$a}{$sort},
! $self->{history__}{$b}{$sort});
$a1 =~ s/&(l|g)t;//ig;
$b1 =~ s/&(l|g)t;//ig;
--- 2392,2405 ----
}
! if ( ( $sort ne '' ) && # PROFILE BLOCK START
# If the filter had no messages, this will be undefined
# and there are no ways to sort nothing
! defined @{$self->{history_keys__}} ) { # PROFILE BLOCK STOP
@{$self->{history_keys__}} = sort {
! my ($a1,$b1) = ($self->{history__}{$a}{$sort}, # PROFILE BLOCK START
! $self->{history__}{$b}{$sort}); # PROFILE BLOCK STOP
$a1 =~ s/&(l|g)t;//ig;
$b1 =~ s/&(l|g)t;//ig;
***************
*** 2611,2616 ****
while ( <MAIL> ) {
last if ( /^(\r\n|\r|\n)/ );
! $from = $1 if ( /^From:(.*)/i );
! $subject = $1 if ( /^Subject:(.*)/i );
last if ( ( $from ne '' ) && ( $subject ne '' ) );
}
--- 2611,2616 ----
while ( <MAIL> ) {
last if ( /^(\r\n|\r|\n)/ );
! $from = $1 if ( /^From: *(.*)/i );
! $subject = $1 if ( /^Subject: *(.*)/i );
last if ( ( $from ne '' ) && ( $subject ne '' ) );
}
***************
*** 3111,3116 ****
if ( defined( $self->{form_}{clearall} ) ) {
foreach my $i (0 .. $self->history_size()-1 ) {
! $self->history_delete_file( $self->{history_keys__}[$i],
! $self->config_( 'archive' ) );
}
}
--- 3111,3116 ----
if ( defined( $self->{form_}{clearall} ) ) {
foreach my $i (0 .. $self->history_size()-1 ) {
! $self->history_delete_file( $self->{history_keys__}[$i], # PROFILE BLOCK START
! $self->config_( 'archive' ) ); # PROFILE BLOCK STOP
}
}
***************
*** 3119,3124 ****
foreach my $i ( $self->{form_}{start_message} .. $self->{form_}{start_message} + $self->config_( 'page_size' ) - 1 ) {
if ( defined( $self->{history_keys__}[$i] ) ) {
! $self->history_delete_file( $self->{history_keys__}[$i],
! $self->config_( 'archive' ) );
}
}
--- 3119,3124 ----
foreach my $i ( $self->{form_}{start_message} .. $self->{form_}{start_message} + $self->config_( 'page_size' ) - 1 ) {
if ( defined( $self->{history_keys__}[$i] ) ) {
! $self->history_delete_file( $self->{history_keys__}[$i], # PROFILE BLOCK START
! $self->config_( 'archive' ) ); # PROFILE BLOCK STOP
}
}
***************
*** 3283,3287 ****
$body .= "</select>\n";
} else {
! $body .= " ($self->{language__}{History_MagnetUsed}: " . splitline( $self->{history__}{$mail_file}{magnet}, 0 ) . ")";
}
}
--- 3283,3287 ----
$body .= "</select>\n";
} else {
! $body .= " ($self->{language__}{History_MagnetUsed}: " . Classifier::MailParse::splitline( $self->{history__}{$mail_file}{magnet}, 0 ) . ")";
}
}
***************
*** 3457,3461 ****
$body .= "</select>\n<input type=\"submit\" class=\"reclassifyButton\" name=\"change\" value=\"$self->{language__}{Reclassify}\" />";
} else {
! $body .= " ($self->{language__}{History_MagnetUsed}: " . splitline( $self->{history__}{$mail_file}{magnet} , 0) . ")";
}
}
--- 3457,3461 ----
$body .= "</select>\n<input type=\"submit\" class=\"reclassifyButton\" name=\"change\" value=\"$self->{language__}{Reclassify}\" />";
} else {
! $body .= " ($self->{language__}{History_MagnetUsed}: " . Classifier::MailParse::splitline( $self->{history__}{$mail_file}{magnet} , 0) . ")";
}
}
***************
*** 3941,3974 ****
$self->{dynamic_ui__}{$type}{$name} = $object;
}
-
- # ---------------------------------------------------------------------------------------------
- #
- # splitline - Escapes characters so a line will print as plain-text within a HTML document.
- #
- # $line The line to escape
- # $encoding The value of any current encoding scheme
- #
- # ---------------------------------------------------------------------------------------------
-
- sub splitline
- {
- my ($line, $encoding) = @_;
-
- $line =~ s/([^\r\n]{100,120} )/$1\r\n/g;
- $line =~ s/([^ \r\n]{120})/$1\r\n/g;
-
- $line =~ s/</</g;
- $line =~ s/>/>/g;
-
- if ( $encoding =~ /quoted\-printable/i ) {
- $line =~ s/=3C/</g;
- $line =~ s/=3E/>/g;
- }
-
- $line =~ s/\t/ /g;
-
- return $line;
- }
-
# ---------------------------------------------------------------------------------------------
--- 3941,3944 ----
|