Changeset 2549

Show
Ignore:
Timestamp:
06/11/08 00:42:59 (5 months ago)
Author:
fumiakiy
Message:

Do not call listing method when there is no appropriate condition for the type when building list of templates. BugId:79976

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/release-39/lib/MT/CMS/Template.pm

    r2527 r2549  
    727727            $app->param( 'filter_key', 'module_templates' ); 
    728728        } 
    729         $terms->{type} = $types{$tmpl_type}->{type}; 
    730         my $tmpl_param = $app->listing( 
    731             { 
    732                 type     => 'template', 
    733                 terms    => $terms, 
    734                 args     => $args, 
    735                 no_limit => 1, 
    736                 no_html  => 1, 
    737                 code     => $hasher, 
    738             } 
    739         ); 
    740  
     729        my $tmpl_param = {}; 
     730        unless ( exists($types{$tmpl_type}->{type}) 
     731          && 'ARRAY' eq ref($types{$tmpl_type}->{type}) 
     732          && 0 == scalar(@{$types{$tmpl_type}->{type}}) ) 
     733        { 
     734            $terms->{type} = $types{$tmpl_type}->{type}; 
     735            $tmpl_param = $app->listing( 
     736                { 
     737                    type     => 'template', 
     738                    terms    => $terms, 
     739                    args     => $args, 
     740                    no_limit => 1, 
     741                    no_html  => 1, 
     742                    code     => $hasher, 
     743                } 
     744            ); 
     745        } 
    741746        my $template_type_label = $types{$tmpl_type}->{label}; 
    742747        $tmpl_param->{template_type} = $tmpl_type;