From: <jgr...@us...> - 2003-03-03 22:01:41
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1:/tmp/cvs-serv19388/UI Modified Files: HTML.pm Log Message: Fix up the constructors so that they call the parent classes, add new parameter method to POPFile::Configuration, fix up calls to child and flush_child_data for proxies; various other minor tweaks. With this commit POPFile OO is limping along... my guess is the next commit and you'll be able to try it out Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** HTML.pm 3 Mar 2003 15:21:49 -0000 1.99 --- HTML.pm 3 Mar 2003 22:01:36 -0000 1.100 *************** *** 37,41 **** { my $type = shift; ! my $self; # The classifier (Classifier::Bayes) --- 37,41 ---- { my $type = shift; ! my $self = POPFile::Module->new(); # The classifier (Classifier::Bayes) *************** *** 119,161 **** my ( $self ) = @_; ! # $self->config_( $1, $2, 1 ); # Checking for updates if off by default ! $self->config_( 'update_check', 0, 1 ); # Sending of statistics is off ! $self->config_( 'send_stats', 0, 1 ); # The size of a history page ! $self->config_( 'page_size', 20, 1 ); # Only accept connections from the local machine for the UI ! $self->config_( 'localui', 1, 1 ); # The default location for the message files ! $self->config_( 'msgdir', 'messages/', 1 ); # Use the default skin ! $self->config_( 'skin', 'SimplyBlue', 1 ); # Keep the history for two days ! $self->config_( 'history_days', 2, 1 ); # The last time we checked for an update using the local epoch ! $self->config_( 'last_update_check', 0, 1 ); # The user interface password ! $self->config_( 'password', '', 1 ); # The last time (textual) that the statistics were reset ! $self->config_( 'last_reset', localtime, 1 ); # We start by assuming that the user speaks English like the # perfidious Anglo-Saxons that we are... :-) ! $self->config_( 'language', 'English', 1 ); # If this is 1 then when the language is loaded we will use the language string identifier as the # string shown in the UI. This is used to test whether which identifiers are used where. ! $self->config_( 'test_language', 0, 1 ); # If 1, Messages are saved to an archive when they are removed or expired from the history cache --- 119,161 ---- my ( $self ) = @_; ! $self->config_( 'port', 8080 ); # Checking for updates if off by default ! $self->config_( 'update_check', 0 ); # Sending of statistics is off ! $self->config_( 'send_stats', 0 ); # The size of a history page ! $self->config_( 'page_size', 20 ); # Only accept connections from the local machine for the UI ! $self->config_( 'local', 1 ); # The default location for the message files ! $self->config_( 'msgdir', 'messages/' ); # Use the default skin ! $self->config_( 'skin', 'SimplyBlue' ); # Keep the history for two days ! $self->config_( 'history_days', 2 ); # The last time we checked for an update using the local epoch ! $self->config_( 'last_update_check', 0 ); # The user interface password ! $self->config_( 'password', '' ); # The last time (textual) that the statistics were reset ! $self->config_( 'last_reset', localtime ); # We start by assuming that the user speaks English like the # perfidious Anglo-Saxons that we are... :-) ! $self->config_( 'language', 'English' ); # If this is 1 then when the language is loaded we will use the language string identifier as the # string shown in the UI. This is used to test whether which identifiers are used where. ! $self->config_( 'test_language', 0 ); # If 1, Messages are saved to an archive when they are removed or expired from the history cache *************** *** 163,167 **** # The directory where messages will be archived to, in sub-directories for each bucket ! $self->config_( 'archive_dir', "archive", 1 ); # This is an advanced setting which will save archived files to a randomly numbered --- 163,167 ---- # The directory where messages will be archived to, in sub-directories for each bucket ! $self->config_( 'archive_dir', 'archive' ); # This is an advanced setting which will save archived files to a randomly numbered *************** *** 169,173 **** # bucket directory # 0 <= directory name < archive_classes ! $self->config_( 'archive_classes', 0, 1 ); # Load skins --- 169,173 ---- # bucket directory # 0 <= directory name < archive_classes ! $self->config_( 'archive_classes', 0 ); # Load skins *************** *** 218,222 **** $self->{server} = IO::Socket::INET->new( Proto => 'tcp', ! $self->config_( 'localui' ) == 1 ? (LocalAddr => 'localhost') : (), LocalPort => $self->config_( 'port' ), Listen => SOMAXCONN, --- 218,222 ---- $self->{server} = IO::Socket::INET->new( Proto => 'tcp', ! $self->config_( 'local' ) == 1 ? (LocalAddr => 'localhost') : (), LocalPort => $self->config_( 'port' ), Listen => SOMAXCONN, *************** *** 280,284 **** my ( $remote_port, $remote_host ) = sockaddr_in( $client->peername() ); ! if ( ( $self->config_( 'localui' ) == 0 ) || ( $remote_host eq inet_aton( "127.0.0.1" ) ) ) { --- 280,284 ---- my ( $remote_port, $remote_host ) = sockaddr_in( $client->peername() ); ! if ( ( $self->config_( 'local' ) == 0 ) || ( $remote_host eq inet_aton( "127.0.0.1" ) ) ) { *************** *** 994,999 **** $self->config_( 'password', $self->{form__}{password} ) if ( defined($self->{form__}{password}) ); $self->config_( 'server', $self->{form__}{server} ) if ( defined($self->{form__}{server}) ); ! $self->config_( 'localpop', $self->{form__}{localpop}-1 ) if ( defined($self->{form__}{localpop}) ); ! $self->config_( 'localui', $self->{form__}{localui}-1 ) if ( defined($self->{form__}{localui}) ); $self->config_( 'update_check', $self->{form__}{update_check}-1 ) if ( defined($self->{form__}{update_check}) ); $self->config_( 'send_stats', $self->{form__}{send_stats}-1 ) if ( defined($self->{form__}{send_stats}) ); --- 994,999 ---- $self->config_( 'password', $self->{form__}{password} ) if ( defined($self->{form__}{password}) ); $self->config_( 'server', $self->{form__}{server} ) if ( defined($self->{form__}{server}) ); ! $self->config_( 'local', $self->{form__}{localpop}-1 ) if ( defined($self->{form__}{localpop}) ); ! $self->config_( 'local', $self->{form__}{localui}-1 ) if ( defined($self->{form__}{localui}) ); $self->config_( 'update_check', $self->{form__}{update_check}-1 ) if ( defined($self->{form__}{update_check}) ); $self->config_( 'send_stats', $self->{form__}{send_stats}-1 ) if ( defined($self->{form__}{send_stats}) ); *************** *** 1037,1041 **** $body .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\"><tr><td>\n"; ! if ( $self->config_( 'localui' ) == 1 ) { $body .= "<form class=\"securitySwitch\" action=\"/security\">\n"; $body .= "<span class=\"securityWidgetStateOff\">$self->{language__}{Security_NoStealthMode}</span>\n"; --- 1037,1041 ---- $body .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" summary=\"\"><tr><td>\n"; ! if ( $self->config_( 'local' ) == 1 ) { $body .= "<form class=\"securitySwitch\" action=\"/security\">\n"; $body .= "<span class=\"securityWidgetStateOff\">$self->{language__}{Security_NoStealthMode}</span>\n"; *************** *** 1584,1588 **** $self->config_( 'ecount', 0 ); for my $bucket ($self->{classifier__}->get_buckets()) { ! $self->{classifier__}->{parameters}{$bucket}{count} = 0; } $self->{classifier__}->write_parameters(); --- 1584,1588 ---- $self->config_( 'ecount', 0 ); for my $bucket ($self->{classifier__}->get_buckets()) { ! $self->{classifier__}->set_bucket_parameter( $bucket, 'count', 0 ); } $self->{classifier__}->write_parameters(); *************** *** 1609,1619 **** if ( ( defined($self->{form__}{bucket}) ) && ( defined($self->{form__}{subject}) ) && ( $self->{form__}{subject} > 0 ) ) { ! $self->{classifier__}->{parameters}{$self->{form__}{bucket}}{subject} = $self->{form__}{subject} - 1; ! $self->{classifier__}->write_parameters(); } if ( ( defined($self->{form__}{bucket}) ) && ( defined($self->{form__}{quarantine}) ) && ( $self->{form__}{quarantine} > 0 ) ) { ! $self->{classifier__}->{parameters}{$self->{form__}{bucket}}{quarantine} = $self->{form__}{quarantine} - 1; ! $self->{classifier__}->write_parameters(); } --- 1609,1617 ---- if ( ( defined($self->{form__}{bucket}) ) && ( defined($self->{form__}{subject}) ) && ( $self->{form__}{subject} > 0 ) ) { ! $self->{classifier__}->set_bucket_parameter( $self->{form__}{bucket}, 'subject', $self->{form__}{subject} - 1 ); } if ( ( defined($self->{form__}{bucket}) ) && ( defined($self->{form__}{quarantine}) ) && ( $self->{form__}{quarantine} > 0 ) ) { ! $self->{classifier__}->set_bucket_parameter( $self->{form__}{bucket}, 'quarantine', $self->{form__}{quarantine} - 1 ); } *************** *** 1678,1682 **** my $total_count = 0; foreach my $bucket (@buckets) { ! $total_count += $self->{classifier__}->{parameters}{$bucket}{count}; } --- 1676,1680 ---- my $total_count = 0; foreach my $bucket (@buckets) { ! $total_count += $self->{classifier__}->get_bucket_parameter( $bucket, 'count' ); } *************** *** 1702,1706 **** $body .= "<td align=\"center\">\n"; ! if ( $self->{classifier__}->{parameters}{$bucket}{subject} == 0 ) { $body .= "<form class=\"bucketsSwitch\" style=\"margin: 0\" action=\"/buckets\">\n"; $body .= "<span class=\"bucketsWidgetStateOff\">$self->{language__}{Off} </span>\n"; --- 1700,1704 ---- $body .= "<td align=\"center\">\n"; ! if ( $self->{classifier__}->get_bucket_parameter( $bucket, 'subject' ) == 0 ) { $body .= "<form class=\"bucketsSwitch\" style=\"margin: 0\" action=\"/buckets\">\n"; $body .= "<span class=\"bucketsWidgetStateOff\">$self->{language__}{Off} </span>\n"; *************** *** 1724,1728 **** $body .= "<td width=\"1%\"> </td><td align=\"center\">\n"; ! if ( $self->{classifier__}->{parameters}{$bucket}{quarantine} == 0 ) { $body .= "<form class=\"bucketsSwitch\" style=\"margin: 0\" action=\"/buckets\">\n"; $body .= "<span class=\"bucketsWidgetStateOff\">$self->{language__}{Off} </span>\n"; --- 1722,1726 ---- $body .= "<td width=\"1%\"> </td><td align=\"center\">\n"; ! if ( $self->{classifier__}->get_bucket_parameter( $bucket, 'quarantine' ) == 0 ) { $body .= "<form class=\"bucketsSwitch\" style=\"margin: 0\" action=\"/buckets\">\n"; $body .= "<span class=\"bucketsWidgetStateOff\">$self->{language__}{Off} </span>\n"; *************** *** 1846,1850 **** my %bar_values; for my $bucket (@buckets) { ! $bar_values{$bucket} = $self->{classifier__}->{parameters}{$bucket}{count}; } --- 1844,1848 ---- my %bar_values; for my $bucket (@buckets) { ! $bar_values{$bucket} = $self->{classifier__}->get_bucket_parameter( $bucket, 'count' ); } *************** *** 2490,2495 **** $self->{logger}->debug( "Reclassifying $mail_file from $bucket to $newbucket" ); ! $self->{classifier__}->{parameters}{$newbucket}{count} += 1; ! $self->{classifier__}->{parameters}{$bucket}{count} -= 1; # Update the class file --- 2488,2493 ---- $self->{logger}->debug( "Reclassifying $mail_file from $bucket to $newbucket" ); ! # TODO $self->{classifier__}->set_parameters( $newbucket, count} += 1; ! # TODO $self->{classifier__}->{parameters}{$bucket}{count} -= 1; # Update the class file *************** *** 2587,2592 **** if ( $bucket ne $usedtobe ) { $self->config_( 'ecount', $self->config_( 'ecount' ) - 1 ) if ( $self->config_( 'ecount' ) > 0 ); ! $self->{classifier__}->{parameters}{$bucket}{count} -= 1; ! $self->{classifier__}->{parameters}{$usedtobe}{count} += 1; } --- 2585,2590 ---- if ( $bucket ne $usedtobe ) { $self->config_( 'ecount', $self->config_( 'ecount' ) - 1 ) if ( $self->config_( 'ecount' ) > 0 ); ! # TODO $self->{classifier__}->{parameters}{$bucket}{count} -= 1; ! # TODO $self->{classifier__}->{parameters}{$usedtobe}{count} += 1; } |