Index: /branches/release-39/lib/MT/CMS/Template.pm
===================================================================
--- /branches/release-39/lib/MT/CMS/Template.pm (revision 2491)
+++ /branches/release-39/lib/MT/CMS/Template.pm (revision 2502)
@@ -1397,4 +1397,5 @@
         require MT::TemplateMap;
         my @p = $q->param;
+        my @static_maps;
         for my $p (@p) {
             my $map;
@@ -1419,4 +1420,9 @@
                 my $build_type = $q->param($p);
                 require MT::PublishOption;
+                # Populate maps that are changed from static to dynamic
+                # This should capture new map as well
+                push @static_maps, $map->id
+                    if ( ( $build_type ne $map->build_type )
+                      && ( MT::PublishOption::DYNAMIC() eq $build_type ) );
                 $map->build_type($build_type);
                 if ( $build_type == MT::PublishOption::SCHEDULED() ) {
@@ -1434,4 +1440,5 @@
             }
         }
+        $app->{static_dynamic_maps} = @static_maps ? \@static_maps : 0;
     }
 
Index: /branches/release-39/lib/MT/CMS/Common.pm
===================================================================
--- /branches/release-39/lib/MT/CMS/Common.pm (revision 2406)
+++ /branches/release-39/lib/MT/CMS/Common.pm (revision 2502)
@@ -366,20 +366,26 @@
             || $obj->type eq 'individual' )
         {
+            my $static_maps = delete $app->{static_dynamic_maps};
             require MT::TemplateMap;
-            my @maps = MT::TemplateMap->load(
-                {
-                    template_id => $obj->id,
-                    build_type  => MT::PublishOption::DYNAMIC()
-                }
-            );
-            my @ats = map { $_->archive_type } @maps;
-            if ($#ats >= 0) {
-                $q->param( 'type', join( ',', @ats ) );
-                $q->param( 'with_indexes', 1 );
-                $q->param( 'no_static', 1 );
-                $q->param( 'template_id', $obj->id );
-                $q->param( 'single_template', 1 );
-                require MT::CMS::Blog;
-                return MT::CMS::Blog::start_rebuild_pages($app);
+            my $terms = {};
+            if ( $static_maps && @$static_maps ) {
+                $terms->{id} = $static_maps;
+            }
+            else {
+                # all existing maps have been dynamic
+                # do nothing
+            }
+            if ( %$terms ) {
+                my @maps = MT::TemplateMap->load($terms);
+                my @ats = map { $_->archive_type } @maps;
+                if ($#ats >= 0) {
+                    $q->param( 'type', join( ',', @ats ) );
+                    $q->param( 'with_indexes', 1 );
+                    $q->param( 'no_static', 1 );
+                    $q->param( 'template_id', $obj->id );
+                    $q->param( 'single_template', 1 );
+                    require MT::CMS::Blog;
+                    return MT::CMS::Blog::start_rebuild_pages($app);
+                }
             }
         }
