|
From: Chris W. <la...@us...> - 2005-09-21 04:05:46
|
Update of /cvsroot/openinteract/OpenInteract2/pkg/object_tags/OpenInteract2/Observer In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8021/OpenInteract2/Observer Modified Files: AddObjectTags.pm Log Message: make the field we use to lookup the tag values configurable Index: AddObjectTags.pm =================================================================== RCS file: /cvsroot/openinteract/OpenInteract2/pkg/object_tags/OpenInteract2/Observer/AddObjectTags.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AddObjectTags.pm 29 Mar 2005 05:10:37 -0000 1.1 --- AddObjectTags.pm 21 Sep 2005 04:05:35 -0000 1.2 *************** *** 33,40 **** return; } ! my $tag_listing = $action->param( 'tags' ) ! || CTX->request->param( 'tags' ); unless ( $tag_listing ) { ! $log->warn( "No object tags found $action_desc" ); return; } --- 33,45 ---- return; } ! my $lh = CTX->language_handle(); ! my $tag_field = $action->param( 'tag_field' ) ! || $lh->maketext( 'object_tags.tag_field' ) ! || 'tags'; ! my $tag_listing = $action->param( $tag_field ) ! || CTX->request->param( $tag_field ); unless ( $tag_listing ) { ! $log->warn( "No object tags found in param ", ! "'$tag_field' $action_desc" ); return; } *************** *** 95,109 **** =item * ! Finds the tags to attach in the action parameter 'tags' or the ! L<OpenInteract2::Request> parameter 'tags'. If no tags are found the ! observer does nothing. =item * ! On finding everything we pass the data to the C<add_tags> method of ! L<OpenInteract2::TaggableObject>. =back =head1 SEE ALSO --- 100,148 ---- =item * ! Finds the tags to attach in one of the fields listed below. If no tags ! are found in that field the observer does nothing. =item * ! On finding the object and associated tags we pass the data to the ! C<add_tags> method of L<OpenInteract2::TaggableObject>. =back + =head2 Finding the tags + + You can specify the field to lookup tag values using the first match + of the following: + + =over 4 + + =item 1. + + The field in the action parameter 'tag_field', such as: + + [myaction] + class = OpenInteract2::Action::MyAction + tag_field = mytags + + Which would correspond to the input field: + + <input name="mytags" ... + + =item 2. + + The message key 'object_tags.tag_field', which allows: + + <input name="[% MSG( 'object_tags.tag_field' ) %]" ... + + =item 3. + + The value 'tags' + + =back + + So we cycle through each of these and on the first found, check both + the action parameter and request parameter for a value. First found + wins. (It's almost always in the request parameter.) + =head1 SEE ALSO |