From: Sam S. <ssc...@us...> - 2005-02-20 10:06:09
|
Update of /cvsroot/popfile/engine/UI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24865/UI Modified Files: HTML.pm Log Message: Begin refactoring HTML UI "status" and "error" messages to use the new status_message__ and error_message__ functions. Progress: Admin page complete. POP3 widget(s) complete. validate_item now returns ($status, $error), both strings, indicating a status or error string to print to the UI. Index: HTML.pm =================================================================== RCS file: /cvsroot/popfile/engine/UI/HTML.pm,v retrieving revision 1.340 retrieving revision 1.341 diff -C2 -d -r1.340 -r1.341 *** HTML.pm 16 Feb 2005 13:59:33 -0000 1.340 --- HTML.pm 20 Feb 2005 10:05:59 -0000 1.341 *************** *** 1097,1108 **** $templ->param( 'Security_If_Send_Stats' => ( $self->user_config_( $self->{sessions__}{$session}{user}, 'send_stats' ) == 1 ) ); my %security_templates; for my $name (keys %{$self->{dynamic_ui__}{security}}) { $security_templates{$name} = $self->load_template__( $self->{dynamic_ui__}{security}{$name}{template}, $page, $session ); ! $self->{dynamic_ui__}{security}{$name}{object}->validate_item( $name, $security_templates{$name}, \%{$self->{language__}}, \%{$self->{form_}} ); } --- 1097,1113 ---- $templ->param( 'Security_If_Send_Stats' => ( $self->user_config_( $self->{sessions__}{$session}{user}, 'send_stats' ) == 1 ) ); + my ($status_message, $error_message); my %security_templates; for my $name (keys %{$self->{dynamic_ui__}{security}}) { $security_templates{$name} = $self->load_template__( $self->{dynamic_ui__}{security}{$name}{template}, $page, $session ); ! ($status_message, $error_message) = $self->{dynamic_ui__}{security}{$name}{object}->validate_item( $name, $security_templates{$name}, \%{$self->{language__}}, \%{$self->{form_}} ); + + # Tell the user anything the dynamic UI was interested in sharing + $self->status_message__($templ,$status_message) if ( defined( $status_message )); + $self->error_message__($templ, $error_message) if ( defined( $error_message )); } *************** *** 1111,1118 **** for my $name (keys %{$self->{dynamic_ui__}{chain}}) { $chain_templates{$name} = $self->load_template__( $self->{dynamic_ui__}{chain}{$name}{template}, $page, $session ); ! $self->{dynamic_ui__}{chain}{$name}{object}->validate_item( $name, $chain_templates{$name}, \%{$self->{language__}}, \%{$self->{form_}} ); } --- 1116,1128 ---- for my $name (keys %{$self->{dynamic_ui__}{chain}}) { $chain_templates{$name} = $self->load_template__( $self->{dynamic_ui__}{chain}{$name}{template}, $page, $session ); ! ($status_message, $error_message) = $self->{dynamic_ui__}{chain}{$name}{object}->validate_item( $name, $chain_templates{$name}, \%{$self->{language__}}, \%{$self->{form_}} ); + + # Tell the user anything the dynamic UI was interested in sharing + $self->status_message__($templ,$status_message) if ( defined( $status_message )); + $self->error_message__($templ, $error_message) if ( defined( $error_message )); + } *************** *** 1148,1161 **** my %dynamic_templates; - for my $name (keys %{$self->{dynamic_ui__}{configuration}}) { $dynamic_templates{$name} = $self->load_template__( $self->{dynamic_ui__}{configuration}{$name}{template}, $page, $session ); ! $self->{dynamic_ui__}{configuration}{$name}{object}->validate_item( $name, $dynamic_templates{$name}, \%{$self->{language__}}, \%{$self->{form_}} ); } --- 1158,1174 ---- my %dynamic_templates; for my $name (keys %{$self->{dynamic_ui__}{configuration}}) { $dynamic_templates{$name} = $self->load_template__( $self->{dynamic_ui__}{configuration}{$name}{template}, $page, $session ); ! ($status_message, $error_message) = $self->{dynamic_ui__}{configuration}{$name}{object}->validate_item( $name, $dynamic_templates{$name}, \%{$self->{language__}}, \%{$self->{form_}} ); + + # Tell the user anything the dynamic UI was interested in sharing + $self->status_message__($templ,$status_message) if ( defined( $status_message )); + $self->error_message__($templ, $error_message) if ( defined( $error_message )); } *************** *** 1165,1169 **** $self->config_( 'port', $self->{form_}{ui_port} ); } else { ! $templ->param( 'Configuration_If_UI_Port_Error' => 1 ); delete $self->{form_}{ui_port}; } --- 1178,1182 ---- $self->config_( 'port', $self->{form_}{ui_port} ); } else { ! $self->error_message__( $templ, $self->{language__}{Configuration_Error2} ); delete $self->{form_}{ui_port}; } *************** *** 1171,1176 **** if ( defined($self->{form_}{ui_port} ) ) { ! $templ->param( 'Configuration_UI_Port_Updated' => ! sprintf( $self->{language__}{Configuration_UIUpdate}, $self->config_( 'port' ) ) ); } --- 1184,1188 ---- if ( defined($self->{form_}{ui_port} ) ) { ! $self->status_message__( $templ, sprintf( $self->{language__}{Configuration_UIUpdate}, $self->config_( 'port' ) ) ); } *************** *** 1181,1190 **** $self->global_config_( 'timeout', $self->{form_}{timeout} ); } else { ! $templ->param( 'Configuration_If_TCP_Timeout_Error' => 1 ); delete $self->{form_}{timeout}; } } ! $templ->param( 'Configuration_TCP_Timeout_Updated' => sprintf( $self->{language__}{Configuration_TCPTimeoutUpdate}, $self->global_config_( 'timeout' ) ) ) if ( defined($self->{form_}{timeout} ) ); $templ->param( 'Configuration_TCP_Timeout' => $self->global_config_( 'timeout' ) ); --- 1193,1202 ---- $self->global_config_( 'timeout', $self->{form_}{timeout} ); } else { ! $self->error_message__( $self->{language__}{Configuration_Error6} ); delete $self->{form_}{timeout}; } } ! $self->status_message__( sprintf( $self->{language__}{Configuration_TCPTimeoutUpdate}, $self->global_config_( 'timeout' ) ) ) if ( defined($self->{form_}{timeout} ) ); $templ->param( 'Configuration_TCP_Timeout' => $self->global_config_( 'timeout' ) ); *************** *** 1385,1389 **** my ( $val, $default ) = $self->classifier_()->get_user_parameter_from_id( $id, $param ); $row_data{Users_Value} = $val; ! $row_data{Users_If_Changed} = !$default; push ( @parameter_list, \%row_data ); } --- 1397,1401 ---- my ( $val, $default ) = $self->classifier_()->get_user_parameter_from_id( $id, $param ); $row_data{Users_Value} = $val; ! $row_data{Users_If_Changed} = !$default; push ( @parameter_list, \%row_data ); } *************** *** 3237,3240 **** --- 3249,3254 ---- my ( $self, $templ, $message ) = @_; + $message =~ s/\n/<br \/>/; + my $old = $templ->param( 'Header_Error' ) || ''; $templ->param( 'Header_If_Error' => 1 ); |