- Timestamp:
- 09/01/08 19:33:58 (4 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
cybozu2ical/trunk/lib/WWW/CybozuOffice6/Calendar/RecurrentEvent.pm
r505 r518 23 23 n => 'WEEKDAYS' 24 24 ); 25 our @WEEK_STRING = ( 'SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA' ); 25 26 26 27 sub parse { … … 28 29 $this->SUPER::parse(%param); 29 30 30 # frequency 31 my $freq = $param{freq}; 32 return unless $freq && exists $FREQUENCY{$freq}; 31 my ( $type, $day ) = ( $param{type}, $param{day} ); 32 return 33 unless defined $type 34 && ( $type =~ /^[1-5]$/ || exists $FREQUENCY{$type} ); 35 36 ( $type, $day ) = ( 'm', $type . $WEEK_STRING[$day] ) 37 if $type =~ /^[1-5]$/; 33 38 34 39 # rrule 35 40 my %rrule = (); 36 if ( $FREQUENCY{$ freq} eq 'WEEKDAYS' ) {41 if ( $FREQUENCY{$type} eq 'WEEKDAYS' ) { 37 42 %rrule = ( FREQ => 'WEEKLY', BYDAY => 'MO,TU,WE,TH,FR' ); 38 43 } 39 44 else { 40 %rrule = ( FREQ => $FREQUENCY{$ freq} );45 %rrule = ( FREQ => $FREQUENCY{$type} ); 41 46 } 42 if ( $param{ freq_value} =~ /^\d(SU|MO|TU|WE|TH|FR|SA)$/ ) {43 $rrule{BYDAY} = $ param{freq_value};47 if ( $param{day} =~ /^\d(SU|MO|TU|WE|TH|FR|SA)$/ ) { 48 $rrule{BYDAY} = $day; 44 49 $rrule{INTERVAL} = 1; 45 50 } … … 51 56 my %args = ( year => $1, month => $2, day => $3 ); 52 57 my $until; 53 if ( $this-> {is_full_day}) {58 if ( $this->is_full_day ) { 54 59 $until = $this->to_datetime( $param{until_date}, ':' ); 55 60 } 56 61 else { 57 $until = $this-> {end}->clone->set(%args);62 $until = $this->end->clone->set(%args); 58 63 $until->set_time_zone('UTC'); # timezone must be UTC 59 64 } … … 61 66 } 62 67 63 $this-> {rrule} = \%rrule;68 $this->rrule( \%rrule ); 64 69 65 70 # exdates 66 if ( defined $param{ex dates} ) {71 if ( defined $param{exception} ) { 67 72 my @exdates; 68 for ( @{ $param{ex dates} } ) {69 push @exdates, $this->to_datetime( $_, $param{s tart_time} );73 for ( @{ $param{exception} } ) { 74 push @exdates, $this->to_datetime( $_, $param{set_time} ); 70 75 } 71 $this-> {exdates} = \@exdates;76 $this->exdates( \@exdates ); 72 77 } 73 78 74 79 # for compatibility 75 $this-> {frequency} = $FREQUENCY{$freq};76 $this-> {frequency_value} = $param{freq_value} || 0;77 $this-> {until} = $rrule{UNTIL}if exists $rrule{UNTIL};80 $this->frequency( $FREQUENCY{$type} ); 81 $this->frequency_value( $day || 0 ); 82 $this->until( $rrule{UNTIL} ) if exists $rrule{UNTIL}; 78 83 79 84 1;
![(please configure the [header_logo] section in trac.ini)](/public/chrome/common/trac_banner.png)