Changeset 2983

Show
Ignore:
Timestamp:
08/26/08 09:43:54 (3 months ago)
Author:
takayama
Message:

Fixed BugId:80947
* Added attribute "min_comment" and "max_comment" that enables filtering by count of comments.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/MT/Template/ContextHandlers.pm

    r2982 r2983  
    80558055    } 
    80568056 
     8057    # Adds an count of comments filter to the filter list. 
     8058    if ($args->{max_comment}) { 
     8059        push @filters, sub { $_[0]->comment_count <= $args->{max_comment}; }; 
     8060    } 
     8061    if ($args->{min_comment}) { 
     8062        push @filters, sub { $_[0]->comment_count >= $args->{min_comment}; }; 
     8063    } 
     8064 
    80578065    my $published = $ctx->{__stash}{entry_ids_published} ||= {}; 
    80588066    if ($args->{unique}) { 
  • trunk/php/lib/mtdb_base.php

    r2712 r2983  
    715715        } 
    716716 
     717        # Adds an count of comment filter 
     718        if (isset($args['max_comment']) && is_numeric($args['max_comment'])) { 
     719            $max_comment_filter = 'and entry_comment_count <= ' . intval($args['max_comment']); 
     720        } 
     721        if (isset($args['min_comment']) && is_numeric($args['min_comment'])) { 
     722            $min_comment_filter = 'and entry_comment_count >= ' . intval($args['min_comment']); 
     723        } 
     724 
    717725        if (count($entry_list) && ($entry_filter == '')) { 
    718726            $entry_list = implode(",", array_keys($entry_list)); 
     
    759767                'min_score',  'max_score', 
    760768                'min_rate',    'max_rate', 
    761                 'min_count',  'max_count' 
     769                'min_count',  'max_count', 
     770                'min_comment', 'max_comment' 
    762771              ) as $valid_key ) 
    763772            { 
     
    908917                   $day_filter 
    909918                   $class_filter 
     919                   $max_comment_filter 
     920                   $min_comment_filter 
    910921        "; 
    911922