Index: branches/release-33/lib/MT/CMS/Template.pm
===================================================================
--- branches/release-33/lib/MT/CMS/Template.pm (revision 1775)
+++ branches/release-33/lib/MT/CMS/Template.pm (revision 1786)
@@ -505,22 +505,4 @@
     require MT::Template;
     my $blog_id = $app->param('blog_id') || 0;
-    # my $filter  = $app->param('filter_key');
-    # if ( !$filter ) {
-    #     if ($blog) {
-    #         $filter = 'templates';
-    #         $app->param( 'filter_key', 'templates' );
-    #     }
-    #     else {
-    #         $filter = 'module_templates';
-    #         $app->param( 'filter_key', 'module_templates' );
-    #     }
-    # }
-    # else {
-    #     # global index templates redirect to module templates
-    #     if ( !$blog && $filter eq 'templates' ) {
-    #         $filter = 'module_templates';
-    #         $app->param( 'filter_key', 'module_templates' );
-    #     }
-    # }
     my $terms = { blog_id => $blog_id };
     my $args  = { sort    => 'name' };
@@ -564,5 +546,4 @@
     my $params        = {};
     my $filter = $app->param('filter_key');
-    $app->delete_param('filter_key') if $filter;
     my $template_type = $filter || '';
     $template_type =~ s/_templates//;
@@ -654,4 +635,13 @@
     }
     foreach my $tmpl_type (@types) {
+        $app->delete_param('filter_key') if $filter;
+        if ( $tmpl_type eq 'index' ) {
+            $filter = 'index_templates';
+            $app->param( 'filter_key', 'index_templates' );
+        }
+        elsif ( $tmpl_type eq 'archive' ) {
+            $filter = 'archive_templates';
+            $app->param( 'filter_key', 'archive_templates' );
+        }
         $terms->{type} = $types{$tmpl_type}->{type};
         my $tmpl_param = $app->listing(
@@ -1847,4 +1837,35 @@
 }
 
+sub publish_archive_templates {
+    my $app = shift;
+    $app->validate_magic or return;
+
+    # permission check
+    my $perms = $app->permissions;
+    return $app->errtrans("Permission denied.")
+      unless $app->user->is_superuser
+      || $perms->can_administer_blog
+      || $perms->can_rebuild;
+
+    my $blog = $app->blog;
+    my $templates =
+      MT->model('template')->lookup_multi( [ $app->param('id') ] );
+    use MT::TemplateMap;
+    TEMPLATE: for my $tmpl (@$templates) {
+        next TEMPLATE if !defined $tmpl;
+        next TEMPLATE if $tmpl->blog_id != $blog->id;
+        my @tmpl_maps = MT::TemplateMap->load( { template_id => $tmpl->id } );
+        foreach my $map (@tmpl_maps) {
+            $app->rebuild(
+                BlogID      => $blog->id,
+                ArchiveType => $map->archive_type,
+                NoIndexes   => 1,
+            );
+        }
+    }
+
+    $app->call_return( published => 1 );
+}
+
 {
     my @period_options = (
