From: naoki i. <am...@us...> - 2008-03-30 05:33:53
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29156/UI Modified Files: HTML.pm Log Message: Change Log 1. Add an interface and a function to change/initialize user's password UI/HTML.pm Classifier/Bayes.pm skins/default/users-page.thtml languages/English.msg 2. Bucket parameters are now copied from cloned user's Classifier/Bayes.pm 3. Non admin users can't access the Administration, Users and Advanced tabs. UI/HTML.pm 4. The history messages are now stored per user. 5. Users can't see/remove other users' history messages. Classifier/Bayes.pm POPFile/History.pm UI/HTML.pm 6. Sorting history messages now work correctly UI/HTML.pm skins/default/history-page.thtml 7. Server Mode options for SMTP and NNTP proxy are saved correctly 8. Server Mode checkboxes are disabled if all the modules are local UI/HTML.pm Proxy/POP3.pm Proxy/SMTP.pm Proxy/NNTP.pm 9. The 'Config Bar' string is now localizable skins/default/configration-bar.thtml languages/English.msg 10. The 'Stealth Mode' and 'Server Mode' strings are now localizable skins/default/administration-page.thtml languages/English.msg 11. Update language files languages/English.msg languages/Nihongo.msg Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.381 retrieving revision 1.382 diff -C2 -d -r1.381 -r1.382 *** HTML.pm 29 Jan 2008 15:03:29 -0000 1.381 --- HTML.pm 30 Mar 2008 05:33:58 -0000 1.382 *************** *** 611,615 **** if ( ( $slot =~ /^\d+$/ ) && ! ( $self->history_()->is_valid_slot( $slot ) ) ) { $self->http_redirect_( $client, "/view?view=$slot", $session ); --- 611,615 ---- if ( ( $slot =~ /^\d+$/ ) && ! ( $self->history_()->is_valid_slot( $slot, $session ) ) ) { $self->http_redirect_( $client, "/view?view=$slot", $session ); *************** *** 724,730 **** if ( !$self->user_global_config_( $self->{sessions__}{$session}{user}, 'can_admin' ) ) { ! delete $url_table{administration}; ! delete $url_table{advanced}; ! delete $url_table{users}; } --- 724,730 ---- if ( !$self->user_global_config_( $self->{sessions__}{$session}{user}, 'can_admin' ) ) { ! delete $url_table{'/administration'}; ! delete $url_table{'/advanced'}; ! delete $url_table{'/users'}; } *************** *** 1228,1232 **** $templ->param( 'Configuration_UI_Port' => $self->config_( 'port' ) ); $templ->param( 'If_Single_User' => $self->global_config_( 'single_user' ) ); - $templ->param( 'Security_If_Local_Http' => $self->config_( 'local') ); $templ->param( 'Security_If_Send_Stats' => $self->user_config_( $user, 'send_stats' ) ); $templ->param( 'Security_If_Update_Check' => $self->user_config_( $user, 'update_check' ) ); --- 1228,1231 ---- *************** *** 1235,1242 **** $templ->param( 'Configuration_Debug_' . ( $self->global_config_( 'debug' ) + 1 ) . '_Selected' => 'selected="selected"' ); ! #my $all_local = 1; ! $templ->param( "Security_If_Local_html" => $self->config_( 'local') ); ! #$templ->param( 'Security_If_Local' => $all_local ); ! my ($status_message, $error_message); --- 1234,1239 ---- $templ->param( 'Configuration_Debug_' . ( $self->global_config_( 'debug' ) + 1 ) . '_Selected' => 'selected="selected"' ); ! $templ->param( "Security_If_Local_html" => $self->config_( 'local' ) ); ! my $all_local = $self->config_( 'local' ); my ($status_message, $error_message); *************** *** 1271,1285 **** $self->status_message__($templ,$status_message) if ( defined( $status_message )); $self->error_message__($templ, $error_message) if ( defined( $error_message )); - } my $security_html = ''; for my $name (sort keys %{$self->{dynamic_ui__}{security}}) { ! $self->{dynamic_ui__}{security}{$name}{object}->configure_item( $name, $security_templates{$name}, \%{$self->{language__}} ); $security_html .= $security_templates{$name}->output; } my $chain_html = ''; --- 1268,1292 ---- $self->status_message__($templ,$status_message) if ( defined( $status_message )); $self->error_message__($templ, $error_message) if ( defined( $error_message )); } + # Build Securty panel + my $security_html = ''; for my $name (sort keys %{$self->{dynamic_ui__}{security}}) { ! my $local = $self->{dynamic_ui__}{security}{$name}{object}->configure_item( $name, $security_templates{$name}, \%{$self->{language__}} ); + $all_local &&= $local; + } + + # If all modules are local, disable checkboxes + + for my $name (sort keys %{$self->{dynamic_ui__}{security}}) { + $security_templates{$name}->param( 'Security_If_Local' => $all_local ); $security_html .= $security_templates{$name}->output; } + $templ->param( 'Security_If_Local' => $all_local ); + my $chain_html = ''; *************** *** 1475,1478 **** --- 1482,1522 ---- } + # Handle changing/initializing user's password + + if ( exists( $self->{form_}{users_change_password} ) && + ( $self->{form_}{tochangepassword} ne '' ) ) { + + my $initialize_password = $self->{form_}{users_reset_password}; + + if ( $initialize_password ) { + # Initialize user's password + my ($result, $new_password) = $self->classifier_()->initialize_users_password( $session, $self->{form_}{tochangepassword} ); + if ( $result == 0 ) { + $self->status_message__( $templ, sprintf( $self->{language__}{Users_Reset_Password}, $self->{form_}{tochangepassword}, $new_password ) ); + } + if ( $result == 1 ) { + $self->error_message__( $templ, sprintf( $self->{language__}{Users_Reset_Password_Failed}, $self->{form_}{tochangepassword} ) ); + } + + } else { + # Change user's password + + my $new_password = $self->{form_}{users_new_password}; + my $confirm_password = $self->{form_}{users_confirm_password}; + + if ( $new_password eq $confirm_password ) { + my $result = $self->classifier_()->change_users_password( $session, $self->{form_}{tochangepassword}, $new_password ); + if ( $result == 0 ) { + $self->status_message__( $templ, sprintf( $self->{language__}{Users_Changed_Password}, $self->{form_}{tochangepassword} ) ); + } + if ( $result == 1 ) { + $self->error_message__( $templ, sprintf( $self->{language__}{Users_Change_Password_Failed}, $self->{form_}{tochangepassword} ) ); + } + } else { + $self->error_message__( $templ, sprintf( $self->{language__}{Users_Change_Password_Failed_Mismatch}, $self->{form_}{tochangepassword} ) ); + } + } + } + # Handle editing the parameters of a user *************** *** 1520,1524 **** my @user_loop; my @remove_user_loop; ! foreach my $user (@$users) { my %row_data; $row_data{Users_Name} = $user; --- 1564,1568 ---- my @user_loop; my @remove_user_loop; ! foreach my $user (values %$users) { my %row_data; $row_data{Users_Name} = $user; *************** *** 1534,1537 **** --- 1578,1582 ---- $templ->param( 'Users_Loop_Edit' => \@user_loop ); $templ->param( 'Users_Loop_Copy' => \@user_loop ); + $templ->param( 'Users_Loop_ChangePassword' => \@user_loop ); if ( exists( $self->{form_}{edituser} ) && *************** *** 2668,2672 **** if ( $key =~ /^undo_([0-9]+)$/ ) { my $slot = $1; ! my @fields = $self->history_()->get_slot_fields( $slot ); my $bucket = $fields[8]; my $newbucket = $self->classifier_()->get_bucket_name( --- 2713,2717 ---- if ( $key =~ /^undo_([0-9]+)$/ ) { my $slot = $1; ! my @fields = $self->history_()->get_slot_fields( $slot, $session ); my $bucket = $fields[8]; my $newbucket = $self->classifier_()->get_bucket_name( *************** *** 2709,2713 **** if ( $destination <= $maximum && $destination > 0 ) { return $self->http_redirect_( $client, "/history?start_message=$destination&" ! . $self->print_form_fields_(1,0,('filter','search','sort','session','negate') ), $session ); } } --- 2754,2758 ---- if ( $destination <= $maximum && $destination > 0 ) { return $self->http_redirect_( $client, "/history?start_message=$destination&" ! . $self->print_form_fields_(1,0,('filter','search','sort','negate') ), $session ); } } *************** *** 2818,2823 **** if ( defined( $self->{form_}{clearpage} ) ) { ! # Remove the list of marked messages using the array of ! # "remove" checkboxes $self->history_()->start_deleting(); --- 2863,2867 ---- if ( defined( $self->{form_}{clearpage} ) ) { ! # Remove the list of messages on the current page $self->history_()->start_deleting(); *************** *** 2825,2829 **** if ( $i =~ /^rowid_(\d+)$/ ) { $self->log_( 1, "clearpage $i" ); ! $self->history_()->delete_slot( $1, 1 ); } } --- 2869,2873 ---- if ( $i =~ /^rowid_(\d+)$/ ) { $self->log_( 1, "clearpage $i" ); ! $self->history_()->delete_slot( $1, 1, $session, 0 ); } } *************** *** 2842,2846 **** if ( $self->{form_}{$i} ne '' ) { $self->log_( 1, "clearchecked $i" ); ! $self->history_()->delete_slot( $slot ); } } --- 2886,2890 ---- if ( $self->{form_}{$i} ne '' ) { $self->log_( 1, "clearchecked $i" ); ! $self->history_()->delete_slot( $slot, 0, $session, 0 ); } } *************** *** 2855,2859 **** if ( defined( $self->{form_}{clearall} ) ) { ! $self->history_()->delete_query( $q ); } --- 2899,2903 ---- if ( defined( $self->{form_}{clearall} ) ) { ! $self->history_()->delete_query( $q, $session ); } *************** *** 2870,2874 **** defined( $self->{form_}{undo} ) || defined( $self->{form_}{reclassify} ) ) { # PROFILE BLOCK STOP ! return $self->http_redirect_( $client, "/history?" . $self->print_form_fields_(1,0,('start_message','filter','search','sort','session','negate') ), $session ); } --- 2914,2918 ---- defined( $self->{form_}{undo} ) || defined( $self->{form_}{reclassify} ) ) { # PROFILE BLOCK STOP ! return $self->http_redirect_( $client, "/history?" . $self->print_form_fields_(1,0,('start_message','filter','search','sort','negate') ), $session ); } *************** *** 2946,2950 **** $row_data{History_Fields} = $self->print_form_fields_(1,1, ! ('filter','session','search','negate')); $row_data{History_Sort} = ( $self->{form_}{sort} eq $header )?'-':''; --- 2990,2994 ---- $row_data{History_Fields} = $self->print_form_fields_(1,1, ! ('filter','search','negate')); $row_data{History_Sort} = ( $self->{form_}{sort} eq $header )?'-':''; *************** *** 3061,3065 **** $col_data{History_Fields} = $self->print_form_fields_(0,1, ! ('start_message','session','filter','search', 'sort','negate' ) ); push ( @column_data, \%col_data ); --- 3105,3109 ---- $col_data{History_Fields} = $self->print_form_fields_(0,1, ! ('start_message','filter','search', 'sort','negate' ) ); push ( @column_data, \%col_data ); *************** *** 3198,3207 **** my ( $self, $client, $templ, $template, $page, $session ) = @_; - my $mail_file = $self->history_()->get_slot_file( $self->{form_}{view} ); - my $start_message = $self->{form_}{start_message} || 0; - my ( $id, $from, $to, $cc, $subject, $date, $hash, $inserted, $bucket, $reclassified, $bucketid, $magnet ) = ! $self->history_()->get_slot_fields( $self->{form_}{view} ); my $color = $self->classifier_()->get_bucket_color( --- 3242,3256 ---- my ( $self, $client, $templ, $template, $page, $session ) = @_; my ( $id, $from, $to, $cc, $subject, $date, $hash, $inserted, $bucket, $reclassified, $bucketid, $magnet ) = ! $self->history_()->get_slot_fields( $self->{form_}{view}, $session ); ! ! if ( !defined($id) ) { ! $self->http_redirect_( $client, "/history", $session ); ! return 1; ! } ! ! my $mail_file = $self->history_()->get_slot_file( $self->{form_}{view} ); ! my $start_message = $self->{form_}{start_message} || 0; my $color = $self->classifier_()->get_bucket_color( *************** *** 3230,3234 **** my $index = $self->{form_}{view}; ! $templ->param( 'View_All_Fields' => $self->print_form_fields_(1,1,('start_message','filter','session','search','sort','negate'))); $templ->param( 'View_Field_Search' => $self->{form_}{search} ); $templ->param( 'View_Field_Negate' => $self->{form_}{negate} ); --- 3279,3283 ---- my $index = $self->{form_}{view}; ! $templ->param( 'View_All_Fields' => $self->print_form_fields_(1,1,('start_message','filter','search','sort','negate'))); $templ->param( 'View_Field_Search' => $self->{form_}{search} ); $templ->param( 'View_Field_Negate' => $self->{form_}{negate} ); |