|
From: <jgr...@us...> - 2003-04-21 20:54:05
|
Update of /cvsroot/popfile/engine/UI
In directory sc8-pr-cvs1:/tmp/cvs-serv22382/UI
Modified Files:
HTML.pm
Log Message:
Fix bug where clicking on a empty bucket caused a crash; added new clear_bucket API; added new Remove All Words button to bucket page; change the get_scores and clear_scores APIs to be a standard scores getter/setter as in the style of POPFile::Module
Index: HTML.pm
===================================================================
RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v
retrieving revision 1.143
retrieving revision 1.144
diff -C2 -d -r1.143 -r1.144
*** HTML.pm 21 Apr 2003 09:05:48 -0000 1.143
--- HTML.pm 21 Apr 2003 20:54:00 -0000 1.144
***************
*** 1425,1428 ****
--- 1425,1433 ----
$body .= "<td></td>\n<td align=\"right\">$percent</td>\n<td></td>\n</tr>\n</table>\n";
+ $body .= "<form action=\"/buckets\"><input type=\"hidden\" name=\"session\" value=\"$self->{session_key__}\" />";
+ $body .= "<input type=\"hidden\" name=\"bucket\" value=\"$self->{form_}{showbucket}\" />";
+ $body .= "<input type=\"submit\" name=\"clearbucket\" value=\"$self->{language__}{SingleBucket_ClearBucket}\" />";
+ $body .= "</form>";
+
$body .= "<h2 class=\"buckets\">";
$body .= sprintf( $self->{language__}{SingleBucket_WordTable}, "<font color=\"" . $self->{classifier__}->get_bucket_color($self->{form_}{showbucket}) . "\">$self->{form_}{showbucket}" ) ;
***************
*** 1430,1467 ****
$body .= "<tr><td colspan=2>";
! for my $i (@{$self->{classifier__}->get_bucket_word_list($self->{form_}{showbucket})}) {
if ( defined($i) ) {
! my $j = $i;
! $j =~ /^\|(.)/;
! my $first = $1;
! if ( defined( $self->{form_}{showletter} ) && ( $first eq $self->{form_}{showletter} ) ) {
! # Split the entries on the double bars
! my %temp;
! while ( $j =~ m/\G\|(.*?) L?\-?[\.\d]+\|/g ) {
! my $word = $1;
! $temp{$word} = int( exp( $self->{classifier__}->get_value_( $self->{form_}{showbucket}, $word ) ) * $bucket_count + 1 );
! }
! $body .= "</td></tr><tr><td colspan=2> </td></tr><tr>\n<td valign=\"top\">\n<b>$first</b>\n</td>\n<td valign=\"top\">\n<table><tr valign=\"top\">";
! my $count = 0;
! for my $word (sort { $temp{$b} <=> $temp{$a} } keys %temp) {
! $body .= "</tr><tr valign=\"top\">" if ( ( $count % 6 ) == 0 );
! $body .= "<td><a class=\"wordListLink\" href=\"\/buckets\?session=$self->{session_key__}\&lookup=Lookup\&word=$word#Lookup\"><b>$word</b><\/a></td><td>$temp{$word}</td><td> </td>";
! $count += 1;
! }
! $body .= "</tr></table></td>\n</tr>\n<tr><td colspan=2> </td></tr><tr><td colspan=2>";
! } else {
! $j = '';
! $body .= "<a href=/buckets?session=$self->{session_key__}\&showbucket=$self->{form_}{showbucket}\&showletter=$first><b>$first</b></a>\n";
! }
}
}
--- 1435,1474 ----
$body .= "<tr><td colspan=2>";
! if ( $self->{classifier__}->get_bucket_word_count( $self->{form_}{showbucket} ) > 0 ) {
! for my $i (@{$self->{classifier__}->get_bucket_word_list($self->{form_}{showbucket})}) {
if ( defined($i) ) {
! my $j = $i;
! $j =~ /^\|(.)/;
! my $first = $1;
! if ( defined( $self->{form_}{showletter} ) && ( $first eq $self->{form_}{showletter} ) ) {
! # Split the entries on the double bars
! my %temp;
! while ( $j =~ m/\G\|(.*?) L?\-?[\.\d]+\|/g ) {
! my $word = $1;
! $temp{$word} = int( exp( $self->{classifier__}->get_value_( $self->{form_}{showbucket}, $word ) ) * $bucket_count + 1 );
! }
! $body .= "</td></tr><tr><td colspan=2> </td></tr><tr>\n<td valign=\"top\">\n<b>$first</b>\n</td>\n<td valign=\"top\">\n<table><tr valign=\"top\">";
! my $count = 0;
! for my $word (sort { $temp{$b} <=> $temp{$a} } keys %temp) {
! $body .= "</tr><tr valign=\"top\">" if ( ( $count % 6 ) == 0 );
! $body .= "<td><a class=\"wordListLink\" href=\"\/buckets\?session=$self->{session_key__}\&lookup=Lookup\&word=$word#Lookup\"><b>$word</b><\/a></td><td>$temp{$word}</td><td> </td>";
! $count += 1;
! }
! $body .= "</tr></table></td>\n</tr>\n<tr><td colspan=2> </td></tr><tr><td colspan=2>";
! } else {
! $j = '';
! $body .= "<a href=/buckets?session=$self->{session_key__}\&showbucket=$self->{form_}{showbucket}\&showletter=$first><b>$first</b></a>\n";
! }
}
+ }
}
***************
*** 1550,1553 ****
--- 1557,1564 ----
my ( $self, $client ) = @_;
+ if ( defined( $self->{form_}{clearbucket} ) ) {
+ $self->{classifier__}->clear_bucket( $self->{form_}{bucket} );
+ }
+
if ( defined($self->{form_}{reset_stats}) ) {
$self->global_config_( 'mcount', 0 );
***************
*** 3031,3036 ****
$self->{classifier__}->wordscores( 0 );
! $body .= $self->{classifier__}->get_scores();
! $self->{classifier__}->clear_scores();
# Close button
--- 3042,3047 ----
$self->{classifier__}->wordscores( 0 );
! $body .= $self->{classifier__}->scores();
! $self->{classifier__}->scores('');
# Close button
|