| 1 | package OpenInteract2::Conversion::ActionConfig; | ||
| 2 | |||
| 3 | # $Id: ActionConfig.pm,v 1.6 2005/03/17 14:58:01 sjn Exp $ | ||
| 4 | |||
| 5 | use strict; | ||
| 6 | use base qw( OpenInteract2::Conversion::IniConfig ); | ||
| 7 | use OpenInteract2::Exception qw( oi_error ); | ||
| 8 | |||
| 9 | $OpenInteract2::Conversion::ActionConfig::VERSION = sprintf("%d.%02d", q$Revision: 1.6 $ =~ /(\d+)\.(\d+)/); | ||
| 10 | |||
| 11 | my @ORDER = qw( class method security template package title weight | ||
| 12 | is_lookup object_key order field_list label_list size_list | ||
| 13 | is_directory ); | ||
| 14 | |||
| 15 | sub get_field_order { | ||
| 16 | return \@ORDER; | ||
| 17 | } | ||
| 18 | |||
| 19 | sub init { | ||
| 20 | my ( $self ) = @_; | ||
| 21 | $self->transforms({ class => \&_modify_class, | ||
| 22 | security => \&_modify_security } ); | ||
| 23 | return $self; | ||
| 24 | } | ||
| 25 | |||
| 26 | sub _modify_class { | ||
| 27 | my ( $name, $value ) = @_; | ||
| 28 | $value =~ s/OpenInteract::Handler/OpenInteract2::Action/g; | ||
| 29 | $value =~ s/OpenInteract::/OpenInteract2::/g; | ||
| 30 | return ( $name, $value ); | ||
| 31 | } | ||
| 32 | |||
| 33 | sub _modify_security { | ||
| 34 | my ( $name, $value ) = @_; | ||
| 35 | $value = ( $value and $value ne 'no' ) ? 'yes' : 'no'; | ||
| 36 | return ( 'is_secure', $value ); | ||
| 37 | } | ||
| 38 | |||
| 39 | sub _modify_true_to_yes { | ||
| 40 | my ( $name, $value ) = @_; | ||
| 41 | return ( $name, 'yes' ) if ( $value ); | ||
| 42 | return ( $name, 'no' ); | ||
| 43 | } | ||
| 44 | |||
| 45 | 1; | ||
| 46 | |||
| 47 | __END__ |