From: Chris W. <la...@us...> - 2004-12-05 08:52:25
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Action In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16278/pkg/comments/OpenInteract2/Action Modified Files: Comments.pm Log Message: update packages to move as many messages as possible out of code and into message files; use new add_status/add_error shortcuts Index: Comments.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/comments/OpenInteract2/Action/Comments.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Comments.pm 28 Nov 2004 06:46:09 -0000 1.8 --- Comments.pm 5 Dec 2004 08:51:22 -0000 1.9 *************** *** 117,122 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_listing', "$@" ) ); $log->error( "Cannot fetch comments: $@" ); } --- 117,121 ---- }; if ( $@ ) { ! $self->add_error_key( 'comments.error.cannot_fetch_listing', "$@" ); $log->error( "Cannot fetch comments: $@" ); } *************** *** 189,194 **** if ( $@ ) { $log->error( "Error fetching comments: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_by_object', "$@" ) ); } else { --- 188,192 ---- if ( $@ ) { $log->error( "Error fetching comments: $@" ); ! $self->add_error_key( 'comments.error.cannot_fetch_by_object', "$@" ); } else { *************** *** 216,221 **** if ( $@ ) { $log->error( "Error retrieving comment '$comment_id': $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch', "$@" ) ); } if ( $comment ) { --- 214,218 ---- if ( $@ ) { $log->error( "Error retrieving comment '$comment_id': $@" ); ! $self->add_error_key( 'comments.error.cannot_fetch', "$@" ); } if ( $comment ) { *************** *** 224,234 **** else { $log->error( "No comment found for given ID '$comment_id'" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.not_found' ) ); } } else { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.no_id' ) ); } --- 221,229 ---- else { $log->error( "No comment found for given ID '$comment_id'" ); ! $self->add_error_key( 'comments.error.not_found' ); } } else { ! $self->add_error_key( 'comments.error.no_id' ); } *************** *** 283,294 **** $object = eval { $obj_class->fetch( $comment->{object_id} ) }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_object', "$@" ) ); $object = undef; } } else { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.no_class_for_object' ) ); } return $object; --- 278,287 ---- $object = eval { $obj_class->fetch( $comment->{object_id} ) }; if ( $@ ) { ! $self->add_error_key( 'comments.error.cannot_fetch_object', "$@" ); $object = undef; } } else { ! $self->add_error_key( 'comments.error.no_class_for_object' ); } return $object; *************** *** 399,404 **** if ( scalar @required_missing ) { ! my $msg = $self->_msg( 'comments.error.data_missing', join( ', ', @required_missing ) ); ! $self->param_add( error_msg => $msg ); return $self->_show_editable; } --- 392,397 ---- if ( scalar @required_missing ) { ! $self->add_error_key( 'comments.error.data_missing', ! join( ', ', @required_missing ) ); return $self->_show_editable; } *************** *** 438,447 **** if ( $@ ) { $log->error( "Failed to add comment: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_add', "$@" ) ); } else { ! $self->param_add( ! status_msg => $self->_msg( 'comments.status.add_ok' ) ); # These are used for the listing page we go to next... --- 431,438 ---- if ( $@ ) { $log->error( "Failed to add comment: $@" ); ! $self->add_error_key( 'comments.error.cannot_add', "$@" ); } else { ! $self->add_error_key( 'comments.status.add_ok' ); # These are used for the listing page we go to next... *************** *** 456,460 **** my $notify_status = $self->_add_user_notification( $comment ); if ( $notify_status ) { ! $self->param_add( status_msg => $notify_status ); } } --- 447,451 ---- my $notify_status = $self->_add_user_notification( $comment ); if ( $notify_status ) { ! $self->add_status( $notify_status ); } } *************** *** 545,550 **** $log->info( "Posted wants to be notified but didn't ", "provide an email address" ); ! return join( '', 'Could not add notification since you did ' . ! 'not give me your email address. Sorry.' ); } --- 536,541 ---- $log->info( "Posted wants to be notified but didn't ", "provide an email address" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_no_email' ); ! return; } *************** *** 553,558 **** $log->info( "Posted wants to be notified but provided a bad ", "email address: '$comment->{poster_email}'" ); ! return $self->_msg( 'comments.error.cannot_add_notify_bad_email', ! $comment->{poster_email} ); } --- 544,550 ---- $log->info( "Posted wants to be notified but provided a bad ", "email address: '$comment->{poster_email}'" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_bad_email', ! $comment->{poster_email} ); ! return; } *************** *** 569,573 **** $log->error( "Error fetching notifications for: ", "'$comment->{class}: $comment->{object_id}': $@" ); ! return $self->_msg( 'comments.error.cannot_add_notify_error_dupe_check' ); } --- 561,566 ---- $log->error( "Error fetching notifications for: ", "'$comment->{class}: $comment->{object_id}': $@" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_error_dupe_check' ); ! return } *************** *** 576,580 **** $log->is_info && $log->info( "No notification added: already exists in thread" ); ! return $self->_msg( 'comments.error.cannot_add_notify_is_dupe' ); } --- 569,574 ---- $log->is_info && $log->info( "No notification added: already exists in thread" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_is_dupe' ); ! return; } *************** *** 589,595 **** if ( $@ ) { $log->error( "Failed to save notification: $@" ); ! return $self->_msg( 'comments.error.cannot_add_notify_persist', "$@" ); } ! return $self->_msg( 'comments.status.add_notify_ok' ); } --- 583,591 ---- if ( $@ ) { $log->error( "Failed to save notification: $@" ); ! $self->add_error_key( 'comments.error.cannot_add_notify_persist', "$@" ); ! return; } ! $self->add_status_key( 'comments.status.add_notify_ok' ); ! return; } *************** *** 664,668 **** sub remove { my ( $self ) = @_; ! $self->param_add( error_msg => 'REMOVE not implemented yet' ); return $self->list_by_object; } --- 660,664 ---- sub remove { my ( $self ) = @_; ! $self->add_error( 'REMOVE not implemented yet' ); return $self->list_by_object; } *************** *** 700,705 **** $log->error( "Error fetching notifications for ", "[$obj_class: $obj_id]: $@" ); ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_notify', "$@" ) ); } else { --- 696,700 ---- $log->error( "Error fetching notifications for ", "[$obj_class: $obj_id]: $@" ); ! $self->add_error_key( 'comments.error.cannot_fetch_notify', "$@" ); } else { *************** *** 730,735 **** }; if ( $@ ) { ! $self->param_add( ! error_msg => $self->_msg( 'comments.error.cannot_fetch_recent', "$@" ) ); } else { --- 725,729 ---- }; if ( $@ ) { ! $self->add_error_key( 'comments.error.cannot_fetch_recent', "$@" ); } else { |