Revision 237

Date:
2012/09/03 16:05:41
Author:
ahitrov
Revision Log:
Record comments
Files:

Legend:

 
Added
 
Removed
 
Modified
  • utf8/plugins/blogs/lib/blogs/Record.pm

     
    40 40 return 'blogs::SQL::RecordsTable';
    41 41 }
    42 42
    43
    44 sub get_comments {
    45 my $self = shift;
    46 my (%opts) = @_;
    47 my $order_by = exists $opts{reverse} ? 'ctime desc' : 'ctime';
    48 my $comments = $self->keeper->get_documents (
    49 class => 'blogs::Comment',
    50 status => 1,
    51 blog_id => $self->blog_id,
    52 record_id => $self->id,
    53 order_by => $order_by,
    54 return_mode => 'array_ref',
    55 );
    56 return $comments;
    57 }
    58
    59
    60 sub get_comments_tree {
    61 my $self = shift;
    62 my $TREE;
    63 my $comments = $self->get_comments;
    64 map {
    65 my $pid = $_->pid || 0;
    66 $TREE->{$pid} = [] unless exists $TREE->{$pid};
    67 push @{$TREE->{$pid}}, $_;
    68 } @$comments;
    69 return $TREE;
    70 }
    71
    72
    43 73 sub contenido_status_style
    44 74 {
    45 75 my $self = shift;
  • utf8/plugins/blogs/sql/TOAST/comments.sql

     
    18 18 create index blog_comments_sections on blog_comments using gist ( "sections" "gist__int_ops" );
    19 19 create index blog_comments_dtime on blog_comments (dtime);
    20 20 create index blog_comments_uid on blog_comments (uid);
    21 create index blog_comments_record_id on blog_comments (record_id);
    21 create index blog_comments_record_id on blog_comments (blog_id, record_id);