From: Chris W. <la...@us...> - 2005-03-02 15:31:45
|
Update of /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/ActionResolver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25635/OpenInteract2/ActionResolver Modified Files: UserDir.pm NotFoundOrEmpty.pm NameAndTask.pm Log Message: OIN-135: modify resolvers to forward additional URL params up to parent method; what 'additional' means depends on the resolver Index: UserDir.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/ActionResolver/UserDir.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** UserDir.pm 25 Feb 2005 00:05:05 -0000 1.2 --- UserDir.pm 2 Mar 2005 15:31:34 -0000 1.3 *************** *** 19,32 **** sub resolve { my ( $self, $request, $url ) = @_; ! return undef unless ( $url =~ m!^(/~|~)(\w+)(/(\w+))?! ); ! my $username = $2; ! my $task = $4 || 'display'; ! $log ||= get_logger( LOG_ACTION ); my $action = CTX->lookup_action( 'user' ); $action->task( $task ); $action->param( login_name => $username ); $log->is_info && $log->info( "Created userdir action for '$username' ", "performing task '$task'" ); return $action; } --- 19,34 ---- sub resolve { my ( $self, $request, $url ) = @_; ! return undef unless ( $url =~ m|^/?~| ); ! $url =~ s|^/||; $url =~ s/\?.*$//; $url =~ s|/$||; ! my ( $username, $task, @params ) = split /\//, $url; ! $task ||= 'display'; my $action = CTX->lookup_action( 'user' ); $action->task( $task ); $action->param( login_name => $username ); + $log ||= get_logger( LOG_ACTION ); $log->is_info && $log->info( "Created userdir action for '$username' ", "performing task '$task'" ); + $self->assign_additional_params_from_url( $request, @params ); return $action; } *************** *** 46,55 **** http://.../~cwinters http://.../~cwinters/display_groups/ ! http://.../~cwinters/display/ =head1 DESCRIPTION Respond to URLs with leading '~' characters. Everything after the '~' ! is used as the user's name you wish to display or manipulate. =head1 OBJECT METHODS --- 48,58 ---- http://.../~cwinters http://.../~cwinters/display_groups/ ! http://.../~cwinters/last_post/5 =head1 DESCRIPTION Respond to URLs with leading '~' characters. Everything after the '~' ! up to the path separator is used as the user's name you wish to ! display or manipulate. =head1 OBJECT METHODS Index: NotFoundOrEmpty.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/ActionResolver/NotFoundOrEmpty.pm,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NotFoundOrEmpty.pm 14 Feb 2005 18:23:23 -0000 1.2 --- NotFoundOrEmpty.pm 2 Mar 2005 15:31:34 -0000 1.3 *************** *** 17,21 **** sub get_name { return 'notfound' } ! sub get_order { return 10 } sub resolve { --- 17,22 ---- sub get_name { return 'notfound' } ! # This goes to 11! ! sub get_order { return 11 } sub resolve { *************** *** 47,51 **** OpenInteract2::ActionResolver->register_factory_type( get_name() => __PACKAGE__ ); - 1; --- 48,51 ---- *************** *** 68,77 **** =head1 DESCRIPTION ! =head1 CLASS METHODS ! ! =head1 OBJECT METHODS =head1 SEE ALSO =head1 COPYRIGHT --- 68,80 ---- =head1 DESCRIPTION ! This resolver always fires last. If an action name has not been found ! from the URL we create the action specified in the server ! configuration under 'action_info.not_found. Similarly, if there is no ! action specified we create the action specified in 'action_info.none'. =head1 SEE ALSO + L<OpenInteract2::ActionResolver> + =head1 COPYRIGHT Index: NameAndTask.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/lib/OpenInteract2/ActionResolver/NameAndTask.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NameAndTask.pm 13 Feb 2005 20:37:35 -0000 1.1 --- NameAndTask.pm 2 Mar 2005 15:31:34 -0000 1.2 *************** *** 22,26 **** $log ||= get_logger( LOG_ACTION ); ! my ( $action_name, $task_name ) = OpenInteract2::URL->parse( $url ); return undef unless ( $action_name ); --- 22,26 ---- $log ||= get_logger( LOG_ACTION ); ! my ( $action_name, $task_name, @params ) = OpenInteract2::URL->parse( $url ); return undef unless ( $action_name ); *************** *** 42,45 **** --- 42,46 ---- $log->info( "Assigned task '$task_name' to action" ); } + $self->assign_additional_params_from_url( $request, @params ); return $action } *************** *** 63,67 **** http://.../news/display/ ! # same as above http://.../news/display/63783/ --- 64,69 ---- http://.../news/display/ ! # same as above, but assigning '63783' as the first ! # 'param_url_additional()' request property http://.../news/display/63783/ |