From: naoki i. <am...@us...> - 2008-04-05 16:51:12
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9657/UI Modified Files: HTML.pm HTTP.pm Log Message: Change Log 1. Added new subroutine Classifier/Bayes.pm is_admin_session check if the session is admin's 2. Use db_()->quote instead of hardcoded single quotes ("'") Classifier/Bayes.pm 3. Fixed almost of the test scripts to pass Classifier/Bayes.pm Classifier/MailParse.pm POPFile/History.pm Proxy/POP3.pm UI/HTML.pm UI/HTTP.pm tests/TestBayes.tst tests/TestBayesScript.tst tests/TestConfiguration.tst tests/TestHTML.script tests/TestHTML.tst tests/TestHistory.tst tests/TestMailParse.tst tests/TestMailParse015.clr tests/TestMailParse019.clr tests/TestNihongo002.wrd tests/TestNihongo008.wrd tests/TestNihongo016.wrd tests/TestNihongo017.wrd tests/TestNihongo021.qrn 4. Added new tests for the new subroutines tests/TestBayes.tst get_user_id_from_session get_user_name_from_session create_user (with cloning) initialize_users_password change_users_password get_user_name_from_id is_admin_session 5. Added new tests for the Japanese parsers (internal/MeCab) tests/TestMailParse.tst 6. make test now outputs the test results in STDERR instead of STDOUT 7. Snip long results tests.pl Current state of the test suite: TestBayesScript PASS TestBayes PASS TestConfiguration PASS * TestHistory PASS * TestHTML PASS * TestHTTP PASS TestIMAP not tested yet TestInsertScript PASS TestLogger PASS TestMailParse PASS TestModule PASS TestMQ PASS TestMutex PASS TestPipeScript PASS TestPOP3 fail (horribly) TestProxy PASS TestWordMangle PASS TestXMLRPC PASS (but child process does not terminate) * : needs to add tests for multi user support TODO 1. multi user mode tests are needed tests/TestConfiguration tests/TestHistory tests/HTML Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.384 retrieving revision 1.385 diff -C2 -d -r1.384 -r1.385 *** HTML.pm 31 Mar 2008 15:30:27 -0000 1.384 --- HTML.pm 5 Apr 2008 16:50:45 -0000 1.385 *************** *** 34,37 **** --- 34,38 ---- use IO::Socket; use IO::Select; + use Digest::MD5 qw( md5_hex ); use HTML::Template; use Date::Format; *************** *** 1264,1270 **** # Tell the user anything the dynamic UI was interested in sharing ! $self->log_( 3, "dynamic security UI $name had status/error $status_message/$error_message") if (defined $status_message || defined $error_message); ! $self->status_message__($templ,$status_message) if ( defined( $status_message )); ! $self->error_message__($templ, $error_message) if ( defined( $error_message )); } } --- 1265,1276 ---- # Tell the user anything the dynamic UI was interested in sharing ! if ( defined( $status_message ) ) { ! $self->log_( 3, "dynamic security UI $name had status $status_message"); ! $self->status_message__($templ,$status_message); ! } ! if ( defined( $error_message ) ) { ! $self->log_( 3, "dynamic security UI $name had error $error_message"); ! $self->error_message__($templ, $error_message); ! } } } *************** *** 1280,1286 **** # Tell the user anything the dynamic UI was interested in sharing ! $self->log_( 3, "dynamic chain UI $name had status/error $status_message/$error_message") if (defined $status_message || defined $error_message); ! $self->status_message__($templ,$status_message) if ( defined( $status_message )); ! $self->error_message__($templ, $error_message) if ( defined( $error_message )); } --- 1286,1297 ---- # Tell the user anything the dynamic UI was interested in sharing ! if ( defined( $status_message ) ) { ! $self->log_( 3, "dynamic chain UI $name had status $status_message"); ! $self->status_message__($templ,$status_message); ! } ! if ( defined( $error_message ) ) { ! $self->log_( 3, "dynamic chain UI $name had error $error_message"); ! $self->error_message__($templ, $error_message); ! } } *************** *** 1899,1903 **** if ( exists( $magnets{$current_mtext} ) ) { $found = 1; ! $error_message .= sprintf( $self->{language__}{Magnet_Error1}, "$mtype: $current_mtext", $bucket ) . '<br>'; last; } --- 1910,1914 ---- if ( exists( $magnets{$current_mtext} ) ) { $found = 1; ! $error_message .= sprintf( $self->{language__}{Magnet_Error1}, "$mtype: $current_mtext", $bucket ) . "\n"; last; } *************** *** 1912,1916 **** if ( ( $mtext =~ /\Q$from\E/ ) || ( $from =~ /\Q$mtext\E/ ) ) { $found = 1; ! $error_message .= sprintf( $self->{language__}{Magnet_Error2}, "$mtype: $current_mtext", "$mtype: $from", $bucket ) . '<br>'; last; } --- 1923,1927 ---- if ( ( $mtext =~ /\Q$from\E/ ) || ( $from =~ /\Q$mtext\E/ ) ) { $found = 1; ! $error_message .= sprintf( $self->{language__}{Magnet_Error2}, "$mtype: $current_mtext", "$mtype: $from", $bucket ) . "\n"; last; } *************** *** 1944,1948 **** $self->classifier_()->create_magnet( $session, $mbucket, $mtype, $current_mtext ); if ( !defined( $self->{form_}{update} ) ) { ! $status_message .= sprintf( $self->{language__}{Magnet_Error3}, "$mtype: $current_mtext", $mbucket ) . '<br>'; } } --- 1955,1959 ---- $self->classifier_()->create_magnet( $session, $mbucket, $mtype, $current_mtext ); if ( !defined( $self->{form_}{update} ) ) { ! $status_message .= sprintf( $self->{language__}{Magnet_Error3}, "$mtype: $current_mtext", $mbucket ) . "\n"; } } *************** *** 2380,2384 **** my $form_param = ( $self->{form_}{"${bucket}_$variable"} ) ? 1 : 0; ! if ( $form_param ne $bucket_param ) { $self->set_bucket_parameter__( $session, $bucket, $variable, $form_param ); } --- 2391,2395 ---- my $form_param = ( $self->{form_}{"${bucket}_$variable"} ) ? 1 : 0; ! if ( defined($form_param) && ( $form_param ne $bucket_param ) ) { $self->set_bucket_parameter__( $session, $bucket, $variable, $form_param ); } *************** *** 2392,2396 **** my $form_color = $self->{form_}{"${bucket}_color"}; ! if ( $form_color ne $bucket_color ) { $self->set_bucket_parameter__( $session, $bucket, 'color', $form_color ); } --- 2403,2407 ---- my $form_color = $self->{form_}{"${bucket}_color"}; ! if ( defined($form_color) && ( $form_color ne $bucket_color ) ) { $self->set_bucket_parameter__( $session, $bucket, 'color', $form_color ); } *************** *** 2582,2586 **** my ( $self, $templ, $start_message, $stop_message, $session ) = @_; ! $templ->param( 'History_Navigator_Fields' => $self->print_form_fields_(0,1,('session','filter','search','sort','negate' ) ) ); if ( $start_message != 0 ) { --- 2593,2597 ---- my ( $self, $templ, $start_message, $stop_message, $session ) = @_; ! $templ->param( 'History_Navigator_Fields' => $self->print_form_fields_(0,1,( 'filter','search','sort','negate' ) ) ); if ( $start_message != 0 ) { *************** *** 2610,2614 **** $row_data{History_Navigator_If_This_Page} = 1; } else { ! $row_data{History_Navigator_Fields} = $self->print_form_fields_(0,1,('session','filter','search','sort','negate')); } --- 2621,2625 ---- $row_data{History_Navigator_If_This_Page} = 1; } else { ! $row_data{History_Navigator_Fields} = $self->print_form_fields_(0,1,('filter','search','sort','negate')); } *************** *** 3519,3522 **** --- 3530,3539 ---- my ( $self, $templ, $message ) = @_; + $message =~ s/&/&/g; + $message =~ s/</</g; + $message =~ s/>/>/g; + $message =~ s/\"/"/g; + $message =~ s/\n/<br \/>/g; + my $old = $templ->param( 'Header_Message' ) || ''; $templ->param( 'Header_If_Message' => 1 ); *************** *** 3539,3543 **** my ( $self, $templ, $message ) = @_; ! $message =~ s/\n/<br \/>/; my $old = $templ->param( 'Header_Error' ) || ''; --- 3556,3564 ---- my ( $self, $templ, $message ) = @_; ! $message =~ s/&/&/g; ! $message =~ s/</</g; ! $message =~ s/>/>/g; ! $message =~ s/\"/"/g; ! $message =~ s/\n/<br \/>/g; my $old = $templ->param( 'Header_Error' ) || ''; Index: HTTP.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTTP.pm,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** HTTP.pm 2 Dec 2007 17:27:47 -0000 1.37 --- HTTP.pm 5 Apr 2008 16:50:46 -0000 1.38 *************** *** 413,417 **** $self->log_( 1, $text ); ! print $client "HTTP/1.0 200 OK$eol"; print $client "Content-Type: text/html$eol"; print $client "Content-Length: "; --- 413,420 ---- $self->log_( 1, $text ); ! my $error_code = 500; ! $error_code = $error if ( $error eq '404' ); ! ! print $client "HTTP/1.0 $error_code Error$eol"; print $client "Content-Type: text/html$eol"; print $client "Content-Length: "; |