Changeset 2715

Show
Ignore:
Timestamp:
07/04/08 08:47:40 (20 months ago)
Author:
fumiakiy
Message:

Populate template maps whose build type is dynamic and the file template is changed upon saving the template, to update fileinfo records. BugId:80446

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-41/lib/MT/CMS/Template.pm

    r2707 r2715  
    14141414        require MT::TemplateMap; 
    14151415        my @p = $q->param; 
    1416         my @static_maps; 
     1416        my %static_maps; 
    14171417        for my $p (@p) { 
    14181418            my $map; 
     
    14281428                $map    = MT::TemplateMap->load($map_id) 
    14291429                    or next; 
    1430                 $map->file_template( $q->param($p) ); 
     1430                my $file_template = $q->param($p); 
     1431                my $build_type_1  = $q->param("map_build_type_$map_id"); 
     1432                # Populate maps whose build type is dynamic 
     1433                # and file template are changed 
     1434                $static_maps{ $map->id } = 1 
     1435                    if ( ( $file_template ne $map->file_template ) 
     1436                      && ( MT::PublishOption::DYNAMIC() eq $build_type_1 ) ); 
     1437                $map->file_template( $file_template ); 
    14311438                $map->save; 
    14321439            } 
     
    14391446                # Populate maps that are changed from static to dynamic 
    14401447                # This should capture new map as well 
    1441                 push @static_maps, $map->id 
     1448                $static_maps{ $map->id } = 1 
    14421449                    if ( ( $build_type ne $map->build_type ) 
    14431450                      && ( MT::PublishOption::DYNAMIC() eq $build_type ) ); 
     
    14571464            } 
    14581465        } 
    1459         $app->{static_dynamic_maps} = @static_maps ? \@static_maps : 0; 
     1466        $app->{static_dynamic_maps} = %static_maps ? [ keys %static_maps ] : 0; 
    14601467    } 
    14611468