Changeset 2115

Show
Ignore:
Timestamp:
04/26/08 06:54:49 (22 months ago)
Author:
bchoate
Message:

Paginate rebuild operation for list action to publish archive templates. Added 'save and rebuild' button for archive templates. BugId:79515

Location:
branches/release-36
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • branches/release-36/lib/MT/CMS/Blog.pm

    r2103 r2115  
    588588    my $no_static = $q->param('no_static'); 
    589589    my $template_id = $q->param('template_id'); 
     590    my $map_id = $q->param('templatemap_id'); 
    590591 
    591592    my ($tmpl_saved); 
     
    709710                    FilterCallback => $cb, 
    710711                    $no_static ? ( NoStatic   => 1 )            : (), 
    711                     $template_id ? ( TemplateID => $template_id ) : (), 
     712                    $template_id ? ( TemplateID => $template_id, Force => 1 ) : (), 
     713                    $map_id ? ( TemplateMap => $template_id, Force => 1 ) : (), 
    712714                ) or return $app->publish_error(); 
    713715                $offset += $count; 
     
    906908    } 
    907909 
    908     my $type          = $q->param('type'); 
     910    my $type          = $q->param('type') || ''; 
    909911    my $next          = $q->param('next') || 0; 
    910912    my @order         = split /,/, $type; 
  • branches/release-36/lib/MT/CMS/Common.pm

    r2113 r2115  
    374374            $app->add_return_arg( id => $obj->id ); 
    375375        } 
    376         $q->param( 'type',            'index-' . $obj->id ); 
    377         $q->param( 'tmpl_id',         $obj->id ); 
    378         $q->param( 'single_template', 1 ); 
    379         require MT::CMS::Blog; 
    380         return MT::CMS::Blog::start_rebuild_pages($app); 
     376        if ( $obj->type eq 'index' ) { 
     377            $q->param( 'type',            'index-' . $obj->id ); 
     378            $q->param( 'tmpl_id',         $obj->id ); 
     379            $q->param( 'single_template', 1 ); 
     380            return $app->forward( 'start_rebuild' ); 
     381        } else { 
     382            # archive rebuild support 
     383            $q->param( 'id', $obj->id ); 
     384            return $app->forward( 'publish_archive_templates' ); 
     385        } 
    381386    } 
    382387    elsif ( $type eq 'template' ) { 
  • branches/release-36/lib/MT/CMS/Template.pm

    r2110 r2115  
    19801980      || $perms->can_rebuild; 
    19811981 
    1982     my $blog = $app->blog; 
    1983     my $templates = 
    1984       MT->model('template')->lookup_multi( [ $app->param('id') ] ); 
     1982    my @ids = $app->param('id'); 
     1983    if (scalar @ids == 1) { 
     1984        # we also support a list of comma-delimited ids like this 
     1985        @ids = split /,/, $ids[0]; 
     1986    } 
     1987    return $app->error($app->translate("Invalid request.")) 
     1988        unless @ids; 
     1989 
     1990    my $tmpl_id; 
     1991    my %ats; 
    19851992    require MT::TemplateMap; 
    1986     # FIXME: Need multi-request support! 
    1987     TEMPLATE: for my $tmpl (@$templates) { 
    1988         next TEMPLATE if !defined $tmpl; 
    1989         next TEMPLATE if $tmpl->blog_id != $blog->id; 
    1990         my @tmpl_maps = MT::TemplateMap->load( { template_id => $tmpl->id } ); 
     1993    while (!$tmpl_id && @ids) { 
     1994        $tmpl_id = shift @ids; 
     1995        my @tmpl_maps = MT::TemplateMap->load( { template_id => $tmpl_id } ); 
    19911996        foreach my $map (@tmpl_maps) { 
    19921997            next unless $map->build_type; 
    1993             $app->rebuild( 
    1994                 Blog        => $blog, 
    1995                 ArchiveType => $map->archive_type, 
    1996                 TemplateMap => $map, 
    1997                 NoIndexes   => 1, 
    1998                 Force       => 1, 
    1999             ); 
    2000         } 
    2001     } 
    2002  
    2003     $app->call_return( published => 1 ); 
     1998            $ats{ $map->archive_type } = 1; 
     1999        } 
     2000        undef $tmpl_id unless keys %ats; 
     2001    } 
     2002 
     2003    # we have a template and archive types to publish! 
     2004 
     2005    require MT::CMS::Blog; 
     2006    my $return_args; 
     2007    if (@ids) { 
     2008        # we have more to do after this, so save the list 
     2009        # of remaining archive templates... 
     2010        $return_args = $app->uri_params( 
     2011            mode => 'publish_archive_templates', 
     2012            args => { 
     2013                magic_token => $app->current_magic, 
     2014                blog_id => scalar $app->param('blog_id'), 
     2015                id => join(",", @ids), 
     2016            } 
     2017        ); 
     2018    } else { 
     2019        # nothing left after this publish operation; just return 
     2020        # to the listing screen. 
     2021        $return_args = $app->uri_params( 
     2022            mode => 'list', 
     2023            args => { 
     2024                _type => 'template', 
     2025                blog_id => scalar $app->param('blog_id'), 
     2026                published => 1 
     2027            } 
     2028        ); 
     2029    } 
     2030    $return_args =~ s/^\?//; 
     2031 
     2032    $app->return_args( $return_args ); 
     2033    $app->param( 'template_id', $tmpl_id ); 
     2034    $app->param( 'single_template', 1 ); # forces fullscreen mode 
     2035    $app->param( 'type', join(",", keys %ats) ); 
     2036    return MT::CMS::Blog::start_rebuild_pages($app); 
    20042037} 
    20052038 
  • branches/release-36/tmpl/cms/edit_template.tmpl

    r2054 r2115  
    154154        type="submit" 
    155155        accesskey="v" 
     156        tabindex="13" 
    156157        title="Preview" 
    157158        onclick="return validate(this.form);" 
     
    160161    <mt:unless name="build_dynamic"> 
    161162        <mt:if name="can_rebuild"> 
    162             <mt:if name="type_index"> 
     163            <mt:if name="template_group" like="/^(archive|index)$/"> 
    163164    <button 
    164165        type="submit" 
    165166        accesskey="r" 
    166         tabindex="13" 
     167        tabindex="14" 
    167168        title="<__trans phrase="Save and Publish this template (r)">" 
    168169        onclick="return validate(this.form, 1);" 
     
    564565        help_section="output_file"> 
    565566        <div class="textarea-wrapper"> 
    566             <input name="outfile" id="outfile" tabindex="5" value="<mt:var name="outfile" escape="html">" class="full-width" mt:watch-change="1" /> 
     567            <input name="outfile" id="outfile" tabindex="4" value="<mt:var name="outfile" escape="html">" class="full-width" mt:watch-change="1" /> 
    567568        </div> 
    568569    </mtapp:setting> 
     
    575576        help_page="templates" 
    576577        help_section="template_type"> 
    577         <select name="identifier" id="identifier" tabindex="4" class="full-width"> 
     578        <select name="identifier" id="identifier" tabindex="5" class="full-width"> 
    578579            <option value="" <mt:unless name="identifier">selected="selected"</mt:unless>><__trans phrase="Custom Index Template"></option> 
    579580        <mt:loop name="index_identifiers"> 
  • branches/release-36/tmpl/cms/rebuilding.tmpl

    r2026 r2115  
    66    window.location='<mt:var name="redirect_target">'; 
    77<mt:else> 
    8     window.location='<mt:var name="script_url">?__mode=rebuild&blog_id=<mt:var name="blog_id">&type=<mt:var name="build_type">&next=<mt:var name="build_next">&offset=<mt:var name="offset">&limit=<mt:var name="limit">&total=<mt:var name="total">&start_time=<mt:var name="start_time">&entry_id=<mt:var name="entry_id">&is_new=<mt:var name="is_new">&old_status=<mt:var name="old_status">&old_previous=<mt:var name="old_previous">&old_next=<mt:var name="old_next"><mt:if name="is_full_screen">&fs=1</mt:if><mt:if name="with_indexes">&with_indexes=1</mt:if><mt:if name="no_static">&no_static=1</mt:if><mt:if name="template_id">&template_id=<mt:var name="template_id"></mt:if><mt:if name="return_args">&return_args=<mt:var name="return_args" escape="url"></mt:if>'; 
     8    window.location='<mt:var name="script_url">?__mode=rebuild&blog_id=<mt:var name="blog_id">&type=<mt:var name="build_type">&next=<mt:var name="build_next">&offset=<mt:var name="offset">&limit=<mt:var name="limit">&total=<mt:var name="total">&start_time=<mt:var name="start_time">&entry_id=<mt:var name="entry_id">&is_new=<mt:var name="is_new">&old_status=<mt:var name="old_status">&old_previous=<mt:var name="old_previous">&old_next=<mt:var name="old_next"><mt:if name="is_full_screen">&fs=1</mt:if><mt:if name="with_indexes">&with_indexes=1</mt:if><mt:if name="no_static">&no_static=1</mt:if><mt:if name="template_id">&template_id=<mt:var name="template_id"></mt:if><mt:if name="templatemap_id">&templatemap_id=<mt:var name="templatemap_id"></mt:if><mt:if name="return_args">&return_args=<mt:var name="return_args" escape="url"></mt:if>'; 
    99</mt:if> 
    1010}