From: <jgr...@us...> - 2003-05-23 14:49:24
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv28314/UI Modified Files: HTML.pm Log Message: Fix bug where XPL link was not working if message was not on first page of history Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** HTML.pm 22 May 2003 17:00:19 -0000 1.158 --- HTML.pm 23 May 2003 14:49:19 -0000 1.159 *************** *** 291,294 **** --- 291,295 ---- # Reset any filters + $self->{form_}{filter} = ''; $self->{form_}{search} = ''; *************** *** 301,305 **** $self->invalidate_history_cache() if ( !$found ); if ( -e ( $self->global_config_( 'msgdir' ) . $file ) ) { ! $self->http_redirect_( $client, "/view?session=$self->{session_key__}&view=$self->{form_}{view}&start_message=$self->{form_}{start_message}" ); } else { $self->http_redirect_( $client, "/history" ); --- 302,306 ---- $self->invalidate_history_cache() if ( !$found ); if ( -e ( $self->global_config_( 'msgdir' ) . $file ) ) { ! $self->http_redirect_( $client, "/view?session=$self->{session_key__}&view=$self->{form_}{view}" ); } else { $self->http_redirect_( $client, "/history" ); *************** *** 3073,3077 **** $self->{form_}{filter} = '' if ( !defined( $self->{form_}{filter} ) ); ! my $index; foreach my $i ( $start_message .. $start_message + $self->config_( 'page_size' ) - 1) { if ( $self->{history_keys__}[$i] eq $mail_file ) { --- 3074,3078 ---- $self->{form_}{filter} = '' if ( !defined( $self->{form_}{filter} ) ); ! my $index = -1; foreach my $i ( $start_message .. $start_message + $self->config_( 'page_size' ) - 1) { if ( $self->{history_keys__}[$i] eq $mail_file ) { *************** *** 3079,3082 **** --- 3080,3102 ---- last; } + } + + # If we fail to find the index of the message we are looking for then + # do a full search of the history for it + + if ( $index == -1 ) { + foreach my $i ( 0 .. $self->history_size()-1 ) { + if ( $self->{history_keys__}[$i] eq $mail_file ) { + $index = $i; + $start_message = $i; + last; + } + } + } + + # If we still can't find the message then return to the history page + + if ( $index == -1 ) { + return $self->http_redirect( $client, '/history' ); } |