Show
Ignore:
Timestamp:
10/03/08 01:07:01 (14 months ago)
Author:
bchoate
Message:

Merging fireball branch changes to-date to trunk: svn merge -r2974:3081 http://code.sixapart.com/svn/movabletype/branches/fireball .

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/MT/CMS/Dashboard.pm

    r2812 r3082  
    404404 
    405405    my $terms = {}; 
     406    my $args = {}; 
    406407    $terms->{blog_id} = $blog_id if $blog_id; 
    407408    $terms->{object_datasource} = 'entry'; 
    408     my $args = {}; 
    409409    $args->{group} = [ 'tag_id' ]; 
    410410    $args->{sort} = '1'; # sort by count(*) 
    411411    $args->{direction} = 'descend'; 
    412412    $args->{limit} = 100; 
     413    $args->{join} = MT::Tag->join_on(undef, { id => \'= objecttag_tag_id', is_private => 1 }, 
     414        { not => { is_private => 1 } } ); 
    413415 
    414416    my $iter = $app->model('objecttag')->count_group_by($terms, $args); 
    415417    my @tag_loop; 
     418    my @tag_ids; 
    416419    my $ntags = 0; 
    417420    my $min = undef; 
    418421    my $max = undef; 
    419422    while (my ($count, $tag_id) = $iter->()) { 
    420         my $tag = MT::Tag->load($tag_id) or next; 
    421         next if $tag->is_private; # weed these from the dashboard 
    422423        $ntags += $count; 
    423424        $min = defined $min ? ($count < $min ? $count : $min) : $count; 
    424425        $max = defined $max ? ($count > $max ? $count : $max) : $count; 
    425         push @tag_loop, { name => $tag->name, count => $count }; 
     426        push @tag_loop, { id => $tag_id, count => $count }; 
     427        push @tag_ids, $tag_id; 
     428    } 
     429 
     430    if ( @tag_ids ) { 
     431        my $iter = MT::Tag->load_iter( { id => \@tag_ids } ); 
     432        my %tags; 
     433        while ( my $t = $iter->() ) { 
     434            $tags{ $t->id } = $t->name; 
     435        } 
     436        $_->{name} = $tags{$_->{id}} for @tag_loop; 
    426437    } 
    427438